diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 117401a3d1..783576bacb 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -770,8 +770,7 @@ bool set_nav_state(struct vehicle_status_s *status, const bool data_link_loss_en if (status->engine_failure) { status->nav_state = vehicle_status_s::NAVIGATION_STATE_AUTO_LANDENGFAIL; - } else if ((!status->condition_global_position_valid || - !status->condition_home_position_valid)) { + } else if (!status->condition_global_position_valid) { status->failsafe = true; if (status->condition_local_position_valid) { 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 e3eba9c45e..b4ed4103d3 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -720,7 +720,6 @@ MulticopterPositionControl::reset_pos_sp() // we have logic in the main function which chooses the velocity setpoint such that the attitude setpoint is // continuous when switching into velocity controlled mode, therefore, we don't need to bother about resetting // position in a special way. In position control mode the position will be reset anyway until the vehicle has reduced speed. - _pos_sp(0) = _pos(0); _pos_sp(1) = _pos(1); } @@ -1387,7 +1386,8 @@ MulticopterPositionControl::task_main() /* make sure velocity setpoint is saturated in xy*/ float vel_norm_xy = sqrtf(_vel_sp(0) * _vel_sp(0) + _vel_sp(1) * _vel_sp(1)); - if (_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_FOLLOW_TARGET) { + if (_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_FOLLOW_TARGET && + _pos_sp_triplet.current.velocity_valid) { _vel_sp(0) = _pos_sp_triplet.current.vx; _vel_sp(1) = _pos_sp_triplet.current.vy; } else if (vel_norm_xy > _params.vel_max(0)) { diff --git a/src/modules/navigator/follow_target.cpp b/src/modules/navigator/follow_target.cpp index 98be7bd89e..b67836265a 100644 --- a/src/modules/navigator/follow_target.cpp +++ b/src/modules/navigator/follow_target.cpp @@ -60,7 +60,7 @@ FollowTarget::FollowTarget(Navigator *navigator, const char *name) : MissionBlock(navigator, name), _navigator(navigator), _param_min_alt(this, "MIS_TAKEOFF_ALT", false), - _follow_target_state(ACSEND), + _follow_target_state(ASCEND), _follow_target_sub(-1), _step_time_in_ms(0.0f), _previous_target_gps_pos_valid(false), @@ -85,7 +85,7 @@ void FollowTarget::on_inactive() { _previous_target_gps_pos_valid = false; - _follow_target_state = ACSEND; + _follow_target_state = ASCEND; } void @@ -151,7 +151,7 @@ FollowTarget::on_active() { } break; } - case ACSEND: + case ASCEND: { // ascend to the minimum altitude diff --git a/src/modules/navigator/follow_target.h b/src/modules/navigator/follow_target.h index 0a16b4d966..4dd71fddd9 100644 --- a/src/modules/navigator/follow_target.h +++ b/src/modules/navigator/follow_target.h @@ -66,7 +66,7 @@ private: static constexpr float FF_K = .15f; enum FollowTargetState { - ACSEND, + ASCEND, TRACK_POSITION, TRACK_VELOCITY, TARGET_TIMEOUT diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index aac9439563..d0d307e21b 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -228,7 +228,6 @@ MissionBlock::is_mission_item_reached() /* Once the waypoint and yaw setpoint have been reached we can start the loiter time countdown */ if (_waypoint_position_reached && _waypoint_yaw_reached) { - return true; if (_time_first_inside_orbit == 0) { _time_first_inside_orbit = now; @@ -239,7 +238,7 @@ MissionBlock::is_mission_item_reached() } /* check if the MAV was long enough inside the waypoint orbit */ - if ((now - _time_first_inside_orbit >= (hrt_abstime)_mission_item.time_inside * 1e6f)) { + if (now - _time_first_inside_orbit >= (hrt_abstime)_mission_item.time_inside * 1e6f) { return true; } }