Download scripts/test_maniskill_6dof_7dof.py from codewithyug/certified-safe-neural-control: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/codewithyug/certified-safe-neural-control/resolve/main/scripts/test_maniskill_6dof_7dof.py
- Command line
-
hf download hf://codewithyug/certified-safe-neural-control/scripts/test_maniskill_6dof_7dof.py
-
curl -L -o test_maniskill_6dof_7dof.py https://huggingface.co/codewithyug/certified-safe-neural-control/resolve/main/scripts/test_maniskill_6dof_7dof.py
1.69 kB
| """ | |
| Test instantiating both 6-DoF and 7-DoF robots in ManiSkill 3 | |
| """ | |
| import gymnasium as gym | |
| import mani_skill.envs | |
| print("=" * 70) | |
| print("TESTING 7-DoF ROBOT (Franka Panda)") | |
| print("=" * 70) | |
| try: | |
| env_7dof = gym.make( | |
| "PickCube-v1", | |
| robot_uids="panda", | |
| obs_mode="state", | |
| control_mode="pd_joint_pos", | |
| sim_backend="cpu", | |
| render_backend="cpu", | |
| ) | |
| obs_7, _ = env_7dof.reset() | |
| robot_7 = env_7dof.unwrapped.agent.robot | |
| print(f"[+] 7-DoF Robot UID: {env_7dof.unwrapped.agent.uid}") | |
| print(f"[+] Active DoF count: {robot_7.dof.item() if hasattr(robot_7.dof, 'item') else robot_7.dof}") | |
| print(f"[+] Action space: {env_7dof.action_space}") | |
| env_7dof.close() | |
| except Exception as e: | |
| print(f"[!] Error with 7-DoF Panda: {e}") | |
| print("\n" + "=" * 70) | |
| print("TESTING 6-DoF ROBOT (UR5e / xArm6 / WidowX)") | |
| print("=" * 70) | |
| # Let's try available 6-dof robot uids: ur5e, xarm6, widowx | |
| for uid in ["ur5e", "xarm6", "widowx", "ur_e", "so100"]: | |
| try: | |
| env_6dof = gym.make( | |
| "PickCube-v1", | |
| robot_uids=uid, | |
| obs_mode="state", | |
| control_mode="pd_joint_pos", | |
| sim_backend="cpu", | |
| render_backend="cpu", | |
| ) | |
| obs_6, _ = env_6dof.reset() | |
| robot_6 = env_6dof.unwrapped.agent.robot | |
| print(f"[+] 6-DoF Robot UID '{uid}' instantiated successfully!") | |
| print(f"[+] Active DoF count: {robot_6.dof.item() if hasattr(robot_6.dof, 'item') else robot_6.dof}") | |
| print(f"[+] Action space: {env_6dof.action_space}") | |
| env_6dof.close() | |
| break | |
| except Exception as e: | |
| print(f"[-] UID '{uid}' failed: {e}") | |