iiwa_ros
iiwa_ros copied to clipboard
Jacobian difference with RBdyn
Hello guys,
I was using /iiwa_jacobian_server
to get jacobian (in ros node 1).
Also, Im calling jacobian_server from another node (node 2 ) and ending up crashing the first node sometimes. (Some server calling error )
As a solution I thought of using RBDyn library to get jacobian (using the same piece of code as in iiwa_tools); as follows;
Eigen::MatrixXd jacobian(const Eigen::VectorXd &q, const Eigen::VectorXd &dq)
{
mc_rbdyn_urdf::URDFParserResult rbdyn_urdf = rbdyn_urdf_;
rbdyn_urdf.mbc.zero(rbdyn_urdf.mb);
_update_urdf_state(rbdyn_urdf, q, dq); \\ updates states for the rbdyn_urdf with current q and dq
//compute jacobian
rbd::Jacobian jac(rbdyn_urdf.mb, rbdyn_urdf.mb.body(_ef_index).name());
rbd::forwardKinematics(rbdyn_urdf.mb, rbdyn_urdf.mbc);
rbd::forwardVelocity(rbdyn_urdf.mb, rbdyn_urdf.mbc);
return jac.jacobian(rbdyn_urdf.mb,rbdyn_urdf.mbc);
}
Im using the /robot_description
from the ros parameter server for the urdf input for RBDyn code, which means input for the both of them is same. However, what I realized is:
jacobian matrix from my code is coming up different compared to when called from /iiwa_jacobian_server
, even if the piece of code is same!
I just want to know if you have considered something more than this piece of code which Im missing from iiwa_tools ?
If you use exactly the same code and same input (URDF, end-effector, q, dq), then RBDyn provides identical results. Either your URDF is slightly different (e.g. you are not setting the initial pose or root joint correctly/at the same place) or you are giving a different end-effector or you are "viewing" different timesteps: aka, iiwa_jacobian_server
computes the Jacobian for time k
and you compute the Jacobian for time k+1
.
Also, what type of differences are we talking about?
hi @costashatz thanks for your reply, Thanks for confirming. I checked and compared with matlab as well, and found that update_state function was getting garbage values ! Now everything is fine. Cheers !!