PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

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

Open chfriedrich98 opened this issue 1 year ago • 0 comments

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
  • Hardware tests will follow

chfriedrich98 avatar Oct 07 '24 10:10 chfriedrich98