Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send repeated trajectory points to the pid_position_controller to make the joint rotate continuously #1183

Open
HPCLOL opened this issue Jun 27, 2024 · 5 comments

Comments

@HPCLOL
Copy link

HPCLOL commented Jun 27, 2024

I use ros2 Iron to simulate the robot in gazebo classic.

Now, I am trying to make a joint rotate continuously. For some reasons, I have to control it with pid_position_controller in https://control.ros.org/rolling/doc/gazebo_ros2_control/doc/index.html#using-pid-control-joints. During the first rotation of the joint, I send it a series of trajectory points from -180 to 180 degrees. But because the pid_position_controller needs to receive increasing angle commands, I have to send trajectory points from 180 to 540 degrees to the controller so that it can complete the second rotation. If I still send trajectory points from -180 to 180, the joint will quickly rotate a circle in the opposite direction and then execute my trajectory, which sometimes causes the model to crash.

Is there any way I can send repeated trajectory point commands to achieve continuous rotation of the joint?

Thank you so much.

@christophfroehlich
Copy link
Contributor

Is there a chance to use a velocity command?

@christophfroehlich
Copy link
Contributor

I think that a continuous URDF joint is not the best choice for a multi-turn joint. Why can't you use just a revolute joint, if the position is important for more than one rotation?

@HPCLOL
Copy link
Author

HPCLOL commented Jun 27, 2024

Is there a chance to use a velocity command?

Using velocity commands in my application scenario may be a very inconvenient thing.

I think that a continuous URDF joint is not the best choice for a multi-turn joint. Why can't you use just a revolute joint, if the position is important for more than one rotation?

Actually the joint type I used is revolute, but I set the upper and lower limits so large that it can rotate continuously when I send it increasing position commands. I don't quite understand what you mean, even if I use a revolute joint it doesn't seem to solve the problem of crossing the boundary angles. When the angle of the joint trajectory point command exceeds the upper and lower limits, the joint cannot move normally.

@christophfroehlich
Copy link
Contributor

If it is a revolute joint, you have to send increasing values.

A continuous joint doesn't have position limits, and therefore we implemented this angle_wraparound in PID controller and JTC: It will always use the shortest distance on the unit cycle. This is somehow the same behavior as you mentioned.

The pid controlled joints in gazebo_ros2_control don't have this feature. But you can use the PID controller instead, and try the angle_wraparound.

@HPCLOL
Copy link
Author

HPCLOL commented Jun 27, 2024

Ok, I will try it out, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants