diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index c6f03ea7b502..635e01d495f3 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -247,13 +247,6 @@ void MulticopterAttitudeControl::control_attitude() { _v_att_sp_sub.update(&_v_att_sp); - - // reinitialize the setpoint while not armed to make sure no value from the last mode or flight is still kept - if (!_v_control_mode.flag_armed) { - Quatf().copyTo(_v_att_sp.q_d); - Vector3f().copyTo(_v_att_sp.thrust_body); - } - _rates_sp = _attitude_control.update(Quatf(_v_att.q), Quatf(_v_att_sp.q_d), _v_att_sp.yaw_sp_move_rate); } diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index f8b23c8d821f..bdeb594612ff 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -568,15 +568,8 @@ MulticopterPositionControl::Run() _takeoff.updateTakeoffState(_control_mode.flag_armed, _vehicle_land_detected.landed, false, 10.f, !_control_mode.flag_control_climb_rate_enabled, time_stamp_now); - // takeoff delay for motors to reach idle speed - if (_takeoff.getTakeoffState() >= TakeoffState::ready_for_takeoff) { - // when vehicle is ready switch to the required flighttask - start_flight_task(); - - } else { - // stop flighttask while disarmed - _flight_tasks.switchTask(FlightTaskIndex::None); - } + // switch to the required flighttask + start_flight_task(); // check if any task is active if (_flight_tasks.isAnyTaskActive()) { @@ -705,10 +698,10 @@ MulticopterPositionControl::Run() } // publish attitude setpoint - // Note: this requires review. The reason for not sending - // an attitude setpoint is because for non-flighttask modes - // the attitude septoint should come from another source, otherwise - // they might conflict with each other such as in offboard attitude control. + // It's important to publish also when disarmed otheriwse the attitude setpoint stays uninitialized. + // Not publishing when not running a flight task + // in stabilized mode attitude setpoints get ignored + // in offboard with attitude setpoints they come from MAVLink directly if (_attitude_setpoint_id != nullptr) { orb_publish_auto(_attitude_setpoint_id, &_vehicle_attitude_setpoint_pub, &attitude_setpoint, nullptr, ORB_PRIO_DEFAULT); } diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 946e1e6159b4..45ac57fcc81f 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -389,13 +389,6 @@ VtolAttitudeControl::Run() _fw_virtual_att_sp_sub.update(&_fw_virtual_att_sp); if (mc_att_sp_updated || fw_att_sp_updated) { - - // reinitialize the setpoint while not armed to make sure no value from the last mode or flight is still kept - if (!_v_control_mode.flag_armed) { - Vector3f().copyTo(_mc_virtual_att_sp.thrust_body); - Vector3f().copyTo(_v_att_sp.thrust_body); - } - _vtol_type->update_transition_state(); _v_att_sp_pub.publish(_v_att_sp); } @@ -408,14 +401,6 @@ VtolAttitudeControl::Run() _vtol_vehicle_status.vtol_in_trans_mode = false; _vtol_vehicle_status.in_transition_to_fw = false; - if (mc_att_sp_updated) { - // reinitialize the setpoint while not armed to make sure no value from the last mode or flight is still kept - if (!_v_control_mode.flag_armed) { - Vector3f().copyTo(_mc_virtual_att_sp.thrust_body); - Vector3f().copyTo(_v_att_sp.thrust_body); - } - } - _vtol_type->update_mc_state(); _v_att_sp_pub.publish(_v_att_sp);