Skip to content

Commit

Permalink
utility method to set joint positions of sawyer
Browse files Browse the repository at this point in the history
  • Loading branch information
amandlek committed Mar 9, 2018
1 parent ac980c1 commit fcd1315
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MujocoManip/environment/sawyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def _pre_action(self, action):
bias = 0.5 * (ctrl_range[:,1] + ctrl_range[:,0])
weight = 0.5 * (ctrl_range[:,1] - ctrl_range[:,0])
applied_action = bias + weight * action
print("applied: {}".format(applied_action[7:]))
self.physics.data.ctrl[:] = applied_action

# gravity compensation
Expand Down Expand Up @@ -163,6 +162,12 @@ def pose_in_base_from_name(self, name):
pose_in_base = pose_in_A_to_pose_in_B(pose_in_world, world_pose_in_base)
return pose_in_base

def set_robot_joint_positions(self, jpos):
"""
Helper method to force robot joint positions to the passed values.
"""
with self.physics.reset_context():
self.physics.named.data.qpos[self.mujoco_robot.joints] = jpos

@property
#TODO: fix it
Expand Down

0 comments on commit fcd1315

Please sign in to comment.