Dear all,
I really do not know how to use Forward Kinematics. I made a simple example to test it, but there is something I am doing wrong.
My PR2 is in a initial position when I load it. The default eef of the robot for the right arm is the "r_wrist_roll_joint". So I thought that using getCurrentPose() and Forward Kinematics should provide me the same X Y Z coordinates for the robot.
Here the simple code using the MoveIt!'s API:
moveit::planning_interface::MoveGroup group("right_arm");
ROS_INFO_STREAM("Initial pose " << group.getCurrentPose());
Output:
[ INFO] [1405006035.569845583, 1378.744000000]: Initial pose header:
seq: 0
stamp: 1378.744000000
frame_id: /odom_combined
pose:
position:
x: -0.192969
y: -0.791602
z: 0.40146
orientation:
x: 0.0487059
y: 0.783749
z: -0.243029
w: 0.569476
Now trying to get the point pose using Forward Kinematics, that should get the value of the joints and calculate some coordinates:
robot_model_loader::RobotModelLoader robot_model_loader("robot_description");
robot_model::RobotModelPtr kinematic_model = robot_model_loader.getModel();
robot_state::RobotStatePtr kinematic_state(new robot_state::RobotState(kinematic_model));
const Eigen::Affine3d &end_effector_state = kinematic_state->getJointTransform("r_wrist_roll_joint");
/* Print end-effector pose. Remember that this is in the model frame */
ROS_INFO_STREAM("Translation: " << end_effector_state.translation());
Output:
[ INFO] [1405006040.851465696, 1380.346000000]: Translation: 0
0
0
It would be great if any of you could explain me what I am doing wrong. Thanks,
Carlos