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
Add information to path planning re: Bezier curves #680
Conversation
Whoops, the Bezier isn't available in Offboard (I think). That would need to be clarified as well. It is only available in COM_OBS_AVOID=1 mode. |
@jkflying I've done a minor restructure and added a few questions, but bigger picture I still don't understand this.
|
PX4 still sends back the waypoint trajectories. These are just the next N waypoints in the mission, so nothing changed that side. The difference is that you can now specify from the companion the exact vehicle motion, not just overriding what the next waypoint should be.
Even better, it should be for X-coordinates of Bezier control points. Bezier curves are funny in that the curves don't actually go through the points you specify, the points are just used to calculate parameters of the curve that is followed. So it's important to specify that they are control points, not just points.
So this is more about understanding how Bezier curves work, which isn't immediately obvious from how they are parameterized. You specify a bunch of control points, and then a 'fraction traveled', often referred to as t, which shows you where on the curve you are. The only guarantees of the Bezier curve in terms of position, is that you start at the first point when t=0, and end at the last point when t=1. So the delta here is used to say how long (in time, ie. seconds) it takes to get from the first point to the last point, which in t terms is from t=0 to t=1. What happens on the flight controller is it checks the current time, compares that to the timestamp the message was sent and the duration of the curve from It can then use that t, plus the control points, to get the exact position (and velocity, and acceleration) that the vehicle should have right now to follow the curve. Clear as mud, I know. Please let me know if / what isn't making sense, so I can explain it better somehow 🙈 |
Just what I needed to know. Restructuring because PX4 doesn't know what trajectory messages it will get back so it always sends out the same waypoints. That means I think two corrections to your comment above (?)
|
FYI, updated definitions for the interface in mavlink and removed WIP. Please check them: mavlink/mavlink#1321 |
Actually pretty good, though hard to document for externals without saying all this. What this tells me (that wasn't obvious previously) is that we're only supplying a curve for the next planned time fragment (around 0.5s), and we're supplying it from the point at which we sent the message [i.e. we're not supplying 2 minutes of curve, and telling them to just use some fragment of it]. |
OK. Updated. I think it is probably good enough to publish (if you could please sanity check). As an aside, we know that a planner that does not support a particular mode should mirror back the setpoints. What about a planner that does not support missions in mission mode? It is receiving waypoints not setpoints, so mirroring the incoming trajectory will send back the setpoint as the waypoint itself. Is that expected? |
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.
That means I think two corrections to your comment above (?)
1. "The difference is that you can now specify from the companion the exact vehicle motion, not just overriding what the next waypoint setpoint should be."
Correct.
2. It is really it isn't "N" waypoints supplied (except in theory). We know that this is actually fixed at 2 (current and next) from the docs.
Yes, this is a limitation from PX4 side due to the triplet architecture. Perhaps one day it will send more 🙂
OK. Updated. I think it is probably good enough to publish (if you could please sanity check).
I saw a few small things, otherwise this looks good.
As an aside, we know that a planner that does not support a particular mode should mirror back the setpoints. What about a planner that does not support missions in mission mode? It is receiving waypoints not setpoints, so mirroring the incoming trajectory will send back the setpoint as the waypoint itself. Is that expected?
Everything in auto mode works on either position waypoints or velocity setpoints. We've been abusing that on the avoidance side by sending waypoints that get updated in location each message to try to fool the FCU into following the path we want, so the Bezier is just a way of doing this 'properly' instead of working around the old interface. However, if you mirror back exactly what is being sent from the FCU, the vehicle should behave exactly as it does with COM_OBS_AVOID=0 ie. turned off. The only difference I can think of is that it might take an extra few milliseconds to 'accept' a waypoint and start going to the next one, due to comms delays. So if you don't support a certain mode in the planner, just mirror back the waypoint trajectory and it will behave 'normally', ie. as it would if the avoidance was off.
Co-Authored-By: Julian Kent <julian@auterion.com>
Thanks @jkflying - Doubtless we could iterate forever, but I think this is more than good enough for people to understand what they need to do. |
This is a first pass. I'm not really happy with the formatting, but I leave that to the expert :-p
Right now there is nothing available to send the Bezier curves, so there it isn't much more to add yet.