-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[WIP] VTOL coordinate FW and MC rate controllers only #9190
Conversation
If we go forward with this I'd also like to consider removing the thrust setpoint from the attitude setpoint and rates setpoint messages. vehicle_thrust_setpoint
Then I'd like to use it to initialize the position controllers correctly.
|
609d88a
to
b8b65af
Compare
@dagar I have now the fw rate controller running in hover for the tailsitter. In SITL we don't model any slipstream so I got the following funny behavior. |
_roll_ctrl.set_bodyrate_setpoint(_rates_sp.roll); | ||
vehicle_rates_setpoint_poll(); | ||
|
||
if (_parameters.vtol_type == vtol_type::TAILSITTER) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we handle all of these adjustments right after the orb_copy? Then the actual controller code can be generic.
@dagar Successfully tested in SITL for standard and tiltrotor, tailsitter works in manual but still got to find a bug in mission. Once we get the desired behavior we should discuss some specifics we might want to solve cleaner. |
9afef2a
to
d011aa7
Compare
@dagar This now contains changes required to use the duorotor tailsitter in stabilized mode (including transitions and fw flight). |
@@ -574,6 +602,10 @@ void FixedwingAttitudeControl::run() | |||
perf_count(_nonfinite_input_perf); | |||
} | |||
|
|||
if (_vehicle_status.in_transition_mode || !_vehicle_status.is_rotary_wing) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagar This is kind of a gain scheduling. In transition and fw mode the fw controller gains get scaled down as if the vehicle was flying at max airspeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be tailsitter only though right? I think we should get all the vtol (and tailsitter) special cases centralized in a function outside of the main loop. Then a single check for tailsitter that corrects everything (attitude, control mode, airspeed).
_att_sp.timestamp = hrt_absolute_time(); | ||
|
||
/* reset velocity limit */ | ||
_vel_max_xy = _params.vel_max_xy; | ||
} | ||
|
||
/* reset setpoints and integrators VTOL in FW mode */ | ||
if (_vehicle_status.is_vtol && !_vehicle_status.is_rotary_wing) { | ||
if (_vehicle_status.is_vtol && (!_vehicle_status.is_rotary_wing || _vehicle_status.in_transition_mode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagar This was required to reset the yaw_sp after a transition, otherwise the vehicle would mostly do a 180 in yaw.
Need to be done properly, other vtol types need the controller to run during transition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay, let's get it back in.
vehicle_control_mode_poll(); | ||
vehicle_manual_poll(); | ||
vehicle_status_poll(); | ||
vehicle_land_detected_poll(); | ||
|
||
// set initial maximum body rate setpoints | ||
_roll_ctrl.set_max_rate(_parameters.acro_max_x_rate_rad); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing set_max_rate() update code below doesn't handle this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagar Nope, it does not. The problem is that for VTOL the condition
_vcontrol_mode.flag_control_attitude_enabled != _flag_control_attitude_enabled_last
does not hold because since the mc attitude controller is in charge _vcontrol_mode.flag_control_attitude_enabled
is false in the beginning.
So you either have to switch to fw mode first of you have to change a parameter.
Without this change all of the max rates of the rate controller were set to zero, so it essentially did nothing.
d011aa7
to
7cc679a
Compare
Take a look at the MC offboard attitude control CI failure? |
dab01c1
to
375954b
Compare
Good to see that you are pushing towards separated XYZ thrust setpoints. I am sure that will make the transition phase easier to handle. For quadplane, it may simplify things like X thrust aid to fight headwind during hover, or Z thrust aid to prevent falling after wing stall.
|
375954b
to
cc9d3bf
Compare
@jlecoeur Good to see you also participating in this!
Yes, I totally agree. This is still on my TODO list for this PR.
I think it should. So what if we want to support reverse thrust as well? In that case throttle would need to cover negative ranges as well, right? I'm also thinking about vehicles with variable pitch props.
The reason why it was done like this was because it was the easiest solution at that time I guess.
For the tailsitter, why do you think they control the same sets of actuators? In that case the multirotor rate controller controls motors and the fw rate controller controls elevons. |
|
Should we implement a I was putting off the actuator control changes for now as that will have ramifications for the mixers (depending on how we do it). |
tailsitters Signed-off-by: Roman <bapstroman@gmail.com>
- TODO: we should define a frame, e.g. NED. Signed-off-by: Roman <bapstroman@gmail.com>
… frame Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
…tter - enable yaw control via mc roll actuator to coordinate turns in fw mode Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
Signed-off-by: Roman <bapstroman@gmail.com>
- this means hover and transition modes for vtol Signed-off-by: Roman <bapstroman@gmail.com>
- we cannot have position control running during transitions because it's not aware of the forward flight capabilities. Therefore, tell the controller to just control altitude. Signed-off-by: Roman <bapstroman@gmail.com>
…ules for vtol Signed-off-by: Roman <bapstroman@gmail.com>
- thrust_z should be negative for positive throttle Signed-off-by: Roman <bapstroman@gmail.com>
f63069d
to
0b29136
Compare
@RomanBapst I rebased on master and fixed a few minor issues. The remaining SITL test failures are real. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the minor comments.
@dagar I guess that the next logical step relative to 3D thrust will be to pass the 3 thrust components through actuator_controls and let the mixer allocate it to lifting/pushing actuators?
float32 thrust # Thrust in Newton the power system should generate | ||
float32 thrust_x # Throttle command in body x direction [-1,1] | ||
float32 thrust_y # Throttle command in body y direction [-1,1] | ||
float32 thrust_z # Throttle command in body z direction [-1,1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding ", thrust_z is negative for upwards thrust."
# TOPICS vehicle_rates_setpoint mc_virtual_rates_setpoint fw_virtual_rates_setpoint | ||
float32 thrust_x # Throttle command in body x direction [-1,1] | ||
float32 thrust_y # Throttle command in body y direction [-1,1] | ||
float32 thrust_z # Throttle command in body z direction [-1,1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as in vehicle_attitude_setpoint
@@ -749,7 +749,7 @@ MulticopterPositionControl::task_main() | |||
matrix::Quatf q_sp = matrix::Eulerf(_att_sp.roll_body, _att_sp.pitch_body, _att_sp.yaw_body); | |||
q_sp.copyTo(_att_sp.q_d); | |||
_att_sp.q_d_valid = true; | |||
_att_sp.thrust = 0.0f; | |||
_att_sp.thrust_z = 0.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment: should we ensure that thrust components X and Y are equal to 0 in MC (and that components Y and Z are null in FW)?
// MC
_att_sp.thrust_x = 0.0f;
_att_sp.thrust_y = 0.0f;
_att_sp.thrust_z = value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlecoeur good point! Will do.
@RomanBapst do you have an example failure log review (possible stability regression mentioned on the dev call)? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing as stale. |
In current VTOL during transitions the VTOL "attitude controller" determines the attitude setpoint and both full FW & MC attitude controllers run respecting that setpoint. There are various issues with this especially for tailsitters (#9189).
In this PR only the rate controllers are allowed to run simultaneously. During transition that means the MC attitude controller is running, but the FW attitude controller is now in a state where it's only running the rate controller and respecting published rate setpoints (coming from the MC controller).
@RomanBapst I believe this was working with VTOL standard, but the rebase was nasty so proceed like it's completely untested.