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

Toppra does not respect acceleration limits (in C++) #198

Open
jess-moss opened this issue Mar 25, 2022 · 9 comments
Open

Toppra does not respect acceleration limits (in C++) #198

jess-moss opened this issue Mar 25, 2022 · 9 comments

Comments

@jess-moss
Copy link

Describe the bug
I am running toppra on a 10 DoF robot with acceleration and velocity limits in C++, however, toppra is not respecting the acceleration limits.

To see the bug run the following test (which fails due to lack of respect of the acceleration limits):
https://gist.github.com/jess-moss/448d293853c08b6357e49c475fef6198

Expected behavior
When checking the accelerations and velocities along the toppra path, they should be within the limits created in the acceleration and velocity constraints. However, they are not.

Screenshots
I plotted the acceleration of one of the failing joints along with its constraints, which is shown below. Notice how the acceleration does not respect the lower bound.
image

In addition, I plotted the position, velocity and acceleration of this joint (see below). Note in this graph, the velocity and position are scaled. I also find it weird how the acceleration jumps a lot for a smooth position and velocity path.
image

@hungpham2511
Copy link
Owner

Can you check what is the discretizationType of the constraints?

If its Collocation, switching it to Interpolation should resolve the problem.

@jess-moss
Copy link
Author

The LinearJointAcceleration was already set to Interpolaton. I set the LinearJointVelocity to Interpolation just to be sure and it did not resolve the problem. Any other thoughts? I have linked the exact test I am running if you want to play around with it. Thanks!

@hungpham2511
Copy link
Owner

The LinearJointAcceleration was already set to Interpolaton. I set the LinearJointVelocity to Interpolation just to be sure and it did not resolve the problem. Any other thoughts? I have linked the exact test I am running if you want to play around with it. Thanks!

Thanks. I will try to have a look at the issue shortly.

@hitytqsz
Copy link

hitytqsz commented May 9, 2022

I encounter to a similar problem like jess-moss:
image

@hungpham2511
Copy link
Owner

Thanks all for reporting. Hopefully we can find some resource to work on this issue next month. Really sorry for leaving this issue hanging as things have been quite hectic at my work.

@mrunaljsarvaiya
Copy link

mrunaljsarvaiya commented May 31, 2022

@hungpham2511 Out of curiosity so I can better understand the algorithm, do you know of any introductory references to understanding the difference between collocation and interpolation discretizations?

@hungpham2511
Copy link
Owner

@hungpham2511 Out of curiosity so I can better understand the algorithm, do you know of any introductory references to understanding the difference between collocation and interpolation discretizations?

I think we have a few references in the paper. Have you tried checking?

These are discretization scheme used in ODE integration algorithms.

@hungpham2511
Copy link
Owner

Hi,

I had a look (finally, sorry for the long wait). The issue is due to the automatically selected number of points (100) is too small for the path you are giving toppra.

Mathematically when you have a path with high-curvature, a coarse grid points mean there is higher approximation error. This is universal to any algorithms that discretize the problems.

The solution that I am quite happy with is the procedure to automatically generate a grid points, but this only exists in the Python version of the software.

I could spin up quickly such an implementation.

As for @jess-moss issue, you can add this line

  auto algo = std::make_shared<algorithm::TOPPRA>(constraints, path);
  algo->setN(1000);

You will see that the error become much smaller.

@hungpham2511
Copy link
Owner

FYI #201 should address this issue more completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants