Open
Description
Hi. I was testing your interface and found some errors. I hope this helps someone who is having trouble with velocity or torque control.
- Typo in "pybullet_robot_joints.py" : You have to change 'targetVelocity' to 'targetVelocities' in the "set target" function for the "Joints" class to make the velocity control work.
- Unlock motors for torque control : You first have to unlock the joint motors with position/velocity control before force control. Unless, it will not move. You can see this issue at this link. I know this is not a good way, but I used an additional flag and changed the code like below just for fast testing.
def set_target(self, joint_state_msg):
# Set target
if self.control_mode == self.pb_obj.pb.POSITION_CONTROL:
target = {'targetPositions': joint_state_msg.position}
elif self.control_mode == self.pb_obj.pb.VELOCITY_CONTROL:
target = {'targetVelocities': joint_state_msg.velocity}
elif self.control_mode == self.pb_obj.pb.TORQUE_CONTROL:
target = {'forces': joint_state_msg.effort}
if self.init_flag:
self.pb_obj.pb.setJointMotorControlArray(
self.pb_obj.body_unique_id,
[i for i in range(self.num_joints)],
self.pb_obj.pb.VELOCITY_CONTROL,
forces=[0]*self.num_joints
)
self.init_flag = False
else:
raise ValueError("did not recognize control mode!")
Metadata
Metadata
Assignees
Labels
No labels