raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
341 stars 91 forks source link

addArticulatedSystem Joint Order Not Working (Python) #424

Open KianJHocking opened 1 year ago

KianJHocking commented 1 year ago

Trying to get Anymal C URDF from https://github.com/Gepetto/example-robot-data to load into RaiSim with an alternative joint order. The line is being executed and not returning an error, though the joint order appears to not be loading correctly.

########## EXAMPLE CODE ##############

import os import numpy as np import raisimpy as raisim

world = raisim.World() ground = world.addGround()

launch raisim server

server = raisim.RaisimServer(world) port = 8080 server.launchServer(port)

path = os.path.join( os.path.dirname(os.path.abspath(file)), "../../../example-robot-data/robots", ) urdf = path + "/anymal_c_simple_description/urdf/anymal.urdf"

jointOrder = ["LF_HAA", "LF_HFE", "LF_KFE", "LH_HAA", "LH_HFE", "LH_KFE", "RF_HAA", "RF_HFE", "RF_KFE", "RH_HAA", "RH_HFE", "RH_KFE"]

q = np.array([0.0, 0.0, 0.54, 0.0, 0.0, 0.0, 1.0, -0.1, 0.7, -1.0, -0.1, -0.7, 1.0, 0.1, 0.7, -1.0, 0.1, -0.7, 1.0,]) v = np.zeros(18) robot = world.addArticulatedSystem(urdf, "", joint_order=jointOrder) robot.setState(q, v)

input()

server.killServer()

server.launchServer(port) jointOrder = ["LF_HAA", "LF_HFE", "LF_KFE", "RF_HAA", "RF_HFE", "RF_KFE", "LH_HAA", "LH_HFE", "LH_KFE", "RH_HAA", "RH_HFE", "RH_KFE"] robot = world.addArticulatedSystem(urdf, "", joint_order=jointOrder) robot.setState(q, v) print(robot.getFramePosition())

##########################################

Anymal for both of the calls of the addArticulatedSystem(), Anymal loads into RaiSim in the same configuration (but the same q vector is being used so this shouldn't happen). Also, the joint order in the joint state panel on the right hand side of RaiSim also seems to not change order.

I'm aware that a child cannot precede its parent when loading the URDF, though I believe that isn't happening in this case as it is just swapping the LH joints with the RF joints, but the order of the three joints for each leg is maintained.

Any clue what could be going on here?

jhwangbo commented 1 year ago

The joint order doesn't work anymore. I found a few related issue that cannot be resolved soon. You have to manually change the order outside.

wxmerkt commented 1 year ago

Thank you for the quick update and this note Jemin - would it be possible to update the documentation or remove it from there? Thank you! :-)