Commit d75e7ff6 authored by Mayank Mittal's avatar Mayank Mittal

fixes bug in flipping gripper commands in demo scripts

parent 8c8f8d63
...@@ -138,9 +138,10 @@ def main(): ...@@ -138,9 +138,10 @@ def main():
actions[:, -1] = -1 actions[:, -1] = -1
print("[INFO]: Resetting robots state...") print("[INFO]: Resetting robots state...")
# change the gripper action # change the gripper action
if ep_step_count % 200 and has_gripper: if ep_step_count % 200 == 0 and has_gripper:
# flip command for the gripper # flip command for the gripper
actions[:, -1] = -actions[:, -1] actions[:, -1] = -actions[:, -1]
print(f"[INFO]: [Step {ep_step_count:03d}]: Flipping gripper command...")
# apply action to the robot # apply action to the robot
robot.apply_action(actions) robot.apply_action(actions)
# perform step # perform step
......
...@@ -163,7 +163,7 @@ def main(): ...@@ -163,7 +163,7 @@ def main():
actions[:, -1] = -1 actions[:, -1] = -1
print("[INFO]: Resetting robots state...") print("[INFO]: Resetting robots state...")
# change the gripper action # change the gripper action
if ep_step_count % 200 and has_gripper: if ep_step_count % 50 == 0 and has_gripper:
# flip command for the gripper # flip command for the gripper
actions[:, -1] = -actions[:, -1] actions[:, -1] = -actions[:, -1]
# apply actions # apply actions
......
...@@ -130,7 +130,7 @@ def main(): ...@@ -130,7 +130,7 @@ def main():
actions[:, -1] = 1 actions[:, -1] = 1
print(">>>>>>>> Reset! Opening gripper.") print(">>>>>>>> Reset! Opening gripper.")
# change the gripper action # change the gripper action
if ep_step_count % 200: if ep_step_count % 200 == 0:
# flip command # flip command
actions[:, -1] = -actions[:, -1] actions[:, -1] = -actions[:, -1]
# change the base action # change the base action
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment