ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Get forward kinematics (w/o tf service call) from URDF & joint angles (Kinetic, Python)

asked 2018-01-30 12:17:23 -0500

Context:
I am writing a python ROS node that:

  1. Parses a URDF (from param server) and generates a trac_ik_python IK object.
  2. Generates an end-effector trajectory between the current location (xyz) and a target location (xyz).
  3. Then for each pt in the end-effector trajectory [(x0,y0,z0),(x1,y1,z1),...,(xn,yn,zn)].
    1. Gets joint angles from HEBI-X5 actuator.
    2. Calculates joint angles using trac_ik_python.
    3. Publishes joint angles to HEBI-X5.

Problem:
Inside the trajectory execution loop, I would like to know the actual end-effector position (based on some KDL tree and the HEBI actuator joint angle sensors).

If possible, I'd like to create the KDL object from the urdf - and just update it with the new joint angles.


Possible Solution:
This answer recommends using urdf_parser_py.urdf and pykdl_utils.kdl_kinematics
... unfortunately, pykdl_utils does not appear to be in ROS Kinetic.


Questions:

  • What's the best way to obtain forward kinematics from a urdf and joint angles (w/o using a tf service call - too slow)?
  • Is there a Kinetic substitute for pykdl_utils?
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2018-01-31 16:44:44 -0500

updated 2018-01-31 17:21:19 -0500

The easy workaround is to simply copy the hrl-kdl repository into your workspace: https://github.com/gt-ros-pkg/hrl-kdl So far, the forward kinematics (from urdf and sensor joint angles) have been correct - which is all that I want right now.

from urdf_parser_py.urdf import URDF
from pykdl_utils.kdl_kinematics import KDLKinematics

# pykdl_utils setup
robot_urdf = URDF.from_xml_string(urdf_str)
kdl_kin = KDLKinematics(robot_urdf, base_link, end_link)

test_jt_angles = [0, 0, 0]
pose = kdl_kin.forward(test_jt_angles)

Alternatively, you could re-implement pykdl_utils using http://wiki.ros.org/urdfdom_py and http://wiki.ros.org/python_orocos_kdl

edit flag offensive delete link more
2

answered 2018-01-31 11:46:30 -0500

rkeatin3 gravatar image

I asked a similar question a couple of days ago that went unanswered. I've since decided to dig into the source for the package python_orocos_kdl that I think will address both of our needs (though the documentation is definitely lacking). I'll update my question/the docs once I'm able to get something working.

edit flag offensive delete link more

Comments

Hmm, thanks for pointer - right now looking at using kdl_parser_py and python_orocos_kdl.

josephcoombe gravatar image josephcoombe  ( 2018-01-31 12:49:10 -0500 )edit

^ The two python modules I linked (kdl_parser_py.urdf and python_orocos_kdl.kinfamtest) seem to provide the most promising implementation. You are correct. Neither package has a well-documented Python interface.

josephcoombe gravatar image josephcoombe  ( 2018-01-31 12:51:17 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2018-01-30 12:17:23 -0500

Seen: 2,391 times

Last updated: Jan 31 '18