mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
Rover: Make guided operate the same way as Plane/Copter.
This is a safety change. Lets say you have a GCS which is in followme mode which is really GUIDED mode with continually updated waypoints. If the user then changes mode with the RC transmitter to HOLD or anything else then the Rover should STOP listening to the updated guided mode waypoints. This is how Plane/Copter work.
This commit is contained in:
parent
32994a5b1e
commit
f314b243ee
@ -789,9 +789,12 @@ GCS_MAVLINK::data_stream_send(void)
|
|||||||
|
|
||||||
void GCS_MAVLINK::handle_guided_request(AP_Mission::Mission_Command &cmd)
|
void GCS_MAVLINK::handle_guided_request(AP_Mission::Mission_Command &cmd)
|
||||||
{
|
{
|
||||||
rover.guided_WP = cmd.content.location;
|
if (rover.control_mode != GUIDED) {
|
||||||
|
// only accept position updates when in GUIDED mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rover.set_mode(GUIDED);
|
rover.guided_WP = cmd.content.location;
|
||||||
|
|
||||||
// make any new wp uploaded instant (in case we are already in Guided mode)
|
// make any new wp uploaded instant (in case we are already in Guided mode)
|
||||||
rover.rtl_complete = false;
|
rover.rtl_complete = false;
|
||||||
|
@ -306,6 +306,11 @@ void Rover::set_mode(enum mode mode)
|
|||||||
|
|
||||||
case GUIDED:
|
case GUIDED:
|
||||||
rtl_complete = false;
|
rtl_complete = false;
|
||||||
|
/*
|
||||||
|
when entering guided mode we set the target as the current
|
||||||
|
location. This matches the behaviour of the copter code.
|
||||||
|
*/
|
||||||
|
guided_WP = current_loc;
|
||||||
set_guided_WP();
|
set_guided_WP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -329,6 +334,7 @@ bool Rover::mavlink_set_mode(uint8_t mode)
|
|||||||
case HOLD:
|
case HOLD:
|
||||||
case LEARNING:
|
case LEARNING:
|
||||||
case STEERING:
|
case STEERING:
|
||||||
|
case GUIDED:
|
||||||
case AUTO:
|
case AUTO:
|
||||||
case RTL:
|
case RTL:
|
||||||
set_mode((enum mode)mode);
|
set_mode((enum mode)mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user