PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.58k stars 13.56k forks source link

mecanum: new features #24036

Open chfriedrich98 opened 3 days ago

chfriedrich98 commented 3 days ago

Solved Problem

This PR adds the following new features to the mecanum module:

  1. Deprecate RM_MISS_SPD_DEF: This brings the module in line with the other 2 rover modules. The default mission speed is now simply the maximum speed RM_MAX_SPEED or specified with a speed waypoint.

  2. Deprecate RM_MAN_YAW_SCALE: This is also to bring the module in line with the other rover modules. This parameter is removed and its functionality is instead provided by RM_MAX_YAW_RATE and RM_MAX_THR_YAW_R (which already existed).

  3. Add slew rates for the yaw, yaw rate and speed setpoints. Same idea/implementation as with the differential module (https://github.com/PX4/PX4-Autopilot/pull/23812). Adds 2 new parameters RM_MAX_DECEL and RM_MAX_YAW_ACCEL.

  4. Fix inverse kinematics: The yaw rate prioritization was implemented wrong. The prioritization of the yaw rate over the velocity caused the rover to completely disregard the velocity setpoint if for example the user was giving full forward throttle + some yaw rate input while keeping the lateral throttle at 0. This happend because of an if statement that checked the sign consistency of the original and reduced speed setpoints which could fail due to floating point precision.
    The updated inverse kinematics instead scales the requested normalized velocity vector to be withing a square that is scaled based on the control effort that is left after applying the required motor commands for the yaw rate. This way the desired yaw rate is achieved (prioritized over speed) and the velocity direction is maintained while ensuring that none of the normalized motor commands exceed [-1, 1].

  5. Adjust speed setpoints to always be feasible: Using the same calculation as the new inverse kinematics, the speed setpoint in closed loop speed control is adjusted based on the yaw rate setpoint s.t. the setpoint is always feasible.

  6. Update the mecanum SITL airframe with the new/deprecated parameters.

Test coverage

mrpollo commented 3 days ago

I think CI might have caught a real error here https://github.com/PX4/PX4-Autopilot/actions/runs/12014063746/job/33488988716?pr=24036#step:6:9349

chfriedrich98 commented 3 days ago

@mrpollo Thanks for the heads up. It is caused by one of these commits (5640287 or e2d553c) which are actually part of this PR: https://github.com/PX4/PX4-Autopilot/pull/23931. The reason they are in here is because my PR builds on this other one and the things I add are ready to be reviewed. It will of course not go in like this, but rather after that other PR was fixed/merged which is why it is in draft.

MaEtUgR commented 2 days ago

The failing unit tests were my PRs fault sry 😇