Changing velocity via process data in the background task.

  • Hi, everyone!

    I want to try changing the speed of one exact move with the process data.
    But when you change speed in process data it only changes after application is restarted.
    I decided to change it with the background task, so velocity variable in application is overrided in “real time”.
    Code has no mistakes and compilates, but after getting to the movement I control via process data it says that value should be between 0 and 1. So the process data cannot transfer the value through the background task to application. In debug mode it always stays 0.0. Maybe someone had an experience in this question and could help me.
    Thank you in advance!

  • This is the part of code of main application.

  • Any changes made to process data are reflected directly in the next access, process data is just an XML file that the framework uses for storing data across sessions. You do not need to restart the application for the changes to take effect. You only have to read the process data before parameterizing the motion.

    Your background task may compile but I think it will produce a runtime error because KUKA doesn't allow the application control class to be used within the context of a background task. When you run your app check the smartpendant, if your background task has a red stop icon next to it then it is producing a runtime error.

    1. ptpVelocity = bgTask.getPtpVelocity();

    Where is this method coming from, I can't see it in the background task?

    Why are you controlling the application override from the process data? just press the +/- button to control the override.

    If I understood your question correctly then this should be the solution

    You must read the process before executing the motion like above.

  • Thank you, I get what u told about. That is good idea, but we found a better way to do it.

    You just need to use static variable.

    This is background task:

    This is the main applicayion:

  • Hmmm, this entire background task can be replaced with this method

    1. public double getPTPVelocity(){
    2. return getApplicationData().getProcessData("ptpVelocity").getValue();
    3. }

    I really don't see why a background task is needed for this.

  • What do you think about to register a listener on the process data?

    1. getApplicationData().getProcessData("ptpVelocity ").addProcessDataListener(new IProcessDataListener() {
    2. @Override
    3. public void onProcessDataValueChanged(IProcessData arg0) {
    4. double ptpVelocity = arg0.getValue();
    5. getApplicationControl().setApplicationOverride(ptpVelocity);
    6. }
    7. });
  • Just for your information,
    Motion gets parameter when it starts, and you can't change it in realtime once it is taken into runtime.
    Meaning you need to finish at least one motion to get your changed value effective.

    if you got a loop on your motions, I think you can simplify your code with NullReference's code. Just like refreshing on Windows UI.

    Or, since your background will never stop using resources which is also being accessed by your own application,
    instead, it might be better for you to do the same on a thread inside of your application only while the application is running. Interrupt it on dispose().

  • Just for your information,
    Motion gets parameter when it starts, and you can't change it in realtime once it is taken into runtime.

    There is an option that can be installed to control velocity of all motions regardless of the execution state. It's called enhanced velocity controller and requires an option package to be installed, probably have to pay for it though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now