krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
377 stars 96 forks source link

OmniRobotInterface _emulator.commandedTorque is initialized to None #136

Closed ShaoxiongYao closed 2 years ago

ShaoxiongYao commented 2 years ago

Testing on branch 0.9

When I run klampt_control ur5_with_robotiq85_sim.json, error happens in class OmniRobotInterface.

In klampt/control/robotinterfaceutils.py, in class RobotInterfaceEmulator, the method initialize will set self.jointData.commandedTorque to None in lines:

if tcmd is not None: j.commandedTorque = tcmd[i]

This will cause a problem when beginStep() is called again and self._updateStateFromEmulator('commandedTorque') is executed, which will raise an error on [None,...,None] value of commandedPosition.

I try to initialize the torque value to 0 and it works for this example.

krishauser commented 2 years ago

Should be fixed with latest commit.