PX4-Autopilot
PX4-Autopilot copied to clipboard
Differential: Update module
Solved Problem
This PR includes the following udpates to the differential rover module:
- Fix for the closed loop yaw rate control: There was a work around during mission mode in which the yaw rate setpoint was non-zero at the end of a mission. This is no longer necessary and was removed.
- Improve slow down effect: So far the rover would come to a smooth stop at every waypoint even if there is no readjustment of the heading necessary (i.e. straight line). This PR introduces a new logic which only slows the rover down if the angle between the 2 line segments prevWP-currWP and currWP-nextWP is below a certain threshold.
This threshold can be set with a new parameter called RD_SLOW_THRSHLD
- Add support for speed waypoint: The speed waypoint can now be used in mission planning to adjust the default mission speed.
- Add control folder and refactor code: Refactoring code to make it more readable and seperates the code related to turning setpoints into motor commands into its own folder. This leads to the following structure:
This restructure is in preparation to allow offboard control by injecting setpoints from outside the module with a newly introduced message called RoverDifferentialSetpoint.mgs:
| Variable | Description | Unit |
|---|---|---|
| forward_speed_setpoint | Forward speed setpoint | m/s or [-1, 1] |
| yaw_rate_setpoint | Yaw rate setpoint | rad/s or [-1, 1] |
| yaw_setpoint | Yaw setpoint | rad |
| closed_loop_speed | Use closed loop speed control | bool |
| closed_loop_yaw_rate | Use closed loop yaw rate control | bool |
| closed_loop_yaw | Use closed loop yaw control | bool |
Note the following: If the booleans for speed or yaw rate control are set to false, the respective setpoints (forward_speed_setpoint and yaw_rate_setpoint) are expected to already be normalized values in the range [-1, 1]. Also, if closed loop yaw is enabled the yaw_rate_setpoint is disregarded and overriden as the yaw control has a higher priority.
- Add tuning for the r1 airframe (50001)