Skip to content

Commit cf96632

Browse files
committed
add front camera for ioai grasp env
1 parent bef0ce6 commit cf96632

1 file changed

Lines changed: 69 additions & 8 deletions

File tree

examples/ioai_examples/ioai_grasp_env.py

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
PhysicsSimulatorConfig,
3434
RobotConfig,
3535
MeshConfig,
36-
CuboidConfig
36+
CuboidConfig,
37+
RgbCameraConfig,
38+
RealsenseD436RgbSensorConfig,
39+
DepthCameraConfig,
40+
RealsenseD436DepthSensorConfig
3741
)
3842
from physics_simulator.galbot_interface import GalbotInterface, GalbotInterfaceConfig
3943
import mink
@@ -43,6 +47,7 @@
4347
import numpy as np
4448
from physics_simulator.utils.data_types import JointTrajectory
4549
import time
50+
import os
4651

4752
from physics_simulator.utils.state_machine import SimpleStateMachine
4853

@@ -107,6 +112,58 @@ def _setup_simulator(self, headless=False):
107112
self.simulator.add_robot(robot_config)
108113
self.robot = self.simulator.get_robot("/World/Galbot")
109114

115+
# Add front head RGB camera (RealSense D405)
116+
front_head_rgb_camera_config = RgbCameraConfig(
117+
name="front_head_rgb_camera",
118+
prim_path=os.path.join(
119+
self.robot.prim_path,
120+
"head_link2",
121+
"head_end_effector_mount_link",
122+
"front_head_rgb_camera",
123+
),
124+
translation=[
125+
0.10084319533055261,
126+
-0.059042081352783105,
127+
0.03184978861787491
128+
],
129+
rotation=[
130+
-0.1654571792421115,
131+
0.6935589352367344,
132+
0.16457378953789606,
133+
0.6815536611211676
134+
],
135+
camera_axes="ros",
136+
sensor_config=RealsenseD436RgbSensorConfig(),
137+
parent_entity_name="galbot_one_foxtrot/head_end_effector_mount_link"
138+
)
139+
self.front_head_rgb_camera_path = self.simulator.add_sensor(front_head_rgb_camera_config)
140+
141+
# Add front head depth camera (RealSense D436)
142+
front_head_depth_camera_config = DepthCameraConfig(
143+
name="front_head_depth_camera",
144+
prim_path=os.path.join(
145+
self.robot.prim_path,
146+
"head_link2",
147+
"head_end_effector_mount_link",
148+
"front_head_depth_camera",
149+
),
150+
translation=[
151+
0.10084319533055261,
152+
-0.059042081352783105,
153+
0.03184978861787491
154+
],
155+
rotation=[
156+
-0.1654571792421115,
157+
0.6935589352367344,
158+
0.16457378953789606,
159+
0.6815536611211676
160+
],
161+
camera_axes="ros",
162+
sensor_config=RealsenseD436DepthSensorConfig(),
163+
parent_entity_name="galbot_one_foxtrot/head_end_effector_mount_link"
164+
)
165+
self.front_head_depth_camera_path = self.simulator.add_sensor(front_head_depth_camera_config)
166+
110167
# Add table
111168
table_config = MeshConfig(
112169
prim_path="/World/Table",
@@ -165,7 +222,7 @@ def _setup_interface(self):
165222
galbot_interface_config.modules_manager.enabled_modules.append("left_arm")
166223
galbot_interface_config.modules_manager.enabled_modules.append("leg")
167224
galbot_interface_config.modules_manager.enabled_modules.append("head")
168-
# galbot_interface_config.modules_manager.enabled_modules.append("chassis")
225+
galbot_interface_config.modules_manager.enabled_modules.append("chassis")
169226
galbot_interface_config.modules_manager.enabled_modules.append("left_gripper")
170227
galbot_interface_config.modules_manager.enabled_modules.append("right_gripper")
171228

@@ -201,11 +258,11 @@ def _setup_interface(self):
201258
f"{robot_name}/head_joint2"
202259
]
203260

204-
# galbot_interface_config.chassis.joint_names = [
205-
# f"{robot_name}/mobile_forward_joint",
206-
# f"{robot_name}/mobile_side_joint",
207-
# f"{robot_name}/mobile_yaw_joint",
208-
# ]
261+
galbot_interface_config.chassis.joint_names = [
262+
f"{robot_name}/mobile_forward_joint",
263+
f"{robot_name}/mobile_side_joint",
264+
f"{robot_name}/mobile_yaw_joint",
265+
]
209266

210267
galbot_interface_config.left_gripper.joint_names = [
211268
f"{robot_name}/left_gripper_r_knuckle_joint",
@@ -215,6 +272,11 @@ def _setup_interface(self):
215272
f"{robot_name}/right_gripper_r_knuckle_joint",
216273
]
217274

275+
# Enable the front camera modules
276+
galbot_interface_config.modules_manager.enabled_modules.append("front_head_camera")
277+
galbot_interface_config.front_head_camera.prim_path_rgb = self.front_head_rgb_camera_path
278+
galbot_interface_config.front_head_camera.prim_path_depth = self.front_head_depth_camera_path
279+
218280
galbot_interface = GalbotInterface(
219281
galbot_interface_config=galbot_interface_config,
220282
simulator=self.simulator
@@ -223,7 +285,6 @@ def _setup_interface(self):
223285

224286
self.interface = galbot_interface
225287

226-
227288
def _setup_mink(self):
228289
"""
229290
Initialize Mink IK solver configuration.

0 commit comments

Comments
 (0)