ros-industrial-consortium / descartes

ROS-Industrial Special Project: Cartesian Path Planner
Apache License 2.0
127 stars 92 forks source link

Is it possible to lower the IK iterations for each way points? #147

Closed yishinli closed 7 years ago

yishinli commented 8 years ago
[ INFO] [1456935580.602282360]: Found 4 joint solutions out of 10 iterations
[ INFO] [1456935580.603348158]: Found 4 joint solutions out of 10 iterations
[ INFO] [1456935580.604468261]: Found 4 joint solutions out of 10 iterations
[ INFO] [1456935580.605591487]: Found 3 joint solutions out of 10 iterations
[ INFO] [1456935580.606676848]: Found 4 joint solutions out of 10 iterations
[ INFO] [1456935580.606708753]: CartID: ID221 JointPoses count: 19

With DensePlanner, it takes 50 IK iterations for each way point. Is it possible to lower the IK iterations for each way points?

Thanks and Regards.

Jmeyer1292 commented 8 years ago

@yishinli I apologize that I haven't been able to respond to your requestions these last couple of days. We're going through a consortium meeting at the moment. I'll get on the ball after tomorrow is done.

The "10 iterations" portion is unfortunately fixed at the moment. This is a "feature" of the KDL based kinematics that we use by default. You should not see it with an IKFast based solution that overrides the getAllIK() function.

The source code to change if you want to is at the top of this file.

yishinli commented 8 years ago

@Jmeyer1292 - Thanks for your clarification. After lowering the SAMPLE_ITERATIONS, the iterations did decrease. Then, I noticed the following info:

[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: Found 1 joint solutions out of 1 iterations
[ INFO] [...]: CartID: ID6926 JointPoses count: 9

I traced into cart_trajectory_pt.cpp, and learned it is related to the size of wobjpt and toolpt. Two questions:

  1. What is the acronym for WCS?
  2. Where do we setup the size for toolpt and wobjpt?

Thanks and Regards,

Jmeyer1292 commented 8 years ago

Hey @yishinli

First the answers to your questions:

  1. I think WCS stands for world collision scene, but I'm not sure. At any rate, wobj_base_ describes the fixed transformation from the origin of the world to the base of the tool.
  2. If by size you mean the number of poses which we generate for each point, then the appropriate argument to change will be the position and angle discretization variables and the tolerance range. See here.

What's happening is that we are attempting to numerically explore all of the "valid" positions for a given trajectory point. If you set discretization to zero, you should only have a single point as you've told Descartes to only solve for that exact point. If you set the discretization variables higher, then Descartes will sample in this space and attempt to solve IK for all of them.

I'd also have a look at axially symmetric point for an example of a point with open tolerances about a single axis. This point is implemented in terms of Cartesian Pt, so it's a good reference.

I'd also strongly advise that you consider using closed form IK, such as can be created by IKFast. See this tutorial. If will greatly speed up your efforts. All serious work that we've done has used some form of closed-form kinematics and not the default implementation.