-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rollout scripts for MujocoUR5eInsert task.
- Loading branch information
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
robo_manip_baselines/act/bin/rollout/RolloutActMujocoUR5eInsert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from robo_manip_baselines.act import RolloutAct | ||
from robo_manip_baselines.common.rollout import RolloutMujocoUR5eInsert | ||
|
||
|
||
class RolloutActMujocoUR5eInsert(RolloutAct, RolloutMujocoUR5eInsert): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
rollout = RolloutActMujocoUR5eInsert() | ||
rollout.run() |
26 changes: 26 additions & 0 deletions
26
robo_manip_baselines/common/rollout/RolloutMujocoUR5eInsert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import numpy as np | ||
import pinocchio as pin | ||
import gymnasium as gym | ||
from robo_manip_baselines.common import MotionStatus | ||
from .RolloutBase import RolloutBase | ||
|
||
|
||
class RolloutMujocoUR5eInsert(RolloutBase): | ||
def setup_env(self): | ||
self.env = gym.make( | ||
"robo_manip_baselines/MujocoUR5eInsertEnv-v0", render_mode="human" | ||
) | ||
|
||
def set_arm_command(self): | ||
if self.data_manager.status in (MotionStatus.PRE_REACH, MotionStatus.REACH): | ||
target_pos = self.env.unwrapped.get_body_pose("peg")[0:3] | ||
if self.data_manager.status == MotionStatus.PRE_REACH: | ||
target_pos[2] = 1.1 # [m] | ||
elif self.data_manager.status == MotionStatus.REACH: | ||
target_pos[2] = 1.03 # [m] | ||
self.motion_manager.target_se3 = pin.SE3( | ||
np.diag([-1.0, 1.0, -1.0]), target_pos | ||
) | ||
self.motion_manager.inverse_kinematics() | ||
else: | ||
super().set_arm_command() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
robo_manip_baselines/diffusion_policy/bin/rollout/RolloutDiffusionPolicyMujocoUR5eInsert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from robo_manip_baselines.diffusion_policy import RolloutDiffusionPolicy | ||
from robo_manip_baselines.common.rollout import RolloutMujocoUR5eInsert | ||
|
||
|
||
class RolloutDiffusionPolicyMujocoUR5eInsert( | ||
RolloutDiffusionPolicy, RolloutMujocoUR5eInsert | ||
): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
rollout = RolloutDiffusionPolicyMujocoUR5eInsert() | ||
rollout.run() |
11 changes: 11 additions & 0 deletions
11
robo_manip_baselines/sarnn/bin/rollout/RolloutSarnnMujocoUR5eInsert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from robo_manip_baselines.sarnn import RolloutSarnn | ||
from robo_manip_baselines.common.rollout import RolloutMujocoUR5eInsert | ||
|
||
|
||
class RolloutSarnnMujocoUR5eInsert(RolloutSarnn, RolloutMujocoUR5eInsert): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
rollout = RolloutSarnnMujocoUR5eInsert() | ||
rollout.run() |