diff --git a/src/modules/navigator/land.cpp b/src/modules/navigator/land.cpp index 67291b405edf..2c351ffa6e9f 100644 --- a/src/modules/navigator/land.cpp +++ b/src/modules/navigator/land.cpp @@ -60,7 +60,7 @@ Land::on_activation() if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING && _navigator->get_local_position()->xy_global) { // only execute if global position is valid - _navigator->calculate_breaking_stop(_mission_item.lat, _mission_item.lon); + _navigator->preproject_stop_point(_mission_item.lat, _mission_item.lon); } mission_item_to_position_setpoint(_mission_item, &pos_sp_triplet->current); @@ -89,8 +89,7 @@ Land::on_active() struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet(); // create a wp in front of the VTOL while in back-transition, based on MPC settings that will apply in MC phase afterwards - _navigator->calculate_breaking_stop(pos_sp_triplet->current.lat, pos_sp_triplet->current.lon); - + _navigator->preproject_stop_point(pos_sp_triplet->current.lat, pos_sp_triplet->current.lon); _navigator->set_position_setpoint_triplet_updated(); } diff --git a/src/modules/navigator/loiter.cpp b/src/modules/navigator/loiter.cpp index db61030528c1..86efa42ee9de 100644 --- a/src/modules/navigator/loiter.cpp +++ b/src/modules/navigator/loiter.cpp @@ -109,7 +109,7 @@ Loiter::set_loiter_position() setLoiterItemFromCurrentPositionSetpoint(&_mission_item); } else if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) { - setLoiterItemFromCurrentPositionWithBreaking(&_mission_item); + setLoiterItemFromCurrentPositionWithBraking(&_mission_item); } else { setLoiterItemFromCurrentPosition(&_mission_item); diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index 091597a48891..02e7352be2bf 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -772,11 +772,11 @@ MissionBlock::setLoiterItemFromCurrentPosition(struct mission_item_s *item) } void -MissionBlock::setLoiterItemFromCurrentPositionWithBreaking(struct mission_item_s *item) +MissionBlock::setLoiterItemFromCurrentPositionWithBraking(struct mission_item_s *item) { setLoiterItemCommonFields(item); - _navigator->calculate_breaking_stop(item->lat, item->lon); + _navigator->preproject_stop_point(item->lat, item->lon); item->altitude = _navigator->get_global_position()->alt; item->loiter_radius = _navigator->get_loiter_radius(); diff --git a/src/modules/navigator/mission_block.h b/src/modules/navigator/mission_block.h index c19fcfe11877..241acdca4fd0 100644 --- a/src/modules/navigator/mission_block.h +++ b/src/modules/navigator/mission_block.h @@ -183,7 +183,7 @@ class MissionBlock : public NavigatorMode void setLoiterItemFromCurrentPositionSetpoint(struct mission_item_s *item); void setLoiterItemFromCurrentPosition(struct mission_item_s *item); - void setLoiterItemFromCurrentPositionWithBreaking(struct mission_item_s *item); + void setLoiterItemFromCurrentPositionWithBraking(struct mission_item_s *item); void setLoiterItemCommonFields(struct mission_item_s *item); diff --git a/src/modules/navigator/navigator.h b/src/modules/navigator/navigator.h index 7fece40a4ecc..0da0c72e9f48 100644 --- a/src/modules/navigator/navigator.h +++ b/src/modules/navigator/navigator.h @@ -278,7 +278,7 @@ class Navigator : public ModuleBase, public ModuleParams void release_gimbal_control(); void set_gimbal_neutral(); - void calculate_breaking_stop(double &lat, double &lon); + void preproject_stop_point(double &lat, double &lon); void stop_capturing_images(); void disable_camera_trigger(); diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 807ff1284df2..b1a920a46769 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -356,7 +356,7 @@ void Navigator::run() if (_vstatus.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING && (get_position_setpoint_triplet()->current.type != position_setpoint_s::SETPOINT_TYPE_TAKEOFF)) { - calculate_breaking_stop(rep->current.lat, rep->current.lon); + preproject_stop_point(rep->current.lat, rep->current.lon); } else { // For fixedwings we can use the current vehicle's position to define the loiter point @@ -467,7 +467,7 @@ void Navigator::run() if (_vstatus.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING && (get_position_setpoint_triplet()->current.type != position_setpoint_s::SETPOINT_TYPE_TAKEOFF)) { - calculate_breaking_stop(rep->current.lat, rep->current.lon); + preproject_stop_point(rep->current.lat, rep->current.lon); } if (PX4_ISFINITE(curr->current.loiter_radius) && curr->current.loiter_radius > FLT_EPSILON) { @@ -1588,7 +1588,7 @@ bool Navigator::geofence_allows_position(const vehicle_global_position_s &pos) return true; } -void Navigator::calculate_breaking_stop(double &lat, double &lon) +void Navigator::preproject_stop_point(double &lat, double &lon) { // For multirotors we need to account for the braking distance, otherwise the vehicle will overshoot and go back const float course_over_ground = atan2f(_local_pos.vy, _local_pos.vx);