Closed allbluelai closed 3 years ago
Dear Allbluelai,
It is not so clear to me what you are attempting to do with this code but, since the change of the end-effector pose in flange frame with the real robot has to be done using the web interface, this method was meant for being called once at the beginning of the program during configuration. BTW, the class vpROSRobotFrankaCoppeliasim implements some callbacks, like callback_flMe, which can automatically retrieve such parameters directly from coppeliasim (see tutorials).
I then run your code and the issue is that calling several times the method robot.set_flMe( flMe ) it will add the new transformation on top of the previous one. A quick fix you can do is to modify the method as follows:
void vpRobotFrankaSim::set_flMe( const vpHomogeneousMatrix &flMe ) { std::lock_guard< std::mutex > lock( m_mutex );
KDL::Frame frame8Mfl_kdl; frame8Mfl_kdl = m_chain_kdl.segments[7].getFrameToTip(); vpHomogeneousMatrix f8Mfl, f8Me; for ( unsigned int i = 0; i < 3; i++ ) { for ( unsigned int j = 0; j < 3; j++ ) { f8Mfl[i][j] = frame8Mfl_kdl.M.data[3 i + j]; } f8Mfl[i][3] = frame8Mfl_kdl.p.data[i]; } f8Me = f8Mfl m_flMe.inverse() * flMe;
KDL::Rotation f8Re( f8Me[0][0], f8Me[0][1], f8Me[0][2], f8Me[1][0], f8Me[1][1], f8Me[0][2], f8Me[2][0], f8Me[2][1], f8Me[2][2] ); KDL::Vector f8te( f8Me[0][3], f8Me[1][3], f8Me[2][3] ); KDL::Frame f8Me_kdl( f8Re, f8te );
m_chain_kdl.segments[7].setFrameToTip( f8Me_kdl ); m_flMe = flMe;
}
In this way, the kinematic chain will be always updated with the new transformation from the flange, even if a transformation was already added.
We will add this modification in the next update.
Best,
Dear @aaoliva ,
Thank you for your kind reply. I set robot.set_flMe() to verify whether the Jacobian matrix of the feature points is correct. I want to get the velocity of feature points which is attached to end effector. This means that the homogeneous matrix between the feature point frame and the end effector frame is constant. ${}^{E}Q$ is the coordinate of the feature point expressed in the end effecor frame. {f} is the robot base frame. {E} is the end effector frame and EORG is its origin. THere are, I guess, two ways to get the velocity of feature points expressed in the robot base frame {f}. One is get the Twist transformation matrix between Re(the feature point frame) and Rf(the robot base frame). --> see fVe. As shown in the above formula.
Another is set robot.set_flMe( flMe2 ). Here flMe2 is the homogeneous matrix between the feature point frame and the flange frame. Then I can get get_fJe() which means that I can get the feature point Jacobian expressed in the robot fixed frame
In tutorial-franka-coppeliasim-ibvs-apriltag.cpp, I run the code:
the output of the terminal:
I read fMfl and fMe from CoppeliaSim. I got fJe1≠fJe2. There seems to be a BUG with robots.set_flMe().