Skip to content

Commit 2a254dc

Browse files
committed
feat: adds digital twin and quest frame aligner
1 parent 1eeaaf1 commit 2a254dc

File tree

4 files changed

+29
-22
lines changed

4 files changed

+29
-22
lines changed

python/rcs/envs/sim.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ class DigitalTwin(gym.Wrapper):
455455
def __init__(self, env, twin_env):
456456
super().__init__(env)
457457
self.twin_env = twin_env
458-
assert self.twin_env.unwrapped.get_control_mode() == ControlMode.JOINTS
459458

460459

461460
def step(self, action):

python/rcs/envs/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from os import PathLike
33

44
from digit_interface import Digit
5+
from rcs._core import common
56
from rcs._core.common import BaseCameraConfig
67
from rcs._core.sim import CameraType, SimCameraConfig
78
from rcs.camera.digit_cam import DigitCam
@@ -17,6 +18,7 @@
1718
def default_sim_robot_cfg(scene: str = "fr3_empty_world", idx: str = "0") -> sim.SimRobotConfig:
1819
robot_cfg = rcs.sim.SimRobotConfig()
1920
robot_cfg.robot_type = rcs.scenes[scene].robot_type
21+
robot_cfg.tcp_offset = common.Pose(common.FrankaHandTCPOffset())
2022
robot_cfg.add_id(idx)
2123
if rcs.scenes[scene].mjb is not None:
2224
robot_cfg.mjcf_scene_path = rcs.scenes[scene].mjb

scripts/quest_align_frame.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from simpub.xr_device.meta_quest3 import MetaQuest3
2+
from quest_iris_dual_arm import MySimPublisher, MySimScene, MQ3_ADDR
3+
4+
5+
MySimPublisher(MySimScene(), MQ3_ADDR)
6+
reader = MetaQuest3("RCSNode")
7+
while True:
8+
data = reader.get_controller_data()
9+
print(data)

scripts/quest_iris_dual_arm.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
INCLUDE_ROTATION = True
4141
ROBOT2IP = {
42-
# "left": "192.168.102.1",
43-
"right": "192.168.102.1",
42+
"right": "192.168.101.1",
43+
"left": "192.168.102.1",
4444
}
4545

4646

@@ -85,7 +85,7 @@ def __init__(self, env: RelativeActionSpace):
8585
self._env_lock = threading.Lock()
8686
self._env = env
8787

88-
self.controller_names = ["right"] # , "right"]
88+
self.controller_names = ["left", "right"]
8989
self._trg_btn = {"left": "index_trigger", "right": "index_trigger"}
9090
self._grp_btn = {"left": "hand_trigger", "right": "hand_trigger"}
9191
self._start_btn = "A"
@@ -297,24 +297,21 @@ def main():
297297
relative_to=RelativeTo.CONFIGURED_ORIGIN,
298298
)
299299
env_rel = StorageWrapper(env_rel, DATASET_PATH, INSTRUCTION, batch_size=32, max_rows_per_group=100, max_rows_per_file=1000)
300-
MySimPublisher(MySimScene(), MQ3_ADDR)
301-
302-
# robot_cfg = default_sim_robot_cfg("fr3_empty_world")
303-
# sim_cfg = SimConfig()
304-
# sim_cfg.async_control = True
305-
# twin_env, sim = SimMultiEnvCreator()(
306-
# name2id=ROBOT2IP,
307-
# robot_cfg=robot_cfg,
308-
# control_mode=ControlMode.CARTESIAN_TQuat,
309-
# gripper_cfg=default_sim_gripper_cfg(),
310-
# # cameras=default_mujoco_cameraset_cfg(),
311-
# max_relative_movement=0.5,
312-
# relative_to=RelativeTo.CONFIGURED_ORIGIN,
313-
# sim_cfg=sim_cfg,
314-
# )
315-
# sim.open_gui()
316-
# MujocoPublisher(sim.model, sim.data, MQ3_ADDR, visible_geoms_groups=list(range(1, 3)))
317-
# env_rel = DigitalTwin(env_rel, twin_env)
300+
# MySimPublisher(MySimScene(), MQ3_ADDR)
301+
302+
robot_cfg = default_sim_robot_cfg("fr3_empty_world")
303+
sim_cfg = SimConfig()
304+
sim_cfg.async_control = True
305+
twin_env, sim = SimMultiEnvCreator()(
306+
name2id=ROBOT2IP,
307+
robot_cfg=robot_cfg,
308+
control_mode=ControlMode.JOINTS,
309+
gripper_cfg=default_sim_gripper_cfg(),
310+
sim_cfg=sim_cfg,
311+
)
312+
sim.open_gui()
313+
MujocoPublisher(sim.model, sim.data, MQ3_ADDR, visible_geoms_groups=list(range(1, 3)))
314+
env_rel = DigitalTwin(env_rel, twin_env)
318315

319316

320317
else:

0 commit comments

Comments
 (0)