Skip to content

Conversation

@snozawa
Copy link
Collaborator

@snozawa snozawa commented Jun 16, 2025

Summary

  • Improve parabolicsmoother2 computation for the robot with dynamic limits.
  • In some condition of the recent big robot, the computed trajectory duration becomes very long. This PR intends to improve such worse-case outlier from parabolicmoother2.

Issue

  • With the recent robot with dynamic limits, we observe that parabolicsmoother2 computes the slow trajectory.
  • The following is the hand-made example to show the extreme case.
    • Wihtout this PR
      • BeforePR
    • With this PR
      • AfterPR
  • Without this PR, the velocity does not reach to the max.
  • The cause is:
    • In the first iteration in parabolicsmoother2 (_ComputeRampWithZeroVelEndpoints, _MergeConsecutiveSegments, and _Shortcut), the computed acceleration violates the dynamic limits. If the violation is large, the fTimeBasedSurpassMult becomes small. It also multiplied both to the velocity limits and the acceleration limits.
    • If it multiplied to the velocity limits, it cannot reach to the max.
    • In some case, the gap between GetDOFAccelerationLimits and GetDOFDynamicAccelerationJerkLimits might be very large. Thus, the slowing down becomes significant.

Resolution

  • For the robot with dynamic limits, compute the initial guess of ramp acceleration limits based on dynamic limits.
  • The dynamic limit is computed based on the current position and velocity.
  • In each iteration in parabolicsmoother2, it computes the ramp for t0 and t1. Thus, the boundary conditions for positions and velocities are fixed: x0, v0, x1, v1.
  • Thus, we can compute the dynamic acceleration limits at t0 and t1. This will be a necessary condition for ramp computation, e.g. good initial guess of acceleration.
  • As a result:
    • If there is no dynamic limits violation observed by Check2 between t0 and t1, we don't need to conduct slowing down iteration due to dynamic limits. In this case, velocity limits are not reduced at all.
    • If there is dynamic limits violation observed by Check2 between t0 and t1, we still need to conduct slowing down iteration as before. But, the value of fTimeBasedSurpassMult becomes closer to 1.0, and no unnecessary velocity / acceleration reduction.

Experiment

  • The main purpose of this PR is to mitigate the worst-case outlier. Confirmed that such worst case outlier is improved from the simulation. For example of the above example, the old trajectory duration was more than 10 sec and it becomes around 5 sec.
  • Conducted several tests 1) to move the robot to random joint positions, 2) to do the pick/place simulation. For both cases, the worst outliers are improved. There is slight improvement on average trajectory duration like 50msec - 200msec. Due to the non-convex optimization nature of parabolicsmoother2, there are the cases which duration become worse. but, the amount of deterioration was not that high.

Future todos

  • We need to revisit to the slowing down logic. For example, when acceleration is violated, it's nice to reduce velocity limit in some case, but not for other case. Need more investigation for this.
  • This PR improves the robot with dynamic limits. Similarly, I wonder if we can have a better initial guess for 1) compute inverse dynamics, and 2) manip constraints. Need more investigation for this.
  • There seem other situations that parabolicsmoother2 tend to be slow. for examples
    • fStartTimeVelMult and fStartTimeAccelMult carry over the mult from the previous iterations. but, once these become small, the later iterations remain slow.
    • If _neightstatefn is called in Check, somehow, large acceleration is created and it might cause much slowing down.

Shunichi Nozawa added 3 commits June 17, 2025 17:58
…the robot with dynamic limits.

- Issue
   - So far, DynamicsCollisionConstraint::_CheckState checks dynamic limits.
   - When it's violated, CFO_CheckTimeBasedConstraints is returned and both velocity limits and acceleration limits are reduced.
   - Even if the dynamic acceleration limits are violated, the velocity is reduced and tends to be slower trajectory.
- Observation
   - In many places to compute the ramp in parabolicsmoother2, boundary conditions are fixed.
   - In such case, the dynamic acceleration limits as boundary conditions can be computed as necessary condition for the planning.
- Resolution
   - Before each ramp computation, compute the dynamic acceleration limits as necesary condition.
@snozawa snozawa force-pushed the computeNecessaryConditionForDynamicAccLimitForParabolicSmoother2 branch from 7e738e0 to f8eed7b Compare June 18, 2025 06:02
@Puttichai
Copy link
Collaborator

@snozawa Thank you for the discussion!

In _Shortcut function, let's make _dynamicLimitInfo a shared ptr instead so that we don't allocate anything in case the robot does not have dynamic limits. KinBodyConstPtr usedBody can also be part of DynamicLimitInfo itself.

…robot without dynamic limit. Use shared_ptr of kinbody for computation.
@snozawa snozawa requested a review from Puttichai June 19, 2025 04:29
@snozawa
Copy link
Collaborator Author

snozawa commented Jun 19, 2025

@snozawa Thank you for the discussion!

In _Shortcut function, let's make _dynamicLimitInfo a shared ptr instead so that we don't allocate anything in case the robot does not have dynamic limits. KinBodyConstPtr usedBody can also be part of DynamicLimitInfo itself.

thanks for your reviewing and comment!

I made a fix for it!
7c6ec3a

Shunichi Nozawa added 2 commits June 19, 2025 17:22
@snozawa snozawa changed the title WIP: Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 Jun 24, 2025
@snozawa snozawa requested a review from rdiankov June 24, 2025 08:19
@snozawa
Copy link
Collaborator Author

snozawa commented Jun 24, 2025

I finished testing this PR on the real cell and simulated tests.
the detail is shared in the internal page.

Thanks!

…yConditionForDynamicAccLimitForParabolicSmoother2
snozawa and others added 4 commits June 26, 2025 10:45
Instead of forcibly setting the dof values to zeros, get the correct current values.

Co-authored-by: Puttichai Lertkultanon <[email protected]>
Clarify the meaning of dynamic limits.

Co-authored-by: Puttichai Lertkultanon <[email protected]>
Make the comment more precise.

Co-authored-by: Puttichai Lertkultanon <[email protected]>
@Puttichai Puttichai self-requested a review June 26, 2025 05:56
@snozawa snozawa changed the title Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 WIP: Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 Jun 26, 2025
@snozawa snozawa changed the title WIP: Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 Improve initial guess of acceleration limits for dynamic-limited robots in parabolicsmoother2 Jul 3, 2025
@rdiankov
Copy link
Owner

@snozawa the MR looks good, but can we add a test somewhere to test that smoother is hitting this condition correctly (even your hand-made example is okay).

@snozawa
Copy link
Collaborator Author

snozawa commented Jul 24, 2025

@snozawa the MR looks good, but can we add a test somewhere to test that smoother is hitting this condition correctly (even your hand-made example is okay).

thanks for your comment!

sure, i'll prepare such automated test case!

@rdiankov
Copy link
Owner

@snozawa great, let me know when that's done.

@rdiankov
Copy link
Owner

@snozawa @kanbouchou Were you able to get a unit test for this case? It is holding up merging this fix. Thanks

@snozawa
Copy link
Collaborator Author

snozawa commented Aug 25, 2025

@snozawa @kanbouchou Were you able to get a unit test for this case? It is holding up merging this fix. Thanks

sorry for being late.
I still could not have time for it yet.

@rdiankov
Copy link
Owner

@snozawa what was the data you used to internally test this feature and reproduce the problem?

@snozawa
Copy link
Collaborator Author

snozawa commented Aug 29, 2025

@snozawa what was the data you used to internally test this feature and reproduce the problem?

sorry for being late, I just made a test and now waiting for results.

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.

4 participants