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

ackermann: update module structure, add acro/position mode and improve guidance #23781

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

chfriedrich98
Copy link
Contributor

@chfriedrich98 chfriedrich98 commented Oct 7, 2024

Solved Problem

This PR implements the following features:

  1. Bring the structure of the ackermann module in line with the other rover modules
  2. Updates to the slew rate
  3. Add a lateral_acceleration_setpoint
  4. Add support for Acro mode
  5. Add support for Position mode
  6. Update Auto modes with the lateral acceleration setpoint which deprecates some parameters

Solution

  1. The module now uses the same structure as the differential and mecanum module:

ackermann_module_structure

Note: Offboard mode is not yet implemented, but this structure already accounts for it.

  1. The acceleration slew rate is no longer directly applied to the motor command. Instead it is applied to the forward_speed_setpoint/forward_speed_setpoint_normalized. This leads to better controller performance as the system tracks a feasible setpoint change rather then instantenous steps. Deceleration and acceleration limits are now also seperated introducing a new parameter alongside the pre-existing RA_MAX_ACCEL:
Parameter Description Unit
RA_MAX_DECEL Maximum deceleration for the rover m/s^2
  1. The lateral acceleration setpoint is a new ackermann specific setpoint. It is comparable to the yaw rate setpoint of the other rover modules in its useage. It is used for the new Acro and Position mode aswell as the update to the Auto mode.
    This introduces the following new parameters:
Parameter Description Unit
RA_MAX_LAT_ACCEL Maximum allowed lateral acceleration m/s^2
RA_LAT_ACCEL_P Proportional gain for lateral acceleration controller -
RA_LAT_ACCEL_I Integral gain for lateral acceleration controller -
  1. Acro Mode: Moving the left stick up/down controls the speed of the rover using the forward_speed_setpoint_normalized (slew rates are applied but no closed loop speed contro). Moving the right stick left/right creates a lateral_acceleration_setpoint, which is then close loop controlled. This means the same stick input will cause different steering based on the throttle input. The mapping for the stick input to lateral_acceleration_setpoint is set with RA_MAX_LAT_ACCEL, which is also the lateral acceleration limit. By limiting the lateral acceleration we can prevent the rover from rolling over. The lateral_acceleration_setpoint is feed forward mapped to a steering input $$\theta$$ using the following equation:

$$ \theta = \arctan(\frac{w_b \cdot a_{lat}}{ v^2}) $$

with $$w_b:$$ Wheel base, $$a_{lat}:$$ Lateral acceleration setpoint and $$v:$$ Rover speed.

  1. Position Mode: Same as Acro mode except that the speed is close loop controlled and the rover is being course controlled (keep driving in a straight line) if the right stick is centered.

  2. Auto Mode: The steering setpoint that is calculated using pure pursuit and the ackermann geometry is now transformed into a lateral_acceleration_setpoint $$a_{lat}$$:

$$ a_{lat} = \frac{v^2 \cdot \tan{\theta}}{w_b} $$

with $$w_b:$$ Wheel base, $$\theta:$$ Steering angle and $$v:$$ Rover speed.

This has the following effects:

  • Roll over prevention due to the closed loop lateral acceleration controller.
  • RA_MISS_SPD_MIN is now longer necessary. The minimum speed $$v_{min}$$ is set as the speed where the maximum steering angle does not cause the rover to exceed the lateral acceleration limit:

$$ v_{min} = \sqrt{\frac{w_b \cdot a_{lat, max}}{tan(\theta_{max})}} $$

with $$w_b:$$ Wheel base, $$a_{lat, max}:$$ Maximum lateral acceleration (RA_MAX_LAT_ACCEL) and $$\theta_{max}:$$ Maximum steering angle (RA_MAX_STR_ANG).

  • RA_MISS_SPD_GAIN is no longer necessary. The maximum cornering speed $$v_{cor, max}$$ can be calculated based on the upcoming corner and the lateral acceleration limit:

$$ v_{cor, max} = \sqrt{r \cdot a_{lat, max}} $$

with $$r:$$ Turning radius for the upcoming corner and $$a_{lat, max}:$$ Maximum lateral acceleration (RA_MAX_LAT_ACCEL).

Testing

  • Tested in SITL
  • Tested on hardware

@chfriedrich98 chfriedrich98 added the Rover 🚙 Rovers and other UGV label Oct 7, 2024
@chfriedrich98 chfriedrich98 self-assigned this Oct 7, 2024
@chfriedrich98 chfriedrich98 force-pushed the ackermann_position branch 2 times, most recently from f2bb668 to f95e89b Compare October 14, 2024 07:21
@chfriedrich98 chfriedrich98 marked this pull request as ready for review October 22, 2024 08:21
Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff, makes sense what I see and most of all makes sense to align with the other rovers. Let's get it in and iterate further.

@chfriedrich98 chfriedrich98 merged commit e8f8bc9 into PX4:main Oct 31, 2024
51 of 53 checks passed
@chfriedrich98 chfriedrich98 deleted the ackermann_position branch October 31, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rover 🚙 Rovers and other UGV
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants