Browse Source

Mission: handle Loiter direction

loiter-unlimited, loiter-turns and loiter-time cms specify the turn
direction in Param3.  This is stored in the location's loiter_ccw flag.
Previously supported only in Plane, moving here allows us to share more
code with Plane, Copter, Rover.
master
Randy Mackay 11 years ago
parent
commit
37cff752c8
  1. 15
      libraries/AP_Mission/AP_Mission.cpp

15
libraries/AP_Mission/AP_Mission.cpp

@ -642,16 +642,31 @@ bool AP_Mission::mission_cmd_to_mavlink(const AP_Mission::Mission_Command& cmd, @@ -642,16 +642,31 @@ bool AP_Mission::mission_cmd_to_mavlink(const AP_Mission::Mission_Command& cmd,
case MAV_CMD_NAV_LOITER_UNLIM: // MAV ID: 17
copy_location = true;
if (cmd.content.location.flags.loiter_ccw) {
packet.param3 = -1;
}else{
packet.param3 = 1;
}
break;
case MAV_CMD_NAV_LOITER_TURNS: // MAV ID: 18
copy_location = true;
packet.param1 = cmd.p1; // number of times to circle is held in location.p1
if (cmd.content.location.flags.loiter_ccw) {
packet.param3 = -1;
}else{
packet.param3 = 1;
}
break;
case MAV_CMD_NAV_LOITER_TIME: // MAV ID: 19
copy_location = true;
packet.param1 = cmd.p1; // loiter time in seconds
if (cmd.content.location.flags.loiter_ccw) {
packet.param3 = -1;
}else{
packet.param3 = 1;
}
break;
case MAV_CMD_NAV_RETURN_TO_LAUNCH: // MAV ID: 20

Loading…
Cancel
Save