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

differential: add slew rates for speed, yaw and yaw rate setpoints #23812

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chfriedrich98
Copy link
Contributor

@chfriedrich98 chfriedrich98 commented Oct 15, 2024

Solved Problem

The yaw, yaw rate and speed setpoint that the differential module attempts to track are currently mostly step inputs.
This means there are often large errors between the setpoint and measured value leading to very aggresive behaviour and overshoots. It also ramps up any integrator in the control structure, because these setpoint trajectories are infeasible since they don't account for physical limitations of the system.

This PR additional deprectes the RD_MAN_YAW_SCALE parameter and updates the default parameter values for the 50001_aion_robotics_r1_rover with newly added/removed parameters.

Solution

By adding slew rates to the setpoints that have to be tracked by the control system the trajectory can be smoothed and made feasible. Setting these slew rates to the physical limitations of the system (or lower if that is requried) the following is achieved:

  • Overall smoother behaviour because the control system doesn't attempt to track impossible setpoint trajectories.
  • No big errors between setpoint and measured value which would lead to aggressive behaviour.
  • Tuning is made easier because the range of errors between setpoints and measured values is way smaller.

The following slew rates are implemented:

  • Forward speed: The changing rate of the speed setpoint is restricted by an acceleration/deceleration limit.
  • Yaw: The changing rate of the yaw setpoint is restricted by a yaw rate limit.
  • Yaw rate: The changing rate of the yaw rate setpoint is restricted by a yaw acceleration limit.

This adds the following new parameters:

Parameter Description Unit
RD_MAX_DECEL Deceleration limit m/s
RD_MAX_YAW_ACCEL Yaw acceleration limit deg/s^2

The parameters for the acceleration limit RD_MAX_ACCEL and the yaw rate limit RD_MAX_YAW_RATE already exist in the module, but were not used for setpoint slew rates yet.

The RD_MAN_YAW_SCALE parameter is replaced by the following equation utilizing already existing parameters:
Stick input is a value between [-1, 1].
This value is interpolated from [-1, 1] to [-RD_MAX_YAW_RATE, RD_MAX_YAW_RATE] -> $\theta_{des}$.
This is then turned into a speed difference between the left/right wheels:
$$ v_{diff} = \theta_{des} \cdot w_b / 2 $$
with $w_b: $ Wheel track
This speed diff is then interpolated from [-RD_MAX_THR_YAW_R, RD_MAX_THR_YAW_R] to [-1, 1] and then sent to the controller as a normalized speed diff setpoint.
This setpoint was renamed from yaw_rate_normalized_setpoint to speed_diff_normalized in the RoverDifferentialSetpoint.msg which is a more accurate description.

Test coverage

  • SITL tested
  • Tested on hardware

@chfriedrich98 chfriedrich98 added the Rover 🚙 Rovers and other UGV label Oct 15, 2024
@chfriedrich98 chfriedrich98 self-assigned this Oct 15, 2024
@chfriedrich98 chfriedrich98 marked this pull request as ready for review November 8, 2024 14:57
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: 👀 In Review
Development

Successfully merging this pull request may close these issues.

1 participant