-
Notifications
You must be signed in to change notification settings - Fork 569
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
PILZ LIN samples in time instead of space #3292
Comments
It really does that? Weird. While I think Pilz could definitely be rewritten to be like 10% of the amount of the code it currently is, that would take a while -- especially because of the blending functionality. My suggestion would be to find a way to elevate that 0.1 seconds hard-coded value to an input parameter, thereby exposing a way to parameterize IK solve resolution by distance. At least for the LIN profile, that would be an easy calculation based on linear and angular distances. For the CIRC profile, I guess it's also doable since there are formulas for arc lengths based on descriptions of a circle. |
Correct me if I am wrong but the value is hardcoded here and gets forwarded till here where IKs are performed for each time samples.
Totally agree with you.
Even though having this value hardcoded isn’t ideal, simply exposing it as a parameter wouldn’t fully solve the problem. Instead, I think it would be better to introduce two parameters: Correct me if I’m wrong, but assuming a rectangular velocity profile, the sampling time should remain constant along the path. However, with a trapezoidal profile, it wouldn’t be constant. That said, if we compute a fixed sampling time based on the rectangular profile assumption, I think that the constraints should still hold at the acceleration and deceleration phases of a trapezoidal profile. |
Wow yes, that default value of 0.1 is not used at all at the top level of Pilz -- wild. Line 129 in 2302268
And that makes sense -- I'm reading the Pilz code now and it seems the general step is:
So yes, I guess you could do what you suggested by checking the KDL velocity profile's If these are less than the
Downstream of this, I have no idea how well the rest of Pilz handles non-uniform sampling times... so that may also help decide which of the 2 possible solutions to take. EDIT: It seems there are places that explicitly check for uniform sampling time, like this function used in blending. |
You're absolutely right—there are multiple places in PILZ where sample_times are assumed or checked to be constant. That said, I completely agree that the ideal solution would be to move away from a constant sampling time. As a possible simplification, we could consider the following approach:
This approach ensures a constant sampling time based on a rectangular velocity profile assumption. If applied to a motion with a trapezoidal profile, it should guarantees that the sampled points along the trajectory will be closer than the specified interpolation distances, even if they are not perfectly equidistant in Cartesian space. What do you think? |
I think it's certainly an improvement from hard-coded 0.1 seconds! It does actually make some points closer together and others farther apart, though... since a rectangular velocity profile with the same duration as a trapezoidal one necessarily has a lower max velocity. So I'm sort of worried about the "max distance" value not actually being honored vs. a pure sample time one. See for example the following image from this link It could also be a "max sample time" + "min number of points" configuration. So for example, sample trajectory at 0.1 seconds / 20 points, meaning if you have a quicker trajectory it will upsample it to ensure there are 20 points. On the other hand, if you have a longer trajectory it might have more than 20 points, but will be sampled at 0.1 seconds. We can start with your idea and see how it goes; I imagine it will touch more of the code and testing paths than we might imagine. |
That's for sure! 😄
I am not requiring the two motion profiles to have the same duration, but rather the same maximum velocity. If I ensure that the sampling time in the max-velocity region is small enough such that the displacement in each sample is below the threshold, I am confident that during the acceleration and deceleration phases, the same sampling time will result in even smaller displacements (since the velocity is not at its peak). Does this address your concern about this approach?
I really like this configuration option expecially for PTP motions.
I'll create a branch to start working on this. |
I think I get it now -- if the max speed is that from the Cartesian limits, and not from matching the duration of the trapezoidal profile, this should indeed provide a guaranteed bound. Thanks! |
And in your equations, my proposal would be trivial to add:
Where |
What do you think about setting this Moreover, I want to point out that by implementing what we're planning, the planning time will drastically increase due to additional collision checking. For this reason, I would suggest adding two more parameters: |
I would say yes to the sampling time, and "not yet" to the collision checking idea. Let's first see how it goes with the ability to configure sample times/distances to trade off density of waypoints vs. time spent solving IK/collision checking those IK solutions. Especially if you have ideas for how to make the defaults compatible with existing behavior, I'm in favor of building up more functionality/optimizations as they are further needed. |
Bumped into this error as well when planning with LIN at higher velocities, specially with rotations, appreciate this.
Did you bump into any issues while planning with LIN with the I had cases in which the generated planned path contained joint velocities above these limits throwing an error. Just a thought, could the There is a whole discussion about this very own issue here moveit/moveit#3553 as well by the way. I may have missed some conversations about this but it felt like I did not reach a full control of the velocity profiles I was expecting by having to verify both files have proper values, and even then, it could enter a scenario (due to the issue described here) in which it could fail.
Looks like a good GSOC to me 😃 |
@Danilrivero Thank you for linking this interesting PR.
During my preliminary tests, I encountered the Reducing the sample time amplifies the velocity and acceleration values, causing Why are small motions problematic?The issue with small motions is that they exacerbate the impact of the numerical inverse kinematics (IK) solver's threshold (e.g., KDL, Track-IK) on the computed derivative. Let’s illustrate this with a numerical example:
I didn’t frame this in terms of joint-space velocity due to the nonlinear nature of the Cartesian-to-joint relationship, but this reasoning in Cartesian space helps explain why excessively close samples cause velocity limit violations. Possible Problems and Solutions for the Proposed ApproachProblem 1:The last point of the trajectory may not have the same sampling time as the others if the path length is not a multiple of the most conservative interpolation. Proposed Solution: Problem 2:As stated in previous comments, if we choose a constant sample time to be compatible with the blending functionality, the points at the beginning and end of the trajectory will have the smallest displacement (assuming equal acceleration and deceleration limits If this displacement is comparable to the inverse kinematics (IK) solver threshold, the motion may fail due to joint limit violations. Proposed Solution: |
Hi, Really appreciate your insightful comment about the issues related to
I agree with all of this, seems to be the proper solution to the existent problem with accelerations encountered.
Agree with you in everything other than proposing the use of the Hessian for the accelerations if you are going for it, don't know the possible downsides. Also taking into account the singularities probably. Overall all your proposed ideas are great, it seems to be a considerable rework of the whole PILZ planner though, if you are going for it I am down to assist whenever possible. |
I started working on this fix here Completed so far:
Remaining tasks:
If anyone has time, a review would be greatly appreciated! Let me know if you see any possible improvements or concerns with the current approach. |
Description
The LIN pipeline of
pilz_industrial_motion_planner
samples IK solutions along the Cartesian path using a fixed sampling time (0.1 sec). Once the IK solutions are obtained, a joint-space interpolation is performed.Since the Cartesian path is sampled based on time rather than space, the linearity of the resulting path degrades as the commanded motion speed increases.
For example, consider a motion of 1 meter:
Since these points are then interpolated in joint space, the first motion will appear more linear than the second due to the higher number of samples along the Cartesian path.
ROS Distro
Humble
OS and version
Ubuntu 22.04
Source or binary build?
Source
If binary, which release version?
No response
If source, which branch?
humble
Which RMW are you using?
CycloneDDS
Steps to Reproduce
Command the same LIN motion at different speed and analyze resulting path linearity
Expected behavior
The linearity of the generated path should remain independent of the commanded speed.
Actual behavior
The linearity of the generated path is dependent of the commanded speed.
Backtrace or Console output
No response
The text was updated successfully, but these errors were encountered: