differential: add slew rates for speed, yaw and yaw rate setpoints #23812
+283
−111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the50001_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:
The following slew rates are implemented:
This adds the following new parameters:
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$\theta_{des}$ .
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] ->
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