-
Notifications
You must be signed in to change notification settings - Fork 297
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
Ackermann steering plugin's steering only mode shows opposite behaviour. Additionally added a gz PID for steering #2315
Conversation
Signed-off-by: Saurabh Kamat <saurabh.kamat@accelerationrobotics.com>
Signed-off-by: Saurabh Kamat <saurabh.kamat@accelerationrobotics.com>
Signed-off-by: Saurabh Kamat <saurabh.kamat@accelerationrobotics.com>
A little tangent but somewhat related. Is it possible with the current plugin to be able to drive the vehicle using steering angle and forward velocity? If not, is it something that can be implemented within the scope of this plugin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, it looks like there is a trailing whitespace that needs fixed to pass CI.
Hmmmm, I think that's more the role of JointController, Note that JointController uses the velocity rad/s field when using actuator_msg and steering_only in Ackermann with actuator_msg uses the position (rad). |
Signed-off-by: Saurabh Kamat <saurabh.kamat@accelerationrobotics.com>
@bperseghetti, on a completely unrelated note. Would it be a good idea to calculate wheel separation in case it is not provided by the user? We can use the world pose of the left and right steering joints and calculate that value. This calculation will not be performed if there is a value given in the SDF. Would like to hear your thoughts on this |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## gz-sim8 #2315 +/- ##
========================================
Coverage 65.97% 65.98%
========================================
Files 327 327
Lines 31328 31379 +51
========================================
+ Hits 20668 20704 +36
- Misses 10660 10675 +15 ☔ View full report in Codecov by Sentry. |
Hmmmm, I think that might be risky depending on the intended use case for it. IE using 4 wheel steering (like you see on a good amount of newer electric trucks). I think maybe you could calculate it though and then see if it does not match the provided value within a "reasonable error percentage" (IE 15%) that it publishes a gz-warn to let you know what value it thinks it should be. But depending on things like suspension etc the steering joint might actually be a relative reference to another joint and then that would be somewhat messy to follow that potential dependency tree. IE having joints for a suspension such as macpherson, wishbone, etc would make the steering joint a relative joint to those other suspension joints and that just starts to possibly become more risk than reward. Therefore, my personal take on it might lean toward it "probably not being a good choice"? |
Adds test for steering_only PID and conditional for the SDF PID elements. Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Ackermann: steering_only add tests and conditional.
Yes, that makes sense. Thanks! |
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
// Simple PID control with settable gains. | ||
this->leftSteeringJointSpeed = this->steerPosPid.Update( | ||
leftDelta, _info.dt); | ||
this->steerPosPid.Reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for resetting steerPosPid
here? If I'm not mistaken, if we reset it, the D
and I
terms of the PID will not do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was resetting the steerPosPid
because I was using the same PID for both steering joints and it was causing random motions. I didn't realise it would render the I
and D
terms useless.
After giving it more thought, I think this will be solved if I create 2 PID controllers in Configure
- one for each steering joint.
Would like to hear your thoughts on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sauk2 So, I have two thoughts, first is typically Ackermann steering is done through a physical linkage with a single steering actuator. In this case the "PID" would only be the central steering angle and that would cause some problems for the method attempting to be implemented here, I wouldn't really like to have one of my wheels with a different PID tuning or response based on angle than the other. So if it were to be done I think you would have to take the average of both wheel angles back to the central steering angle and run the PID on the central steering angle till they aligned properly (this could also have other downsides like lower convergence or a skew between the two wheels that solves the recalculated central steering angle but not having the wheels in the desired spot as they offset eachother).
The second thought I have is that while a PID might make sense for a "cmd_vel" based "miniature controller", when using the steering_only I think the only thing that should be used is P gain as it can always be wrapped with some sort of input shaping, and a lot of "raw" actuators are just proportional anyhow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should get the fix in for the steering angle, but I don't think we should necessarily couple that with the PID changes. I think these should be separate PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. So all the changes will have to be rolled back. The easiest way I can see is to reset this branch to commit id 633ce72 and then resolve the bug.
Should I go ahead with this or is there any alternate method that you have thought of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I would just pull latest commit on branch and then make the fix ontop of it: 6cfcd07
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then push your current branch to another branch like ackermann-pid so you could reference it later, and push the changes ontop the other temp working branch based on 6cfcd07 to this current branch so you don't lose history in this PR.
Yes, for that you just set wheel velocity with rad/s using the JointController plugin and also the steering angle all using the actuator msg, example is here: |
@bperseghetti Created a seperate PR #2342 for the steering error fix! Request you to take a look. |
🦟 Bug fix
Fixes #2314
Summary
Issue pertains to Ackermann Steering plugin's
steering_only
mode specifically these lines.Steps to reproduce
Additionally comment out chassis visual for better visibility
Solution
Changing signs in these equations should suffice.
Check output after implementation

Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸
🎉 New feature
Summary
gz::math::PID
) to control the steering joints for both modes - velocity and steering only.Configure
which can be overwritten from the SDF using appropriate tags.Test it
For steering only mode
For velocity mode
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.