Skip to content

Omnidirectional surface vehicle controllers for position and attitude #21138

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

Draft
wants to merge 29 commits into
base: pr-rover-ratesp
Choose a base branch
from

Conversation

not7cd
Copy link

@not7cd not7cd commented Feb 16, 2023

This PR introduces Surface Vehicle controllers for position and attitude. Attitude is based on UUV controller, while position is written from scratch. This is all work in progress. This vehicle uses 6DOF frame without roll, pitch and thrust in Z axis. And uses 4 engines in OmniX configuration.

As of now, I'm able to drive it manually proving that control allocation works, and minimal modification of PID control was needed for uuv_att_control to adapt it. Position control is not implemented.

Alternatives

Refactor rover_pos_controller to be more generic, disable so-called L1 control.
Extend uuv_pos_controller to implement more vehicle modes.

Test coverage

  • Unit/integration test: none, not sure how
  • Simulation/hardware testing logs:
    • Custon model based on UUV BlueROV2 with USV dynamics plugin.
    • Upcoming hardware testing in 4 days.

Context

Driving omni vehicles - Discussion Forum, for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink

frames

@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/px4-community-q-a-february-15-2023/30744/1

@not7cd
Copy link
Author

not7cd commented Feb 16, 2023

The logic presented here seems reasonable and close to my use case.

/**
* Core Position-Control for MC.
* This class contains P-controller for position and
* PID-controller for velocity.
* Inputs:
* vehicle position/velocity/yaw
* desired set-point position/velocity/thrust/yaw/yaw-speed
* constraints that are stricter than global limits
* Output
* thrust vector and a yaw-setpoint
*
* If there is a position and a velocity set-point present, then
* the velocity set-point is used as feed-forward. If feed-forward is
* active, then the velocity component of the P-controller output has
* priority over the feed-forward component.
*
* A setpoint that is NAN is considered as not set.
* If there is a position/velocity- and thrust-setpoint present, then
* the thrust-setpoint is ommitted and recomputed from position-velocity-PID-loop.
*/

I don't need setTiltLimit or setHoverThrust, but overall mc_pos_control seems like a good fit. I tested it in simulation and it didn't work with my usv_att_control. What can block me or how should I proceed? I honestly don't know what I'm doing.

@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/driving-omni-vehicles/30716/4

@not7cd
Copy link
Author

not7cd commented Feb 20, 2023

For the record, we had tests in the model pool, we collected some data using manual mode. Here are the results.

Flight Review #1
Flight Review #2

Full playlist on YT

We have observed that thrust and torque setpoints are fighting in control allocator. This means that with full throttle it will not allocate torque making turning while moving impossible at full throttle.

Here is an example

Should this be a problem for an attitude controller? Maybe some sort of 6DOF rate controller would solve the problem?

@@ -23,7 +23,8 @@ control_allocator start
#
# Start UUV Attitude Controller.
#
uuv_att_control start
usv_att_control start
usv_pos_control start
Copy link
Member

Choose a reason for hiding this comment

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

This basically breaks all UUV use cases

Copy link
Author

Choose a reason for hiding this comment

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

I will revert that commit. Should I create my own usv_apps? It is a bit similar to a boat and rover. So I don't know where I stand.

Copy link
Member

Choose a reason for hiding this comment

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

Right, would it be too hard to genearlize the rover position controller for your use case? We can separate out the rover_att_control if you think is needed

Copy link
Author

Choose a reason for hiding this comment

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

@Jaeyoung-Lim, I would appreciate a separate rover_pos_control, I think I might use it usv_att_control. I'm at loss with position control as I'm debugging attitude in on the real model.

Still, should I add rc.usv_apps? I guess it would feature something like this:
rover_pos_control
usv_att_control
6dof_rate_control – about this one I'm discussing at discord

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim Mar 1, 2023

Choose a reason for hiding this comment

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

Still, should I add rc.usv_apps? I guess it would feature something like this:
rover_pos_control
usv_att_control
6dof_rate_control – about this one I'm discussing at discord

I don't think this is necessary, since your vehicle is the only vehicle that would be using it. I would prefer if we can make the rover more generic, so that we can also support omnidirectional ground vehicles

Copy link
Author

Choose a reason for hiding this comment

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

For now I would be running this module, but yes. rover should become more generic. My changes could be merged with it later.

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim Mar 6, 2023

Choose a reason for hiding this comment

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

In that case, would you be able to work on separating the rover_att_controller outside of the rover position controller? I worked on #20082 before to get the low level controls going, might be useful for your usecase also

Copy link
Author

Choose a reason for hiding this comment

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

@Jaeyoung-Lim, would it be reasonable to drop this PR in favor of refactoring rover_pos_control? I think I gained enough know-how to extend it, and maybe add omni-directionality

Copy link
Member

Choose a reason for hiding this comment

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

We can also keep this open, and rebase once the refactoring is done

Copy link
Author

Choose a reason for hiding this comment

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

If your PR is in working order, I would prefer refactoring rover_pos_control to use control allocator

_thrust_setpoint(0) = manual_control_setpoint.throttle;
_thrust_setpoint(1) = manual_control_setpoint.roll;
_thrust_setpoint.setAll(0.0f);
_thrust_setpoint(0) = normalizeJoystickThrottleInput(manual_control_setpoint.throttle);
Copy link
Author

Choose a reason for hiding this comment

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

For the record, I have been bitten by an issue that was solved here #20885
This wasn't present in uuv_att_control. I have added this as a separate function. This approach could be replicated in other control modules, as it at a glance explains what is happening with the throttle setpoint. This is my way of fighting with such complex functions: smaller functions.

@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/px4-community-q-a-march-08-2023/31090/6

@not7cd not7cd changed the base branch from main to pr-rover-ratesp March 10, 2023 15:46
@junwoo091400
Copy link
Contributor

junwoo091400 commented Mar 24, 2023

This was definitely a cool project & I would love to keep track of it in the future!

As recommended by @Jaeyoung-Lim in https://discuss.px4.io/t/px4-community-q-a-march-08-2023/31090/6, it would be better to close this PR and extend the Rover control logic.

@not7cd could you do that? 😉

@junwoo091400 junwoo091400 added the Rover 🚙 Rovers and other UGV label Mar 24, 2023
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
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

4 participants