Python robot joint tracking

is there a way to track each joint in a certain sequence using python scripting? i would need the joint force value for each joint in a sequence. also if possible i would want the distance between the joints but the main thing is the forces.

You need to calculate joint/TCP speed and acceleration from position data. There are no APIs to get this info directly from controller. In the attached layout there’s a python script “SpeedMonitoring” in the robot that creates monitoring properties on the component and then you can visualize them in statistics dashboard. You should be able to just copy paste the script to another robot and use it there (needs VC Professional / Premium).
speed_stat_test.vcmx (524.8 KB)

One detail about the script is that it forces the controller to use heartbeat so it sets it to update its status at regular interval so that it’s possible to sample data from the robot. On large simulations this might cause some drop in the performance as by default controllers only update their status when needed.

Note that there are no forces in servo / robot controlled objects in VC as there’s no dynamic model for it. Only time you see masses / inertias are the physics behviors but those do not interact with servos and robots. The “JointForce” property in PTP motions is badly named as it’s not actually force but rather the joint acceleration as percentage value (from max values on joints).

-k

what am i doing wrong? i cant seem to get the statistic monitoring to work on my robot.
Untitled2.vcmx (3.1 MB)

I forgot to mention that you need to set the statistics sampling interval to 0.01 (default sample rate on script).
image

-k

the sampling interval in the datasheet from the power consumption is 0.008. if i lowered it to that would that create any problems or would it work fine? i need to somehow link it to that data and the intervals would need to be the same

You need to change the interval for statistics, the script and the controller’s heartbeat rate. Then it should work OK.

I don’t know what your use case is but I’d just want to clarify that VC robot models’ accelerations are only rough estimates and are set with a rule “4 x joint max speed”. Joint speed is usually in the data sheets but acceleration is not so therefore we need this kind of an estimate. But it can be quite different from real life devices so do keep that in mind in case you are doing some kind of energy calculations based on the statistics.

-k

yeah thats what im trying to do since VC doesnt have an option to measure energy consumption. im planning on linking real life measurements based on speed to the simulation.if the speed is set manually and is the same as in real life then the calculations should be accurate i think

for some reason the script messes up the movement of the first robot (ABB IRB1100) in the simulation. It works normally at first then when i add the script to the robot it messes up. After i delete the script from the robot it stays messed up.
workflow update - Copy.vcmx (38.8 MB)

Enabling controller’s UseHeartbeat seems to break the robot. I’m guessing the python API and the script in robot transport controller break and perhaps some API call returns before the robot has actually completed its motions. It seems to work better if you disable “AutoHoming” on the transport controller.

Anyway I can study this use case more and see if the bug is in the script or the API and report it forwards.

-k

in order to calculate the energy consumption i would also need the time that each movement takes. is there any way to also get this data using python?

There’s monitoring property “ActiveStatement” whose value changes when robot program executes the next statement. So you could modify the script to record statement execution times based on this data. Note that this will probably only work when you manually teach the program.

-k