-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide more information about how Guided mode for plane works #6096
base: master
Are you sure you want to change the base?
Conversation
plane/source/docs/guided-mode.rst
Outdated
stations support a "click to fly to" feature where you can click a point | ||
on the map and the aircraft will fly to that location then loiter. | ||
on the map and the aircraft will fly to that location then loiter. If an | ||
altitude is requested, the aircraft will fly at the current altitude until |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will fly to the new altitude immediately. The point has to be far enough away that it can finish the altitude change before it get there of course. You could double check in SITL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done extensive testing in SITL - this is what I'm seeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also see ArduPlane/navigation.cpp:45 where the comment (and code) specifically says:
// once we reach the position target we start checking the
// altitude target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure. To check I have also run in SITL. Very easy, mode takeoff arm (takes off to 50m), guided fly to somewhere a long way away at 100m. We get this:
Climb starts immediately, 100m is reached well before destination.
Note that if its a climb it will climb as fast as possible, where as a descent will glide such that it reaches the destination and the altitude at the same time.
The only case where it will still be changing altitude once it has reached the destination is if the change in altitude is sufficiently large it cannot be achieved in the available horizontal distance.
The code your looking at has nothing to do with the setting of target altitudes, it is what checks when we have reached the desired location so we can move on to the next waypoint for example.
How have you been testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running two arduplane SITL binaries, one of them is sending MAVLink updates to the other, the 2nd is using AP_Follow to receive the target plane info and then Lua script to call the new Lua run_command_int DO_REPOSITION command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see the problem I have @IamPete1 - my code calls DO_REPOSITION at 10Hz as it gets new position data from the plane it is following via MAVLink. I think this means it stays on the first part of your graph - where the altitude is level - and never gets a chance to head up before I hit it with a new position.
abf5411
to
ec6f61c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a review
plane/source/docs/guided-mode.rst
Outdated
stations support a "click to fly to" feature where you can click a point | ||
on the map and the aircraft will fly to that location then loiter. | ||
on the map and the aircraft will fly to that location then loiter. If an | ||
altitude is requested, the aircraft will fly at the current altitude until |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done extensive testing in SITL - this is what I'm seeing.
b7f3fcb
to
e332431
Compare
1b6e907
to
18f5bce
Compare
@IamPete1 can you approve? |
Could you recheck @Hwurzburg, @IamPete1? Is this what you are seeing @EyesWider ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement to the docs, can we merge?
@IamPete1 needs to approve |
stations support a "click to fly to" feature where you can click a point | ||
on the map and the aircraft will fly to that location then loiter. | ||
GUIDED mode is used when you want the aircraft to fly to a specific | ||
point on the map, or in specific direction (heading) without setting up a mission. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point on the map, or in specific direction (heading) without setting up a mission. | |
point on the map, or in specific direction (heading) without setting up a mission. | |
GUIDED mode also supports overrides. |
For more information about this, see the MAVLink GUIDED_CHANGE_HEADING documentation | ||
https://mavlink.io/en/messages/ardupilotmega.html#MAV_CMD_GUIDED_CHANGE_HEADING | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Atttitude Overrides | |
--------------------- | |
These overrides take priority. `SET_ATTITUDE_TARGET` can command roll, pitch, yaw, and throttle overrides. | |
Guided Slew Commands | |
--------------------------- | |
`GCS_MAVLINK_Plane::handle_command_int_guided_slew_commands` sets `plane.guided_state.target_airspeed_cm`, `plane.guided_state.target_alt_rate`, `plane.guided_state.target_heading`, and more. |
While this PR does improve the docs by documenting more ways that guided works, it's missing a few of the other supported modes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, your "Atttitude" has an extra t
While working on "plane follow" in Lua, I was puzzled by the behavior of the plane in Guided mode using mavlink commands
and while digging into the code, I discovered that Guided seems to have two effectively mutually exclusive "sub modes" - Guided Heading and Guided Location, which treat altitude differently. This is me explaining what I think I can see because others might find this useful if I'm right, or to be corrected if I'm missing something.