Encoder and torque measurement

  • Hello,


    [Newbie to Kuka programming but have some programming knowledge with another robot brand]


    [I have carefully looked at other topics on this forum]


    The goal is to measure encoder positions and motor torques while the robot is moving on a trajectory, at a fixed sampling rate.
    The trajectory was defined with a set of joint positions and the robot just has to loop all the points. The robot should move at maximum speed so $ADVANCE function was used as each point is close to the next.


    Actual code of the .src file:


    My main concern is to know how to measure at a fixed sampling rate of 250 Hz (higher if possible) and while the robot is moving. During the process, a .log file should be written and would look like:
    Time [ s ] | Angle_1 [°] | Angle_2 [°] | Angle_3 [°] | Angle_4 [°] | Angle_5 [°] | Angle_6 [°] | Torque_1 [Nm] | Torque_2 [Nm] | Torque_3 [Nm] | Torque_4 [Nm] | Torque_5 [Nm] | Torque_6 [Nm] |
    0 | value | value | ... | value |
    0.004 | value | value | ... | value |
    0.008 | value | value | ... | value |
    0.012 | value | value | ... | value |


    To record encoder data, I planned to use function $AXIS_ACT_MEAS and for the torque: $TORQUE_AXIS_ACT. Is that correct ?


    To generate the .log file, we have funtion CWRITE but how to write in the log file at fixed sample rate and during the robot motion ?


    Code that I have in mind:


    In Kuka language, do we have synchronous/ parallel tasking (for measurements) ? How to program that ?


    Can somebody share a code example ?


    Thanks for your answers,

    Edited once, last by NamBot ().

  • Hi,


    this is something you do not need to program yourself on a KUKA. Read about the Trace / Oscilloscope feature either in this forum or your documentation. On HMI (assuming KSS 8.*) you will find this feature in diagnosis->Trace but configuration can also be made using WorkVisual. Basically configuration is a xml File where the channels (e.g. torque channel) you want to record are listed. From your program you only need to choose the desired configuration file and Start and Stop your recording using $Trace system variable. Recordings are every 12 ms, 4 ms, 1 ms, 0.250 ms depending on the channels you choose.


    https://www.robot-forum.com/ro…-37)/msg121930/#msg121930
    https://www.robot-forum.com/ro…oscope/msg87575/#msg87575
    ...


    Fubini

  • Thanks for the fast answer but somehow the trace feature is disabled in Wok Visual (Trace Configuration):



    Do you know why ?


    Thanks in advance,

  • Thank you !


    I managed to transfer a configured .xml file to the Teach Pendant, then modified the .src code.



    The files should be located under c:/KRC/Roboter/Trace, but after running the path, no new files were generated. All I see is the predefined .xml configuration files.


    Is the code correct ?


    Any idea where to find the results of trace ?


    Thanks in advance,

  • path is correct - you can test trace by triggering it manually and then checking for files in that path.
    once you confirm that this part works, run your code and see if you get the same.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • You have to set up a "trigger" event when you're configuring your Trace. I usually do this by using a Flag or unused $OUT, and pulsing the signal using a TRIGGER command in my program.


    One nice thing about the Trace is that it's always running invisibly in the background, so one of the tricks you can use is to set the "time" value to start before the trigger event (there's a Duration setting, and a pre-trigger % setting). So if you're using something like Trigger-on-Error instead of a signal, or motion start, you can actually get traces that go "back in time" to capture data that leads into the trigger event.


    You can also use $TRACE.STATE to track what the Trace engine is doing.

  • Hello,


    To panic mode:


    Quote

    path is correct - you can test trace by triggering it manually and then checking for files in that path.
    once you confirm that this part works, run your code and see if you get the same.


    I configured the trace feature from the menu of the smartpad and started the task from there as well. It worked fine and obtained the measurements in the trace folder. Thanks.


    To SkyeFire:

    Quote

    You have to set up a "trigger" event when you're configuring your Trace. I usually do this by using a Flag or unused $OUT, and pulsing the signal using a TRIGGER command in my program.


    One nice thing about the Trace is that it's always running invisibly in the background, so one of the tricks you can use is to set the "time" value to start before the trigger event (there's a Duration setting, and a pre-trigger % setting). So if you're using something like Trigger-on-Error instead of a signal, or motion start, you can actually get traces that go "back in time" to capture data that leads into the trigger event.


    You can also use $TRACE.STATE to track what the Trace engine is doing.


    I set a trigger when configuring the trace feature but couldn't generate the result files from the program (only from the menu as suggested by panic mode).


    Could you please share a working program (.src + .dat files) using the trace feature (including a $TRACE.STATE to monitor the status) ?


    Thanks for your help,

Advertising from our partners