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

About bezier curve predict velocity #6

Open
zhengyang-ponyai opened this issue Mar 25, 2024 · 4 comments
Open

About bezier curve predict velocity #6

zhengyang-ponyai opened this issue Mar 25, 2024 · 4 comments

Comments

@zhengyang-ponyai
Copy link

Great work!
I wonder how you connect bezier curve with velocity. "t" value of bezier curve seems not have meaningful physical explanation.
So you use "t" as time may violate the definition of beizer curve, the actual meaning of t is just a coefficient control basis and its not linear.
image

@MasterIzumi
Copy link
Collaborator

@zhengyang-ponyai Thanks for your comments. Actually, t is the normalized time, which varies from 0 to 1. The actual time can be derived through a scale factor. You can refer to [1,2] for details. Thanks.

[1] Gao, Fei, et al. "Teach-repeat-replan: A complete and robust system for aggressive flight in complex environments." IEEE Transactions on Robotics 36.5 (2020): 1526-1545.
[2] Ding, Wenchao, et al. "Safe trajectory generation for complex urban environments using spatio-temporal semantic corridor." IEEE Robotics and Automation Letters 4.3 (2019): 2997-3004.

@zhengyang-ponyai
Copy link
Author

Thank you for your answer, when predict shape of a trajectory, bezier curve is fine. But when predict velocity, you use one order derivative of bezier curve, seems not represent velocity of this curve in math, how you connect the physical meaning in math.
For example in your paper, the agent is perform UTURN, it can has various motion (velocity), but derivative can only represent one possibility, suppose it moving at a fix speed, the method in paper will never predict the right velocity?
image

@zhengyang-ponyai
Copy link
Author

I think the key point is how you define time in bezier curve. After reading relative supplement you comment, I still not understand how a simple scale can connect "t" in bezier with time?
image

@MasterIzumi
Copy link
Collaborator

@zhengyang-ponyai Thanks for your comments. However, I think you misunderstood the problem.

It is common to use a continuous parametric curve (polynomial, Bezier curve, b-spline, etc.) to describe the motion trajectory of a rigid body, since we can easily get the higher order quantities (velocity, acceleration) by calculating its derivatives [1]. It is trivial for monomial basis polynomial, since t varies from -inf to inf by definition, so we can directly regard t as the actual time.

For Bezier curves, the coefficient t varies from 0 to 1, however, we can remap the actual time tau to [0, 1] by t = tau / tau_max, e.g., prediction horizon is 5 sec in Argo2, so tau_max is 5. For a Bezier curve f(t), we can get the positions by Y_pos = B x P as described in the paper. Here, you should know that the obtained positions correspond to the actual time tau. As for the velocity, it should be the derivative of f with respect to tau, so there will be a coefficient n / tau_max as described in the paper. For the velocity prediction, we do the following procedures: 1) predict P (control points) for positions, 2) calculate P' for velocity 3) multiply the Tp matrix for velocity and P', 4) multiply the scale factor. Please refer to the code of function MLPDecoder in simpl.py (line 501-509 for Tp matrix, line 538-542 for velocity calculation).

Here we provide some qualitative results on Argo 1 and Argo 2.

  • For Argo 1, the ground truth velocity is not provided, we use the difference of GT position to calculate GT velocity. We can see the predicted velocity basically aligns with the GT velocity. The left subfigure shows the trajectories of the target agent, red is history, green (with a star in the endpoint) is GT future, and the dashed curves are predicted trajectories. The right subfigure shows the velocity profile of the corresponding trajectories.

Screenshot from 2024-03-26 18-03-21
Screenshot from 2024-03-26 18-04-23

  • For Argo 2, we plot both the provided GT velocity and the calculated GT velocity from positions. We can see the trend also matched.

Screenshot from 2024-03-26 17-47-53
Screenshot from 2024-03-26 17-53-50
Screenshot from 2024-03-26 18-00-41

However, it seems that the position part of the trajectory in Argo 2 is processed by some smoothing or fitting algorithm, making the differences of GTposition misalign with the GT velocity (especially near the end part). I would personally think this is a hidden bug for the Argo 2 dataset. But the conclusion does not change, since we did not use the GT velocity in the training phase, the predicted velocity can be derived using the property of Bezier curve, and the results align with the GT velocity calculated by the GT positions' differences.

[1] Mellinger, Daniel, and Vijay Kumar. "Minimum snap trajectory generation and control for quadrotors." 2011 IEEE international conference on robotics and automation. IEEE, 2011.

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

No branches or pull requests

2 participants