-
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
Fix differential thrust for Tailsitter in FW mode #16537
Conversation
Signed-off-by: Ricardo Marques <marques.ricardo17@gmail.com>
I have some concerns. The pr has only been tested on a four-motor taisitter, whether this modification works on a two-motor tailsitter. |
@@ -293,6 +288,11 @@ void Tailsitter::fill_actuator_outputs() | |||
if (_vtol_schedule.flight_mode == vtol_mode::FW_MODE) { | |||
mc_out[actuator_controls_s::INDEX_THROTTLE] = fw_in[actuator_controls_s::INDEX_THROTTLE]; | |||
|
|||
/* allow differential thrust if enabled */ | |||
if (_params->diff_thrust == 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.
I suggest moving this change to the top to keep it clean (only responsible for determining the throttle)
if (_vtol_schedule.flight_mode == vtol_mode::FW_MODE && _params->diff_thrust == 1)) {
mc_out[actuator_controls_s::INDEX_ROLL] = fw_in[actuator_controls_s::INDEX_YAW] * _params->diff_thrust_scale;
} else {
mc_out[actuator_controls_s::INDEX_ROLL] = mc_in[actuator_controls_s::INDEX_ROLL] * _mc_roll_weight;
}
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.
For tailsitter users, when should I enable this parameter and when should I disable it?
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.
I don't have a strong opinion for one or the other way, both work.
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.
For tailsitter users, when should I enable this parameter and when should I disable it?
You should enable it when your vehicle has bad passive yaw stability or you want to fly aggressive maneuvers.
It shouldn't matter if dual or quad tailsitter. Both benefit form having yaw control in FW, and the correct allocation is then done in the corresponding mixer.
Yes you can have directional control of a fixed-wing aircraft without controlling the yaw axis actively on most frames, but for a nicely coordinated turns or aggressive manual maneuvers yaw control is still beneficial. |
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.
Looks good to me, also tested it quickly in SITL.
@@ -293,6 +288,11 @@ void Tailsitter::fill_actuator_outputs() | |||
if (_vtol_schedule.flight_mode == vtol_mode::FW_MODE) { | |||
mc_out[actuator_controls_s::INDEX_THROTTLE] = fw_in[actuator_controls_s::INDEX_THROTTLE]; | |||
|
|||
/* allow differential thrust if enabled */ | |||
if (_params->diff_thrust == 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.
I don't have a strong opinion for one or the other way, both work.
@@ -293,6 +288,11 @@ void Tailsitter::fill_actuator_outputs() | |||
if (_vtol_schedule.flight_mode == vtol_mode::FW_MODE) { | |||
mc_out[actuator_controls_s::INDEX_THROTTLE] = fw_in[actuator_controls_s::INDEX_THROTTLE]; | |||
|
|||
/* allow differential thrust if enabled */ | |||
if (_params->diff_thrust == 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.
For tailsitter users, when should I enable this parameter and when should I disable it?
You should enable it when your vehicle has bad passive yaw stability or you want to fly aggressive maneuvers.
Does this allow for controlling a quadrotor tailsitter that does not have elevons like the Swan K1? I heard that PX4 doesn't currently have differential thrust for pitch and roll in cruise. |
No that is not supported out of the box yet, but would be fairly straight forward to enable with some code changes if you want to play with it. We played around with it recently: https://github.com/PX4/PX4-Autopilot/commits/quad-tailsitter-no-surfaces-testing |
@aoberai @sfuhrer note in this branch there was a hacked in change of mixer that doesn't play well with the SITL airframe. You would need to revert the last commit there and it should actually transition in SITL. -- next step on that PR would be to implement a scaler for the roll and pitch differential thrust setting, as at the moment it is probably way too aggressive with full authority. |
Replaces #12518
Closes #12302
Followed the same logic and just updated the PR with a quick test in SITL.
Log: https://logs.px4.io/plot_app?log=fb7ebb3e-53ac-4c8a-baa7-548dc4a8ede0
@sfuhrer If you could have a look, and perhaps @xdwgood can you test this in a tailsitter as well?
@dagar FYI