Skip to content
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

MAV_CMD_NAV_LOITER_TIME: add Heading Required field #1383

Merged
merged 8 commits into from
May 28, 2020

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented May 26, 2020

Other then for the MAV_CMD_NAV_LOITER_ALT, for MAV_CMD_NAV_LOITER_TIME there was no possibility to add a "heading wait" requirement. In my opinion this field should be consistent for both of these loiter types.

…ption

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer sfuhrer force-pushed the pr-loiter-time-heading-wait branch from de6f006 to 6d9aa73 Compare May 26, 2020 11:28
@hamishwillee
Copy link
Collaborator

@sfuhrer Do you mean MAV_CMD_NAV_LOITER_TO_ALT?

This and other loiter commands specify an Xtrack location, which I interpret to mean an "exit track" location. That sounds a bit like the heading. On LOITER_TO_ALT

Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).

What I think that means is that the system will leave the loiter:

  • 0: When vehicle reaches line between current waypoint (centre) and next waypoint. [Essentially this would be at 90 degrees to the path you want :-( )
  • 1: For exit location [don't know what this means - do you?]
  • NaN: yaw to system location - I think this means will exit when yaw matches system setting for yaw - ie normally when facing next waypoint (which is what you want) but could be when facing home.
  • Other value is "specific value"

So it sounds like this is setting the exit heading, and probably you want either 1 or NaN. The thing it is missing is just "head off whenever you have reached the altitude].

I'd like to clarify what Xtrack does, because if we want to be consistent, then we need to adopt the same terminology. Does this make sense?

<param index="2">Empty</param>
<description>Loiter at the specified Latitude, Longitude and Altitude for a certain amount of time. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint.</description>
<param index="1" label="Time" units="s" minValue="0">Loiter time (only starts once Lat, Lon and Alt is reached).</param>
<param index="2" label="Heading Required" minValue="0" maxValue="1" increment="1">Heading Required (0 = False)</param>
<param index="3" label="Radius" units="m">Radius around waypoint. If positive loiter clockwise, else counter-clockwise.</param>
<param index="4">Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).</param>
Copy link
Collaborator

@amilcarlucas amilcarlucas May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the index 4 for this? It already has an effect for forward moving vehicles, just add the descrition for what it should do for "non-forward moving vehicles". Something like:
<param index="4" label="xtrack location/heading">For forward moving vehicles, this sets exit xtrack location: 0 for center of loiter, 1 for exit location. Else, this is desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.). For other vehicles: 0 or NaN means do not change current Yaw behaviour, 1 means Yaw to next WP before leaving this point, other values (2.. 361) are a direct Yaw command before leaving this location.</param>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't support case of leaving when heading is reached but then go back to the center line.

@sfuhrer
Copy link
Contributor Author

sfuhrer commented May 27, 2020

@hamishwillee here the promised screen shot of a mission containing MAV_CMD_NAV_LOITER_ALT with different configuration (at least that's how PX4 is interpreting it atm):
with param1: heading reaquired, param4: xtrack location --> (param1, param4)
WP 2: (0,0), WP 4: (1,0), WP 7: (1,1), WP 9: (0,1)
image

@hamishwillee
Copy link
Collaborator

@sfuhrer I got carried away and tried to tidy up the MC vs FW story on this. Would be good if you could sanity check this.

Decided NOT to change comment about existing on tanjent of loiter to the center of the next waypoint. That isn't helpful because a system might well want to exit on the tanjent of one waypoint to the tanjent of the loiter circle of the next waypoint - and we shouldn't prohibit it.

@sfuhrer
Copy link
Contributor Author

sfuhrer commented May 27, 2020

@hamishwillee your changes sound good yes, it's much better defined like this. Only one thing: For param4, isn't there a "For" missing, so "For forward moving aircraft..."?

@amilcarlucas
Copy link
Collaborator

The current text also talks about wp instead of the lat/lon of this message

@hamishwillee
Copy link
Collaborator

hamishwillee commented May 27, 2020

@amilcarlucas

The current text also talks about wp instead of the lat/lon of this message

In the context of a mission this means the same thing (though I would have referred to it as a "loiter waypoint".

The Dev call are OK with the message as is. I'm going to look again tomorrow. I THINK this is OK, and that the change allows some things which cannot be done purely with X-track.

Note, I will go through all these messages and update them consistently at some point.

@hamishwillee hamishwillee merged commit 7cf9608 into mavlink:master May 28, 2020
@hamishwillee
Copy link
Collaborator

@sfuhrer I'm merging this now as agreed with the dev call.

There have been general improvements to text which will roll out later.

@hamishwillee
Copy link
Collaborator

hamishwillee commented May 28, 2020

@sfuhrer I did not make the Xtrack change yet. The current definition of Xtrack is:

For forward-moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).

I interpret the exit xtrack to be the path that the vehicle will trend towards after exiting the loiter. So the values are.

  • 0: Track is from centre of loiter waypoint to centre of next waypoint, so we exit from tranjent (or wherever) but trend back to the centre line.
    image

  • 1: Track is from loiter circle exit location to centre of the next waypoint.
    image
    This one is a bit weird because it looks like the exit point is where it leaves crosses the original circle, not where it leaves the original path.
    image

  • Other values indicate desired yaw angle. This isn't at all clear to me - can you clarify. My GUESS is that the yaw angle is the angle of entry into the next waypoint in degrees relative to the track between the centres. So for an angle of around 45 you'd get a path like below. If not, can you clarify?
    image

  • NaN is system yaw behaviour. By default that is towards the next waypoint - so I'd expect this case to be the same as "0". But what about if yaw setting is towards home? Does that mean that the angle from the vehicle to home at the point the vehicle exits the radius is the angle it would approach the next waypoint (relative to the center-centre path as in previous point?)

Can you confirm, in particular for the yaw angle cases how it works?

@sfuhrer
Copy link
Contributor Author

sfuhrer commented Jun 2, 2020

@hamishwillee I first want to point out that I'm much more familiar with the fixed-wing use case than the rotary-wing one, and I actually think that the second and third sentence are actually referring to MC use cases

Else, this is desired yaw angle. NaN to use the current system yaw heading mode (e.g. yaw towards next waypoint, yaw to home, etc.).

For MC this seems to make sense, as you there can fly with arbitrary yaw. For FW it doesn't, an thus if you set anything beside exactly 1 it should do the default ("0") behavior.

About the 3rd pic you posted, about the weird exit and then going to the tangent path of the opposite side of the circle: that seems to be a bug of PX4. I though want to point out that this setting (no heading wait but then xtrack=1) really makes no sense and should even be prevented (only allow xtrack=1 with also heading wait =1). Not sure if a re-write of this mavlink command though is necessary, or if it is rather for the ground station to disable setting anything other than heading wait =1 if xtrack=1 (resp. prevent xtrack=1 if heading wait =0).
Otherwise I think we interpreted it the same way, yes.

@hamishwillee
Copy link
Collaborator

@sfuhrer Thank you.

  1. We really don't have any mechanism other than documentation to specify that something behaves a particular way for a particular vehicle, or how parameter values affect each other.
  2. The docs on xtrack explicitly say "For forward-moving aircraft" - so any options that don't make sense for FW should be removed. Let's ask James ...

@auturgy Xtrack defines the path that a fixed-wing vehicle will converge towards upon leaving loiter. I've put some examples above - #1383 (comment)

The first two options above make sense - a tanjential path from the loiter to the center of the next waypoint, or a path from the tanjent that convergest to the direct line between the two points.

The other two xpath settings are not clear, but I think they define "an angle of entry to the next waypoint relative to the center line between the waypoints". The angle being either explicit (degrees) or NaN ("system yaw"). In particular the system yaw option makes little sense since the behavour would be very unpredictable.

Does ArduPilot use those, and if so, what for/when do you want to do this?

My proposal is that we simply remove xtrack options other than 0 and 1.

@sfuhrer sfuhrer deleted the pr-loiter-time-heading-wait branch June 3, 2020 07:18
@hamishwillee
Copy link
Collaborator

@auturgy When you get a chance, can you please look at my last post above

amilcarlucas pushed a commit to ArduPilot/mavlink that referenced this pull request Sep 22, 2020
amilcarlucas pushed a commit to amilcarlucas/mavlink that referenced this pull request Sep 25, 2020
amilcarlucas pushed a commit to amilcarlucas/mavlink that referenced this pull request Sep 29, 2020
amilcarlucas pushed a commit to amilcarlucas/mavlink that referenced this pull request Oct 5, 2020
amilcarlucas pushed a commit to amilcarlucas/mavlink that referenced this pull request Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants