|
6 | 6 | from rcs.envs.creators import SimEnvCreator |
7 | 7 | from rcs.envs.utils import get_tcp_offset |
8 | 8 | from rcs_xarm7.creators import RCSXArm7EnvCreator, XArm7SimEnvCreator |
9 | | - |
| 9 | +from rcs.hand.tilburg_hand import THConfig |
10 | 10 | import rcs |
11 | 11 | from rcs import sim |
12 | 12 |
|
|
21 | 21 | def main(): |
22 | 22 |
|
23 | 23 | if ROBOT_INSTANCE == RobotPlatform.HARDWARE: |
| 24 | + hand_cfg = THConfig( |
| 25 | + calibration_file="/home/ken/tilburg_hand/calibration.json", |
| 26 | + grasp_percentage=1, |
| 27 | + hand_orientation="right" |
| 28 | + ) |
24 | 29 | env_rel = RCSXArm7EnvCreator()( |
25 | 30 | control_mode=ControlMode.CARTESIAN_TQuat, |
26 | 31 | ip=ROBOT_IP, |
| 32 | + hand_cfg=hand_cfg, |
27 | 33 | relative_to=RelativeTo.LAST_STEP, |
28 | 34 | max_relative_movement=np.deg2rad(3), |
29 | 35 | ) |
@@ -66,21 +72,21 @@ def main(): |
66 | 72 | env_rel.get_wrapper_attr("sim").open_gui() |
67 | 73 |
|
68 | 74 | env_rel.reset() |
69 | | - act = {"tquat": [0.1, 0, 0, 0, 0, 0, 1], "gripper": 0} |
70 | | - obs, reward, terminated, truncated, info = env_rel.step(act) |
| 75 | + # act = {"tquat": [0.1, 0, 0, 0, 0, 0, 1], "gripper": 0} |
| 76 | + # obs, reward, terminated, truncated, info = env_rel.step(act) |
71 | 77 |
|
72 | 78 | with env_rel: |
73 | 79 | for _ in range(10): |
74 | 80 | for _ in range(10): |
75 | 81 | # move 1cm in x direction (forward) and close gripper |
76 | | - act = {"tquat": [0.01, 0, 0, 0, 0, 0, 1], "gripper": 0} |
| 82 | + act = {"tquat": [0.01, 0, 0, 0, 0, 0, 1], "hand": 1} |
77 | 83 | obs, reward, terminated, truncated, info = env_rel.step(act) |
78 | 84 | if truncated or terminated: |
79 | 85 | logger.info("Truncated or terminated!") |
80 | 86 | return |
81 | 87 | for _ in range(10): |
82 | 88 | # move 1cm in negative x direction (backward) and open gripper |
83 | | - act = {"tquat": [-0.01, 0, 0, 0, 0, 0, 1], "gripper": 1} |
| 89 | + act = {"tquat": [-0.01, 0, 0, 0, 0, 0, 1], "hand": 0} |
84 | 90 | obs, reward, terminated, truncated, info = env_rel.step(act) |
85 | 91 | if truncated or terminated: |
86 | 92 | logger.info("Truncated or terminated!") |
|
0 commit comments