Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collision_trimesh_fk doesn't have the updated vertex positions #16

Open
ad1t7a opened this issue Dec 30, 2020 · 0 comments
Open

collision_trimesh_fk doesn't have the updated vertex positions #16

ad1t7a opened this issue Dec 30, 2020 · 0 comments

Comments

@ad1t7a
Copy link

ad1t7a commented Dec 30, 2020

I was trying to get the vertex positions of the meshes after performing forward kinematics on the robot (say, when the joint positions are set, the vertices of the meshes had have to be updated with respect to the base frame). I used the UR robot which is a part of this repository as an example and here is my implementation.
from urdfpy import URDF

    class Kinematics:
        def __init__(self, urdf):
            self.urdf = urdf
            self.robot = URDF.load(self.urdf)
            self.fk = self.robot.collision_trimesh_fk()
    
        def setjntpos(self, jntpos):
            assert(len(jntpos)==len(self.robot.actuated_joints))
            config = {}
            for index in range(len(self.robot.actuated_joints)):
                config[self.robot.actuated_joints[index].name] = jntpos[index]
            self.fk  = self.robot.collision_trimesh_fk(cfg=config)
            return config
    
        def getrobotvertices(self, config):
            for i in range(len(list(self.fk.keys()))):
                print(list(self.fk.keys())[i].vertices)
            
    kinematics = Kinematics('robots/ur5/ur5.urdf')
    cfg = kinematics.setjntpos([0.0, -2.0, 2.0, 0.0, 1.0, 0.0])
    kinematics.getrobotvertices(cfg)

The positions of the vertices are not being updated. Is this the right way to use the collision_trimesh_fk API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant