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
Rover ackermann module #23024
base: main
Are you sure you want to change the base?
Rover ackermann module #23024
Conversation
Please check the Clang Tidy errors 👍 , otherwise this look super promising! |
6fd8baf
to
2eda407
Compare
2eda407
to
d62e8f5
Compare
Very nice! Did you check if it still works with the gazebo-classic rover? |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/rover-ackermann-oscillates-on-a-straight-track/37797/2 |
src/modules/ackermann_drive/AckermannDriveControl/AckermannDriveControl.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
Hi @chfriedrich98 , |
Hi @Zugsepp, |
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.hpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.hpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.hpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
ca4192f
to
9939834
Compare
src/modules/ackermann_drive/AckermannDriveGuidance/AckermannDriveGuidance.cpp
Outdated
Show resolved
Hide resolved
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.
Not fully through yet but those are my comments so far.
ROMFS/px4fmu_common/init.d/airframes/50010_ackermann_rover_generic
Outdated
Show resolved
Hide resolved
ROMFS/px4fmu_common/init.d/airframes/50010_ackermann_rover_generic
Outdated
Show resolved
Hide resolved
ROMFS/px4fmu_common/init.d/airframes/50010_ackermann_rover_generic
Outdated
Show resolved
Hide resolved
Co-authored-by: Matthias Grob <maetugr@gmail.com>
Solved Problem
This PR adds a new module specifically for ackermann steering, continuing the rover overhaul started with #22402.
Solution
The setup requires the following geometric data for the specific rover in use:
The module is structured as follows:
The commands that are sent to the actuators are generated in
AckermannDriveControl
from aAckermannDriveSetpoint
.This setpoint is an ackermann specific message that includes the following:
This setpoint can be generated from manual inputs or a mission plan.
Manual mode
In
AckermannDrive
manual inputs from a controller are directly converted to aAckermannDriveSetpoint
. For further development an "assisted" or "stabilized" manual mode could include features such as rate control and roll prevention.Mission mode
AckermannDriveGuidance
implements a path following algorithm called Pure pursuit.The controller takes the intersection point between a circle around the vehicle and the line segment connecting the previous and current waypoint. The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.
The required steering angle is calculated such that the vehicle reaches the aforementioned intersection point:
A great illustration for the derivation of this equation can be found at https://thomasfermi.github.io/Algorithms-for-Automated-Driving/Control/PurePursuit.html.
The look ahead distance sets how aggressive the controller behaves and is defined as follows:
It depends on the velocity$v$ of the rover and a tuning parameter $k$ that can be set with the parameter AD_LOOKAHEAD_TUN.
To deal with the edge case that the line segment is outside the look ahead radius around the rover there are 2 steps:
To summarize, the following parameters can be used to tune the controller:
To enable a smooth trajectory, the acceptance radius of waypoints is scaled based on the angle between a line segment from the current-to-previous and current-to-next waypoints. The ideal trajectory would be to arrive at the next line segment with the heading pointing towards the next waypoint. For this purpose the minimum turning circle of the rover is inscribed tangentially to both line segments.
The acceptance radius of the waypoint is set to the distance from the waypoint to the tangential points between the circle and the line segments:
The scaling of the acceptance radius causes the rover to "cut corners" to achieve a smooth trajectory. The degree to which corner cutting is allowed can be tuned, or disabled, with the following parameters:
The tuning parameter is a multiplicand on the calculated ideal acceptance radius to account for dynamic effects.
To smoothen the trajectory further and reduce the risk of the rover rolling over, the mission speed is reduced while the rover is within the acceptance radius. This is achieved by multiplying the inverse of the acceptance radius with a tuning parameter. This value is constrained between a minimum allowed speed and the default mission speed.
This effect can be tuned, or disabled, with the following parameters:
Lastly, a PI controller regulates the speed of the rover in
AckermannDriveControl
and can be tuned with the following parameters:Changelog Entry
For release notes:
Alternatives
Open to any suggestions.
Test coverage
Context
ackermann_rover_sitl.mp4