|
4 | 4 | from enum import IntFlag, auto |
5 | 5 | from socket import AF_INET, SOCK_DGRAM, socket |
6 | 6 | from struct import unpack |
7 | | -from time import sleep |
| 7 | +import rcsss |
8 | 8 | from rcsss.camera.interface import SimpleFrameRate |
9 | 9 | from rcsss.camera.realsense import RealSenseCameraSet |
10 | 10 |
|
|
42 | 42 | INCLUDE_ROTATION = True |
43 | 43 | ROBOT_IP = "192.168.101.1" |
44 | 44 | ROBOT_INSTANCE = RobotInstance.HARDWARE |
45 | | -DEBUG = True |
46 | | -STORAGE_PATH = "teleop_data" |
| 45 | +RECORD_FPS = 15 |
47 | 46 | # set camera dict to none disable cameras |
48 | 47 | CAMERA_DICT = { |
49 | 48 | # "wrist": "244222071045", |
@@ -217,24 +216,23 @@ def environment_step_loop(self): |
217 | 216 |
|
218 | 217 | with self._env_lock: |
219 | 218 | self._env.step(action) |
220 | | - rate_limiter(0.001) |
| 219 | + rate_limiter(RECORD_FPS) |
221 | 220 |
|
222 | 221 |
|
223 | 222 | def input_loop(env_rel, action_server: UDPViveActionServer, camera_set: RealSenseCameraSet | None): |
224 | 223 | while True: |
225 | | - i = input("> ") |
| 224 | + i = input("press enter to start recording, 'q' to stop, 'h' to move to home: ") |
226 | 225 | match i: |
227 | | - case "help": |
228 | | - print("You can use `quit` to stop the program, `episode` to start a new episode") |
229 | | - case "quit": |
| 226 | + case "q": |
230 | 227 | sys.exit(0) |
231 | | - case "episode": |
| 228 | + case "h": |
| 229 | + env_rel.unwrapped.robot.move_home() |
| 230 | + case _: |
232 | 231 | # record videos |
233 | 232 | if camera_set is not None: |
234 | 233 | video_path = env_rel.path / "videos" |
235 | 234 | video_path.mkdir(parents=True, exist_ok=True) |
236 | | - camera_set.record_video(env_rel.path / "videos", f"{env_rel.key}_{env_rel.timestamp}_{env_rel.episode_count}") |
237 | | - print(f'{env_rel.episode_count = }') |
| 235 | + camera_set.record_video(video_path, f"{env_rel.key}_{env_rel.timestamp}_{env_rel.episode_count}") |
238 | 236 |
|
239 | 237 | thread = threading.Thread(target=action_server.environment_step_loop) |
240 | 238 | thread.start() |
@@ -265,8 +263,7 @@ def main(): |
265 | 263 | control_mode=ControlMode.CARTESIAN_TQuart, |
266 | 264 | # control_mode=ControlMode.JOINTS, |
267 | 265 | gripper_cfg=default_fr3_hw_gripper_cfg(async_control=True), |
268 | | - max_relative_movement=(0.01, np.deg2rad(1)), |
269 | | - # max_relative_movement=(0.5, np.deg2rad(90)), |
| 266 | + max_relative_movement=(0.5, np.deg2rad(90)), |
270 | 267 | # max_relative_movement=np.deg2rad(20), |
271 | 268 | relative_to=RelativeTo.CONFIGURED_ORIGIN, |
272 | 269 | ) |
|
0 commit comments