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

Differential thrust for tailsitter #12518

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/modules/vtol_att_control/tailsitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@ void Tailsitter::waiting_on_tecs()
void Tailsitter::update_fw_state()
{
VtolType::update_fw_state();

// allow fw yawrate control via multirotor roll actuation. this is useful for vehicles
// which don't have a rudder to coordinate turns
if (_params->diff_thrust == 1) {
_mc_roll_weight = 1.0f;
}
}

/**
Expand All @@ -291,9 +285,18 @@ void Tailsitter::fill_actuator_outputs()
_actuators_out_0->control[actuator_controls_s::INDEX_THROTTLE] =
_actuators_fw_in->control[actuator_controls_s::INDEX_THROTTLE];

/* allow differential thrust if enabled */
if (_params->diff_thrust == 1) {
_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] =
_actuators_fw_in->control[actuator_controls_s::INDEX_YAW] * _params->diff_thrust_scale;
}

} else {
_actuators_out_0->control[actuator_controls_s::INDEX_THROTTLE] =
_actuators_mc_in->control[actuator_controls_s::INDEX_THROTTLE];

_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] =
_actuators_mc_in->control[actuator_controls_s::INDEX_ROLL] * _mc_roll_weight;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this duplicating what's already done on line 277?

Copy link
Author

Choose a reason for hiding this comment

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

it just to redefine the relations between actuators_out and actuators_in for roll axis in mc mode to avoid my code on line 290 for fw mode make roll control in mc control unpredictable. I don't know if it is necessary, so I insert this code. If you think it isn't necessary here we can delete it but need to do fly test.

Copy link
Member

@dagar dagar Oct 15, 2019

Choose a reason for hiding this comment

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

It looks like you're repeating work already done on line 277 (_actuators_out_0->control[actuator_controls_s::INDEX_ROLL] ). Please verify and delete if that's the case.

}

if (_params->elevons_mc_lock && _vtol_schedule.flight_mode == vtol_mode::MC_MODE) {
Expand All @@ -307,3 +310,4 @@ void Tailsitter::fill_actuator_outputs()
_actuators_fw_in->control[actuator_controls_s::INDEX_PITCH];
}
}