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

Add support for Acro mode on Rovers with Rates Control #18317

Closed
wants to merge 6 commits into from

Conversation

Jaeyoung-Lim
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Sep 30, 2021

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

@dagar
Copy link
Member

dagar commented Sep 30, 2021

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

@Jaeyoung-Lim Jaeyoung-Lim added the Rover 🚙 Rovers and other UGV label Sep 30, 2021
@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Sep 30, 2021

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 Jaeyoung-Lim marked this pull request as ready for review October 1, 2021 07:01
bresch
bresch previously approved these changes Dec 16, 2021
Copy link
Member

@bresch bresch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jaeyoung-Lim Do you need to do any further modifications or can we merge this?

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Feb 23, 2022

@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 Jaeyoung-Lim marked this pull request as draft February 23, 2022 11:16
@junwoo091400 junwoo091400 self-assigned this Jul 19, 2022
@junwoo091400
Copy link
Contributor

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

  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 🤔 )

@Jaeyoung-Lim
Copy link
Member Author

@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

@junwoo091400
Copy link
Contributor

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

  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
Copy link
Contributor

junwoo091400 commented Jul 22, 2022

Interestingly, it seems like rover attitude control was intentionally removed at one point in PX4 : #12239

@Jaeyoung-Lim
Copy link
Member Author

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.

@junwoo091400
Copy link
Contributor

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 🤔). Silvan hinted that Rover probably shouldn't even consider using trajectory_setpoint. What do you think about this? @Jaeyoung-Lim

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jul 22, 2022

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

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.

This is important for vehicles operating in low friction surfaces or boats
Increase ground speed trim
Use rate control for pos control
Controls
@Jaeyoung-Lim Jaeyoung-Lim marked this pull request as ready for review August 20, 2022 15:37
@Jaeyoung-Lim
Copy link
Member Author

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
Copy link
Member Author

Jaeyoung-Lim commented Aug 21, 2022

Reopened in #20082 with adaptation to get it working on boats

@swimmingseeds
Copy link

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
Copy link

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

@DronecodeBot
Copy link

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

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
None yet
Development

Successfully merging this pull request may close these issues.

6 participants