VTOL Takeoff: Use VehicleCommand specified heading for VTOL transition (#24040)

* Use VehicleCommand heading for VTOL transition

* options for param2 of vehicle_cmd_nav_vtol_takeoff
This commit is contained in:
Jacopo Panerati
2025-11-25 03:46:48 -05:00
committed by GitHub
parent a6d9e114be
commit 6901bc6a01
4 changed files with 16 additions and 3 deletions
+4
View File
@@ -652,6 +652,10 @@ void Navigator::run()
_vtol_takeoff.setTransitionAltitudeAbsolute(cmd.param7);
if (std::fabs(cmd.param2 - 3.0f) < FLT_EPSILON) { // Specified transition direction
_vtol_takeoff.setTransitionDirection(cmd.param4);
}
// after the transition the vehicle will establish on a loiter at this position
_vtol_takeoff.setLoiterLocation(matrix::Vector2d(cmd.param5, cmd.param6));
+9 -2
View File
@@ -71,8 +71,15 @@ VtolTakeoff::on_active()
position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();
_mission_item.nav_cmd = NAV_CMD_WAYPOINT;
_mission_item.yaw = wrap_pi(get_bearing_to_next_waypoint(_mission_item.lat,
_mission_item.lon, _loiter_location(0), _loiter_location(1)));
if (!PX4_ISFINITE(_transition_direction_deg)) {
_mission_item.yaw = wrap_pi(get_bearing_to_next_waypoint(_navigator->get_home_position()->lat,
_navigator->get_home_position()->lon, _loiter_location(0), _loiter_location(1)));
} else {
_mission_item.yaw = wrap_pi(math::radians(_transition_direction_deg));
}
_mission_item.force_heading = true;
mission_item_to_position_setpoint(_mission_item, &pos_sp_triplet->current);
pos_sp_triplet->current.cruising_speed = -1.f;
+2
View File
@@ -55,6 +55,7 @@ public:
void on_active() override;
void setTransitionAltitudeAbsolute(const float alt_amsl) {_transition_alt_amsl = alt_amsl; }
void setTransitionDirection(const float tran_bear) {_transition_direction_deg = tran_bear; }
void setLoiterLocation(matrix::Vector2d loiter_location) { _loiter_location = loiter_location; }
void setLoiterHeight(const float height_m) { _loiter_height = height_m; }
@@ -73,6 +74,7 @@ private:
float _takeoff_alt_msl{0.f};
matrix::Vector2d _loiter_location;
float _loiter_height{0};
float _transition_direction_deg{NAN};
DEFINE_PARAMETERS(
(ParamFloat<px4::params::VTO_LOITER_ALT>) _param_loiter_alt