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

Position controller restricting movement to +-5 in x,y, and z axes #21

Open
ShameerMasroor opened this issue Jan 11, 2025 · 1 comment

Comments

@ShameerMasroor
Copy link

Hello.

I was experimenting with your drone's position controller as I intend to use it for path following later on.
I passed it a command of

ros2 topic pub /simple_drone/cmd_vel geometry_msgs/msg/Twist 
"{linear: {x: 0.0, y: -8.0,z: 1.0}, angular: {x: 0.0, y: 0.0, z: 2.0}}"

after turning on the position controller using the command:

ros2 topic pub /simple_drone/posctrl std_msgs/Bool '{data: true}'

The position controller restricts the movement of the drone to +-5 in all the axes, and I am honestly unable to find where in the code this restriction is being imposed.

I would be humbled if you could explain the reason behind this, and a possible fix for this.

Thank you.

@ShameerMasroor
Copy link
Author

I was able to identify the source of the issue.

Apparantly the PID controller has a limit condition which ceils the maximum input values for velocity to prevent the error from being too large and to prevent the drone from overpitching/overrolling. The implementation of the same PID controller for velocity control for the position controller is problematic, something which I believe the contributors have overlooked in the position controller.

To allow the drone to move to any position, simply comment out the line in the pid_controller.cpp file in the sjtu_drone_description folder

 // if (limit > 0.0 && fabs(new_input) > limit) {new_input = (new_input < 0 ? -1.0 : 1.0) * limit;}

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

1 participant