vtol_takeoff: store altitude on takeoff and don't use home position altitude

as vehicle does not need to be close to home position

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2025-01-21 16:52:25 +03:00
committed by Roman Bapst
parent ee150a15b4
commit 57fdda597b
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -118,7 +118,7 @@ VtolTakeoff::on_active()
_mission_item.time_inside = 1.f;
_mission_item.loiter_radius = _navigator->get_loiter_radius();
_mission_item.acceptance_radius = _navigator->get_acceptance_radius();
_mission_item.altitude = _navigator->get_home_position()->alt + _param_loiter_alt.get();
_mission_item.altitude = _takeoff_alt_msl + _param_loiter_alt.get();
mission_item_to_position_setpoint(_mission_item, &pos_sp_triplet->current);
pos_sp_triplet->current.lat = _loiter_location(0);
@@ -170,6 +170,8 @@ VtolTakeoff::set_takeoff_position()
// set current mission item to takeoff
set_takeoff_item(&_mission_item, _transition_alt_amsl);
_takeoff_alt_msl = _navigator->get_global_position()->alt;
_mission_item.lat = _navigator->get_global_position()->lat;
_mission_item.lon = _navigator->get_global_position()->lon;
+1
View File
@@ -70,6 +70,7 @@ private:
} _takeoff_state;
float _transition_alt_amsl{0.f}; // absolute altitude at which vehicle will transition to forward flight
float _takeoff_alt_msl{0.f};
matrix::Vector2d _loiter_location;
float _loiter_height{0};