Hi All,
After loading an URDF/SDF using loadURDF/SDF method in pybullet, how can I get the index of a link by its name in the URDF/SDF.
I see in the documentation that there is getJointInfo method to do this for joints but nothing for links. Any help is appreciated. Thank you.
Cheers,
Shravan
Getting link index
-
- Posts: 3
- Joined: Wed Jul 24, 2019 5:07 pm
Re: Getting link index
Found an important information that helped solve this issue.
In bullet linkIndex == jointIndex
Using the above, I currently have the following solution below
In bullet linkIndex == jointIndex
Using the above, I currently have the following solution below
Code: Select all
_link_name_to_index = {p.getBodyInfo(model_id)[0].decode('UTF-8'):-1,}
for _id in range(p.getNumJoints(model_id)):
_name = p.getJointInfo(model_id, _id)[12].decode('UTF-8')
_link_name_to_index[_name] = _id