mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 17:33:35 +08:00
Set virtual waypoint for VTOL_TAKEOFF item
This commit is contained in:
@@ -486,7 +486,7 @@ Mission::set_mission_items()
|
|||||||
|
|
||||||
_mission_item.nav_cmd = NAV_CMD_DO_VTOL_TRANSITION;
|
_mission_item.nav_cmd = NAV_CMD_DO_VTOL_TRANSITION;
|
||||||
_mission_item.params[0] = vehicle_status_s::VEHICLE_VTOL_STATE_FW;
|
_mission_item.params[0] = vehicle_status_s::VEHICLE_VTOL_STATE_FW;
|
||||||
_mission_item.yaw = NAN;
|
_mission_item.yaw = _navigator->get_global_position()->yaw;
|
||||||
} else {
|
} else {
|
||||||
new_work_item_type = WORK_ITEM_TYPE_DEFAULT;
|
new_work_item_type = WORK_ITEM_TYPE_DEFAULT;
|
||||||
_mission_item.nav_cmd = NAV_CMD_WAYPOINT;
|
_mission_item.nav_cmd = NAV_CMD_WAYPOINT;
|
||||||
@@ -1159,7 +1159,7 @@ Mission::reset_offboard_mission(struct mission_s &mission)
|
|||||||
item.do_jump_current_count = 0;
|
item.do_jump_current_count = 0;
|
||||||
|
|
||||||
if (dm_write(dm_current, index, DM_PERSIST_POWER_ON_RESET,
|
if (dm_write(dm_current, index, DM_PERSIST_POWER_ON_RESET,
|
||||||
&item, len) != len) {
|
&item, len) != len) {
|
||||||
PX4_WARN("could not save mission item during reset");
|
PX4_WARN("could not save mission item during reset");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,10 +335,19 @@ void
|
|||||||
MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *item, struct position_setpoint_s *sp)
|
MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *item, struct position_setpoint_s *sp)
|
||||||
{
|
{
|
||||||
/* set the correct setpoint for vtol transition */
|
/* set the correct setpoint for vtol transition */
|
||||||
if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION) {
|
|
||||||
|
if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION && PX4_ISFINITE(item->yaw)) {
|
||||||
sp->type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
sp->type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
||||||
|
waypoint_from_heading_and_distance(_navigator->get_global_position()->lat,
|
||||||
|
_navigator->get_global_position()->lon,
|
||||||
|
item->yaw,
|
||||||
|
1000000.0f,
|
||||||
|
&sp->lat,
|
||||||
|
&sp->lon);
|
||||||
|
sp->alt = _navigator->get_global_position()->alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* don't change the setpoint for non-position items */
|
/* don't change the setpoint for non-position items */
|
||||||
if (!item_contains_position(item)) {
|
if (!item_contains_position(item)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user