Best way to read torques from joints

Typically: "How do I... ", "How can I... " questions
Post Reply
amirmmi
Posts: 23
Joined: 08 Jan 2022, 23:38

Best way to read torques from joints

Post by amirmmi »

Hello,
In my Coppeliasim scene, I have joints that are motor enabled + control loop enabled. I am using position control for these joints using the sim.setJointTargetPosition command, and I want to retrieve the torques that these joints are applying to the links. What is the most precise way of reading these joint torques? Is it OK to use sim.getJointForce, or should I have to use a force sensor along with sim.readForceSensor command to get the torque amount?

coppelia
Site Admin
Posts: 10337
Joined: 14 Dec 2012, 00:25

Re: Best way to read torques from joints

Post by coppelia »

Hello,

sim.getJointForce is the correct way of doing this. But why do you want to read those forces/torques?

Cheers

amirmmi
Posts: 23
Joined: 08 Jan 2022, 23:38

Re: Best way to read torques from joints

Post by amirmmi »

Thanks for your reply,
I want to store torque values as the robot's actions at each time step so I can use this data for imitation learning.

coppelia
Site Admin
Posts: 10337
Joined: 14 Dec 2012, 00:25

Re: Best way to read torques from joints

Post by coppelia »

that won't work. The position control will try to drive each joint to a specific position at a given time. Normally, a controller trying to follow a specific path will not actuate the joints in position control, but in velocity control, by driving through (or near) the points with a specific velocity.

Cheers

Post Reply