[SOLVED] Forward Kinematics: Get cartesian position from joint angles
I am trying to find a method for calculating cartesian positions of specific joint angles. My goal is to be able to publish joint states and get cartesian positions back for each set of joint states, without running a robot simulation.
I found this question: http://answers.ros.org/question/19391...
After looking into the joint_state_publisher
and robot_state_publisher
nodes and the /tf
topic, I have come up with a somewhat convoluted method of achieving a forward kinematics solver.
1. My node publishes joint states for the robot, read from a text file
2. robot_state_publisher receives joint states and publishes transforms
3. My node receives transforms, calculates base to tip transform (lookupTransform), and outputs a cartesian position
Then I found this: http://docs.ros.org/hydro/api/pr2_mov... This page briefly mentions the use of a FK/IK solution which seems promising, but it looks like it's using a robot simulation as the joint states input. Is it possible to use this to retrieve xyz positions from joint angles that are read from a file instead? Note that I do not expect to find a solution that will read my file and use the information, I have a file parser node that will handle this and format the data in whatever message type is necessary for the interacting nodes.
When you say 'calculates base to tip transform', are you doing that manually or using tf
lookupTransform(base, tip,...)
to do it in one call?I'm using
lookupTransform
. Added that to the above. Thanks!Do you have access to URDF? If so, you can create a robot model from that and then use FK to compute it using something like this.
Pedantic maybe, but MoveIt! does not run "a robot simulation" at all. A MoveIt configuration pkg just provides a bunch of configuration files for
move_group
, which enables it to plan trajectories for a kinematic structure. There is no simulation anywhere.If you don't want to use services, you could use the underlying API directly. See Kinematic Model Tutorial for a tutorial. No join states or robot states needed.
Thank you all for your help! With your suggestions, I was able to come up with a solution for my problem, posted below. Thanks again!