# How to rotate a revolute joint smoothly from -PI to PI

I’m using a translator, so some of the text may not be that accurate.
I use sensor_msgs/JointState to control the rotation of a revolute joint, when the rotation angle changes from -pi to pi, the joint rotates along the inferior arc, not the superior arc.
I tried converting the angle to [-2PI,2PI] but it didn’t work.
Under the property window, enter the angle manually for the Angular drive, enter 361° then -1° and it will rotate around the superior arc (actually rotate -2°). If you enter 539(179+360)° and then -179°, it will rotate around the inferior arc (actually rotating -718° instead of +2°).
The version I’m currently using is 2023.1.1
How should I get the revolute joint to rotate smoothly from -PI to PI. Thanks.

Hi,

I am moving your topic to the Isaac Sim category for better visibility.

Raffaello

Are you using JointState or the Angular Drive?
What are your Joint Upper and Lower Limits?
If you’re using the JointState without an Angular drive , then the angular position is set instantaneously so there is no “joint rotation” happening, so I think this is not your problem.

If you’re using the Angular Drive, asking it to move from +539 to -179, will correctly do a -718 rotation.

If you are trying to model some physical robot that only reports Joint State in the [-180, 180] range, but allows to do multiple revolutions (sometimes these are mapped to “robot configuration flags” to handle multiple joint solutions for the same cartesian position) you need to map your “angle180 * revolution” to an appropriate range.
So for example if the robot can do [-180,180] and 3 revolutions of the joint, you will have to map every joint position back and forth with the simulator it to [-180 * 3, +180 * 3].

If this is not what you’re trying to achieve, could you please explain it with more detail?

A simplified .usd test case or picture / video would help too, if possible.

I’m using Angular Drive without Upper and Lower limits.
My robot uses a conductive slip ring, which allows the head to rotate all the way around the chassis in one direction.
I use the ROS1 Bridge for revolute joint control. I tried to map the position to a larger range, but the mapping is limited to [-2PI,2PI].

When I try publish the joint_command
rostopic pub -1 /joint_command sensor_msgs/JointState ‘{name:[“RevoluteJoint”], position:[-6.29]}’
There were some errors. 6.29 Slightly larger than 2PI.

The video quality of .gif may not look good, I wonder know how to upload .mp4 and.usd file. Upload buttom does not seem to support this format.

they’ve removed MP4 from being attached in the forum. that said, an alternative would be to dump the MP4 to cloud like google drive and provide the link to it.

@EnderMandS you need to allow creation of a Physx UNWRAPPED joint to solve the error you’re getting.

In order to do so you will have to set the upper and lower limit of the revolute joint, to a range that needs to be bigger than the values you’re planning to set with your messages (Revolute Joint Tab / Lower Limit / Upper Limit)

You could make the limits [-4PI , +4PI] for example if you want to allow setting joint positions that are slightly bigger than 2PI.