Skip to content

Commit

Permalink
vtol_takeoff: store altitude on takeoff and don't use home position a…
Browse files Browse the repository at this point in the history
…ltitude

as vehicle does not need to be close to home position

Signed-off-by: RomanBapst <[email protected]>
  • Loading branch information
RomanBapst committed Jan 22, 2025
1 parent ee150a1 commit 57fdda5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/navigator/vtol_takeoff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/modules/navigator/vtol_takeoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class VtolTakeoff : public MissionBlock, public ModuleParams
} _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};

Expand Down

0 comments on commit 57fdda5

Please sign in to comment.