mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 01:53:33 +08:00
navigator: refactor naming of break instead of brake functions
This commit is contained in:
committed by
Silvan Fuhrer
parent
b8a602414d
commit
37190d4928
@@ -60,7 +60,7 @@ Land::on_activation()
|
|||||||
|
|
||||||
if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
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->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);
|
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();
|
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
|
// 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();
|
_navigator->set_position_setpoint_triplet_updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ Loiter::set_loiter_position()
|
|||||||
setLoiterItemFromCurrentPositionSetpoint(&_mission_item);
|
setLoiterItemFromCurrentPositionSetpoint(&_mission_item);
|
||||||
|
|
||||||
} else if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
} else if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
||||||
setLoiterItemFromCurrentPositionWithBreaking(&_mission_item);
|
setLoiterItemFromCurrentPositionWithBraking(&_mission_item);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setLoiterItemFromCurrentPosition(&_mission_item);
|
setLoiterItemFromCurrentPosition(&_mission_item);
|
||||||
|
|||||||
@@ -772,11 +772,11 @@ MissionBlock::setLoiterItemFromCurrentPosition(struct mission_item_s *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MissionBlock::setLoiterItemFromCurrentPositionWithBreaking(struct mission_item_s *item)
|
MissionBlock::setLoiterItemFromCurrentPositionWithBraking(struct mission_item_s *item)
|
||||||
{
|
{
|
||||||
setLoiterItemCommonFields(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->altitude = _navigator->get_global_position()->alt;
|
||||||
item->loiter_radius = _navigator->get_loiter_radius();
|
item->loiter_radius = _navigator->get_loiter_radius();
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ protected:
|
|||||||
void setLoiterItemFromCurrentPositionSetpoint(struct mission_item_s *item);
|
void setLoiterItemFromCurrentPositionSetpoint(struct mission_item_s *item);
|
||||||
|
|
||||||
void setLoiterItemFromCurrentPosition(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);
|
void setLoiterItemCommonFields(struct mission_item_s *item);
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public:
|
|||||||
void release_gimbal_control();
|
void release_gimbal_control();
|
||||||
void set_gimbal_neutral();
|
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 stop_capturing_images();
|
||||||
void disable_camera_trigger();
|
void disable_camera_trigger();
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ void Navigator::run()
|
|||||||
if (_vstatus.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
if (_vstatus.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
||||||
&& (get_position_setpoint_triplet()->current.type != position_setpoint_s::SETPOINT_TYPE_TAKEOFF)) {
|
&& (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 {
|
} else {
|
||||||
// For fixedwings we can use the current vehicle's position to define the loiter point
|
// 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
|
if (_vstatus.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
||||||
&& (get_position_setpoint_triplet()->current.type != position_setpoint_s::SETPOINT_TYPE_TAKEOFF)) {
|
&& (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) {
|
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;
|
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
|
// 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);
|
const float course_over_ground = atan2f(_local_pos.vy, _local_pos.vx);
|
||||||
|
|||||||
Reference in New Issue
Block a user