Obtaining the joint angles of the UR5 robot arm in the simulation

Typically: "How do I... ", "How can I... " questions
Post Reply
anyu
Posts: 5
Joined: 01 May 2025, 08:57

Obtaining the joint angles of the UR5 robot arm in the simulation

Post by anyu »

hello,
I recently encountered a problem and I hope you can help me solve it. Thank you very much.

In my simulation environment, I added a UR5 robot arm and remotely controlled it in the simulation via Python using zmqAPI. I aim to move the arm to a target position by rotating its joints to my custom - defined angles. But after inputting a list of six joint angles and using sim.setJointTargetPosition () to set each joint's angle, when I use sim.getJointPosition () to retrieve the angles, the output angles don’t match my input ones. Also, the output varies each time I run it.
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Obtaining the joint angles of the UR5 robot arm in the simulation

Post by coppelia »

Hello,

your joints in that model are dynamically enabled and simulated. Meaning that they won't instantaneously jump to the desired position, but simply instruct a controller to move to that position. The controller needs time to reach the position, this is the same in a real-world situation: a car motor won't instantaneously jump to the desired velocity.

If you disable dynamics (or set the joints to kinematics mode), then you can instantaneously jump to the desired position with sim.setJointPosition

Cheers
anyu
Posts: 5
Joined: 01 May 2025, 08:57

Re: Obtaining the joint angles of the UR5 robot arm in the simulation

Post by anyu »

Thank you very much for your answer; it resolved my doubts.
Post Reply