Skip to content

Commit

Permalink
mc_att_control: don't generate attitude setpoint for tailsitters
Browse files Browse the repository at this point in the history
during a transition

- this regression most likely comes from PR PX4#10805

Signed-off-by: Roman <[email protected]>
  • Loading branch information
RomanBapst authored and sfuhrer committed Mar 18, 2019
1 parent 91083ea commit 96fc01b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/modules/mc_att_control/mc_att_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ class MulticopterAttitudeControl : public ModuleBase<MulticopterAttitudeControl>
(ParamInt<px4::params::MPC_THR_CURVE>) _throttle_curve, /**< throttle curve behavior */

(ParamInt<px4::params::MC_AIRMODE>) _airmode
(ParamInt<px4::params::VT_TYPE>) _vtol_type

)

matrix::Vector3f _attitude_p; /**< P gain for attitude control */
Expand All @@ -287,4 +289,3 @@ class MulticopterAttitudeControl : public ModuleBase<MulticopterAttitudeControl>
float _man_tilt_max; /**< maximum tilt allowed for manual flight [rad] */

};

5 changes: 4 additions & 1 deletion src/modules/mc_att_control/mc_att_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <circuit_breaker/circuit_breaker.h>
#include <mathlib/math/Limits.hpp>
#include <mathlib/math/Functions.hpp>
#include <vtol_att_control/vtol_type.h>

#define TPA_RATE_LOWER_LIMIT 0.05f

Expand Down Expand Up @@ -900,10 +901,12 @@ MulticopterAttitudeControl::run()
if (_v_control_mode.flag_control_attitude_enabled && _vehicle_status.is_rotary_wing) {
if (attitude_updated) {
// Generate the attitude setpoint from stick inputs if we are in Manual/Stabilized mode
// For Tailsitters doing transitions the attitude setpoint is generated in tailsitter.cpp
if (_v_control_mode.flag_control_manual_enabled &&
!_v_control_mode.flag_control_altitude_enabled &&
!_v_control_mode.flag_control_velocity_enabled &&
!_v_control_mode.flag_control_position_enabled) {
!_v_control_mode.flag_control_position_enabled &&
!(_vtol_type.get() == vtol_type::TAILSITTER && _vehicle_status.in_transition_mode)) {
generate_attitude_setpoint(attitude_dt, reset_yaw_sp);
attitude_setpoint_generated = true;
}
Expand Down

0 comments on commit 96fc01b

Please sign in to comment.