ros / kdl_parser

kdl_parser and kdl_parser_py provide tools to construct a KDL tree from an XML robot representation in URDF.
67 stars 62 forks source link

AttributeError: 'tuple' object has no attribute 'getChain' #56

Closed adhitir-magna closed 3 years ago

adhitir-magna commented 3 years ago

Getting this attribute error.

AttributeError: 'tuple' object has no attribute 'getChain'

Environment: Ubuntu 18.04 with ROS Melodic Robot: UR10e

Script:

import PyKDL as kdl
import kdl_parser_py.urdf as kdl_parser
base_link = 'base_link'
ee_link = 'tool0'
tree = kdl_parser.treeFromParam('/robot_description')
chain = tree.getChain("base_link", "tool0")
clalancette commented 3 years ago

The treeFromParam method returns a tuple, so you need:

import PyKDL as kdl
import kdl_parser_py.urdf as kdl_parser
base_link = 'base_link'
ee_link = 'tool0'
ok, tree = kdl_parser.treeFromParam('/robot_description')
chain = tree.getChain("base_link", "tool0")

In the future, please ask questions like this on https://answers.ros.org, which is our centralized place for questions and answers. Closing this issue.