Cart Controller help!
Hi!
I am making a cart controller. The idea is using a delta of time, iterate a given number of times to converge to the desired position. So the set parameters are dt (delta time) and N (iterations)
This is the made steps
- Get the desired task positions
- Get the actual joint positions
- Calculate jacobian for actual joint position
- Calculate actual task position for the joint position
- Calculate the error (for position and orientation)
- Divide the error by delta time to get velocity in task space.
- Using the jacobian and the velocity in task space, calculate the velocity in joint space.
- Using the velocity in joint space and the delta of time, calculate the necessary (new) joint positions.
- Iterate from 3 to 8 a number of times.
My variables are:
KDL::JntArray q_ (actual joint positions)
KDL::Frame x_des (the desired task position)
KDL::Frame x_s; (Task positions calculations)
KDL::JntArray q_ (joint positions calculations)
KDL::Jacobian J_ (jacobian)
KDL::Twist xerr_ (Task space error)
KDL::Twist xdot_s (Task space velocity)
Now this is the algoritm.
...
qs=q;
k=0;
while(!k>iter){
k++;
jnttojacsolver->JntToJac(qs, J); //Calculate jacobian for joint position
jnttoposesolver->JntToCart(qs, xs); //Calculate task position for the joint position
xerr.vel = xdes.p-x_s.p; //Calculate the error for position
xerr.rot = 0.5 * (xdes.M.UnitX() * xs.M.UnitX() + xdes.M.UnitY() * xs.M.UnitY() + xdes.M.UnitZ() * x_s.M.UnitZ()); //Calculate the error for orientation
xdots.vel = xerr.vel/dt; //Divide the error by dt to get xdot_s
xdots.rot = xerr.rot/dt; //Divide the error by dt to get xdot_s
qdots=f(xdots,J); //Then using xdots, and the jacobian, I calculate qdot_s
qs=qs+dt*qdot_s; //New joint position
The problem is that using that it doesn't perform well. I have check that it works when I don't use the error of rotation to calculate xdot_s (that happens when I comment the Bold line in my code). So I'm pretty sure I am not calculating well the error in rotation (and so the velocity in task space).
Could someone of you please help me?
Thank you so much.
Asked by azul azul on 2016-07-13 04:15:51 UTC
Comments
ROS does make use of KDL in various places, but you might get better answers on a more appropriate mailing list / forum. For KDL, I think that could be orocos-users.
Asked by gvdhoorn on 2016-07-13 04:25:03 UTC