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 #10805

Signed-off-by: Roman <bapstroman@gmail.com>
  • Loading branch information
RomanBapst committed Dec 8, 2018
1 parent 21bcc0d commit d9cc4df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/modules/mc_att_control/mc_att_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ class MulticopterAttitudeControl : public ModuleBase<MulticopterAttitudeControl>
(ParamFloat<px4::params::MPC_MANTHR_MIN>) _man_throttle_min, /**< minimum throttle for stabilized */
(ParamFloat<px4::params::MPC_THR_MAX>) _throttle_max, /**< maximum throttle for stabilized */
(ParamFloat<px4::params::MPC_THR_HOVER>) _throttle_hover, /**< throttle at which vehicle is at hover equilibrium */
(ParamInt<px4::params::MPC_THR_CURVE>) _throttle_curve /**< throttle curve behavior */
(ParamInt<px4::params::MPC_THR_CURVE>) _throttle_curve, /**< throttle curve behavior */

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

matrix::Vector3f _attitude_p; /**< P gain for attitude control */
Expand Down
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 @@ -891,10 +892,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 d9cc4df

Please sign in to comment.