Universal Robots Forum

Unexpected behavior in Gazebo while crossing 180 degrees

I am using ‘/pos_joint_traj_controller/follow_joint_trajectory’ action interface to control the simulated UR in Gazebo. I have an external motion planner which commands the robot to move in cartesian space. However, when the commanded trajectory involves any joint crossing 180 degrees from higher value to lower value, the joint rotates full 360 degrees before settling down to the new value.

In addition to this, such behavior is only there for the first instance of motion. If I repeat the same motion again, the robot moves as expected. Please see attached gif for more details. I am mainly curious that why the robot responds to the exact same joint position, velocity and acceleration commands differently in two instances.


What is your toolchain from a Cartesian path to the joint-based trajectory executed by the gazebo controller?

As the gazebo simulation executes a joint-based trajectory, the “flip” is already encoded inside the joint trajectory sent to the gazebo controller.