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

Add support for Acro mode on Rovers with Rates Control

Open Jaeyoung-Lim opened this issue 3 years ago • 10 comments

Describe problem solved by this pull request Attitude errors were directly fed into steering angles for stabilized modes rover and boats. However, this can result in unstable behaviors if the vehicle is operating on slippery surfaces or operating on water.

Using a rate control loop improves the stability of the vehicle for stabilized mode.

Describe your solution This commit adds a angular rates controller controlling the yaw rate of the rover. This is also used for the previous attitude controller in order to stabilize the vehicles.

  • The rate controller is mapped to the acro mode of the vehicle. The horizontal stick inputs are mapped to the desired angular rate (center stick results in zero yaw rate) and the vertical stick to throttle.
  • In stabilized mode, the attitude setpoint is moved using the horizontal stick
  • Attitude controller generates rate control commands to control the vehicle, instead of steering commands
  • The rates controller is not used for mission mode (yet)

Test data / coverage Tested for stabilized mode and acro mode in SITL: https://logs.px4.io/plot_app?log=a493e453-4460-4c5d-b12f-db02084b8421

  • The yaw oscillations are coming from the gazebo model

Additional context

  • This is beneficial since it removes the ambiguity of control logic between ackerman steering vehicles and differential steering vehicles. They can both be controlled through the rate controller (related to: https://github.com/PX4/PX4-Autopilot/issues/13468. https://github.com/PX4/PX4-Autopilot/issues/11994)
  • This is a re-implementation of https://github.com/PX4/PX4-Autopilot/pull/15257

Jaeyoung-Lim avatar Sep 30 '21 16:09 Jaeyoung-Lim

Build failure in the tests (make tests). https://github.com/PX4/PX4-Autopilot/pull/18317/checks?check_run_id=3758555224 Screenshot from 2021-09-30 14-49-51

dagar avatar Sep 30 '21 18:09 dagar

Build failure in the tests (make tests). https://github.com/PX4/PX4-Autopilot/pull/18317/checks?check_run_id=3758555224

@dagar Sorry, fixed!

Jaeyoung-Lim avatar Sep 30 '21 19:09 Jaeyoung-Lim

@bresch Sorry for the late reply.

Currently it has a few issues with input scaling at low speeds when testing on a real vehicle. I think we need to fix this issue before merging.

Jaeyoung-Lim avatar Feb 23 '22 11:02 Jaeyoung-Lim

@Jaeyoung-Lim I'm trying your PR in my boat setup in this branch. And I have couple of questions :thinking:

  1. Is the L1 guidance logic still relevant? It seems to be tightly integrated into the Rover
  2. Anything I should keep in mind (regarding recent changes to control allocation), when it comes to the control aspect? (E.g. Rover is setting actuator_controls topic, but also publishing vehicle_torque_setpoint and vehicle_thrust_setpoint as well :thinking: )

junwoo091400 avatar Jul 22 '22 14:07 junwoo091400

@junwoo091400

Is the L1 guidance logic still relevant? It seems to be tightly integrated into the Rover

Could you elaborate? This is how position control is done on the rover in the current state

Anything I should keep in mind (regarding recent changes to control allocation), when it comes to the control aspect? (E.g. Rover is setting actuator_controls topic, but also publishing vehicle_torque_setpoint and vehicle_thrust_setpoint as well thinking )

This I have no idea. In principle it should not make a difference, but not sure how ackerman steering vs differential drive would be applied to control allocation

Jaeyoung-Lim avatar Jul 22 '22 14:07 Jaeyoung-Lim

Oh I was just not sure if L1 was necessary or not since I have never used it before :dizzy_face:. Few more questions :thinking:

  1. The Rate controller seems to only set the gains in the Z axis, but is this intentional? Do we only want to control the yaw rate?
  2. What happens when we have a rover that can control it's roll? (E.g. for the boat I imagine the yaw command will inevitably have effect in the roll). Should this be handled in control allocation?

junwoo091400 avatar Jul 22 '22 14:07 junwoo091400

Interestingly, it seems like rover attitude control was intentionally removed at one point in PX4 : https://github.com/PX4/PX4-Autopilot/pull/12239

junwoo091400 avatar Jul 22 '22 14:07 junwoo091400

The Rate controller seems to only set the gains in the Z axis, but is this intentional? Do we only want to control the yaw rate?

Yes, rover fundamentally is a 1Dof vehicle. I would try to get this working before we think about additional degree of freedoms to control.

What happens when we have a rover that can control it's roll? (E.g. for the boat I imagine the yaw command will inevitably have effect in the roll). Should this be handled in control allocation?

Having an effect on roll actuation and trying to control roll are two different problems. For rovers, normally you have only one degree of freedom actuator(e.g. rudder), so you can only control 1 DoF(yaw). We can add more in the future, but for now I would not consider this as a valid use case.

Jaeyoung-Lim avatar Jul 22 '22 14:07 Jaeyoung-Lim

Currently in the Rover Position Control, it seems to use the trajectory_setpoint to overwrite the position_setpoint_triplet data (thus modifying the position setpoint :thinking:). Silvan hinted that Rover probably shouldn't even consider using trajectory_setpoint. What do you think about this? @Jaeyoung-Lim

junwoo091400 avatar Jul 22 '22 15:07 junwoo091400

Currently in the Rover Position Control, it seems to use the trajectory_setpoint to overwrite the position_setpoint_triplet data (thus modifying the position setpoint thinking). Silvan hinted that Rover probably shouldn't even consider using trajectory_setpoint. What do you think about this? @Jaeyoung-Lim

Hmm...Is this discussion relevant for this PR? How does this relate to adding a rate controller for rovers?

Nevertheless, trajectory_setpoints message is currently used for passing position setpoints for offboard control. I don't see a reason that we would want to take this out, especially in the context of adding a rate controller for rovers

Jaeyoung-Lim avatar Jul 22 '22 15:07 Jaeyoung-Lim

Latest changes include:

  • Rebased to latest main
  • Integrated into standard RateControl library instead of introducing RoverRateControl
  • Integrated rate control for waypoint navigation(position control)

Jaeyoung-Lim avatar Aug 20 '22 15:08 Jaeyoung-Lim

Reopened in https://github.com/PX4/PX4-Autopilot/pull/20082 with adaptation to get it working on boats

Jaeyoung-Lim avatar Aug 21 '22 16:08 Jaeyoung-Lim

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/rc-speed-boat-with-px4-episode-1-using-px4-to-control-the-boat/28429/1

swimmingseeds avatar Mar 02 '23 17:03 swimmingseeds

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/rc-speed-boat-with-px4-episode-0-trying-out-the-boat-and-integrating-pixhawk/28407/1

swimmingseeds avatar Mar 02 '23 17:03 swimmingseeds

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-community-q-a-july-12-2023/33086/1

DronecodeBot avatar Jul 12 '23 15:07 DronecodeBot