双臂遥操多view
This commit is contained in:
1
deps/XRoboToolkit-Teleop-Sample-Python
vendored
Submodule
1
deps/XRoboToolkit-Teleop-Sample-Python
vendored
Submodule
Submodule deps/XRoboToolkit-Teleop-Sample-Python added at 79e5cb8a56
@@ -74,6 +74,54 @@ from xr_utils import XrClient, transform_xr_pose, quat_diff_as_rotvec_xyzw, is_v
|
|||||||
from xr_utils.geometry import R_HEADSET_TO_WORLD
|
from xr_utils.geometry import R_HEADSET_TO_WORLD
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# Robot Camera Viewport Utilities
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Resolved prim paths for env_0 — must match CameraCfg prim_path with
|
||||||
|
# {ENV_REGEX_NS} → /World/envs/env_0
|
||||||
|
_ROBOT_CAM_PRIMS: dict[str, str] = {
|
||||||
|
"Left Hand": "/World/envs/env_0/Robot/rm_65_fb_left/Link_6/robot___left_8_02/cam_left_hand",
|
||||||
|
"Right Hand": "/World/envs/env_0/Robot/rm_65_b_right/Link6/robot___right_8_2/cam_right_hand",
|
||||||
|
"Head": "/World/envs/env_0/Robot/robot_head/cam_head",
|
||||||
|
"Chest": "/World/envs/env_0/Robot/robot_trunk/cam_chest",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stores created viewport window objects
|
||||||
|
_robot_viewports: dict[str, object] = {}
|
||||||
|
|
||||||
|
|
||||||
|
def create_robot_viewports() -> None:
|
||||||
|
"""Create 4 viewport windows and bind each to a robot camera prim.
|
||||||
|
|
||||||
|
Must be called after env.reset() so all prims exist on the USD stage.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
import omni.kit.viewport.utility as vp_util
|
||||||
|
except ImportError:
|
||||||
|
logger.warning("[Viewport] omni.kit.viewport.utility not available — skipping viewport creation.")
|
||||||
|
return
|
||||||
|
|
||||||
|
for name, cam_path in _ROBOT_CAM_PRIMS.items():
|
||||||
|
vp_win = vp_util.create_viewport_window(
|
||||||
|
f"Robot {name} View", width=640, height=360
|
||||||
|
)
|
||||||
|
vp_win.viewport_api.camera_path = cam_path
|
||||||
|
_robot_viewports[name] = vp_win
|
||||||
|
print(f"[INFO] Viewport 'Robot {name} View' bound to: {cam_path}")
|
||||||
|
|
||||||
|
|
||||||
|
def rebind_robot_viewports() -> None:
|
||||||
|
"""Re-bind all robot viewports to their camera paths.
|
||||||
|
|
||||||
|
Call this after every env reset so viewports stay locked to the cameras.
|
||||||
|
"""
|
||||||
|
for name, vp_win in _robot_viewports.items():
|
||||||
|
cam_path = _ROBOT_CAM_PRIMS[name]
|
||||||
|
vp_win.viewport_api.camera_path = cam_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
# Helpers
|
# Helpers
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
@@ -446,6 +494,11 @@ def main() -> None:
|
|||||||
obs, _ = env.reset()
|
obs, _ = env.reset()
|
||||||
clear_ik_target_state()
|
clear_ik_target_state()
|
||||||
teleop_interface.reset()
|
teleop_interface.reset()
|
||||||
|
|
||||||
|
# Create 4 viewport windows bound to the robot cameras
|
||||||
|
create_robot_viewports()
|
||||||
|
|
||||||
|
|
||||||
if is_dual_arm:
|
if is_dual_arm:
|
||||||
teleop_right_ref.reset()
|
teleop_right_ref.reset()
|
||||||
|
|
||||||
@@ -476,6 +529,7 @@ def main() -> None:
|
|||||||
teleop_interface.reset()
|
teleop_interface.reset()
|
||||||
if is_dual_arm:
|
if is_dual_arm:
|
||||||
teleop_right_ref.reset()
|
teleop_right_ref.reset()
|
||||||
|
rebind_robot_viewports()
|
||||||
should_reset = False
|
should_reset = False
|
||||||
sim_frame = 0
|
sim_frame = 0
|
||||||
last_root_left = None
|
last_root_left = None
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ keywords = ["extension", "template", "isaaclab"]
|
|||||||
"isaaclab_mimic" = {}
|
"isaaclab_mimic" = {}
|
||||||
"isaaclab_rl" = {}
|
"isaaclab_rl" = {}
|
||||||
"isaaclab_tasks" = {}
|
"isaaclab_tasks" = {}
|
||||||
|
"sl.sensor.camera" = {}
|
||||||
# NOTE: Add additional dependencies here
|
# NOTE: Add additional dependencies here
|
||||||
|
|
||||||
[[python.module]]
|
[[python.module]]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from isaaclab.assets import AssetBaseCfg
|
from isaaclab.assets import AssetBaseCfg
|
||||||
from isaaclab.sim.spawners.from_files.from_files_cfg import UsdFileCfg
|
from isaaclab.sim.spawners.from_files.from_files_cfg import UsdFileCfg
|
||||||
|
from isaaclab.sim.schemas.schemas_cfg import CollisionPropertiesCfg
|
||||||
from mindbot.utils.assets import MINDBOT_ASSETS_DIR
|
from mindbot.utils.assets import MINDBOT_ASSETS_DIR
|
||||||
|
|
||||||
|
|
||||||
@@ -11,5 +12,6 @@ TABLE_CFG = AssetBaseCfg(
|
|||||||
),
|
),
|
||||||
spawn=UsdFileCfg(
|
spawn=UsdFileCfg(
|
||||||
usd_path=f"{MINDBOT_ASSETS_DIR}/sences/Table_C_coll/Table_C.usd",
|
usd_path=f"{MINDBOT_ASSETS_DIR}/sences/Table_C_coll/Table_C.usd",
|
||||||
|
collision_props=CollisionPropertiesCfg(collision_enabled=True),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -33,6 +33,7 @@ from isaaclab.sim.schemas.schemas_cfg import RigidBodyPropertiesCfg
|
|||||||
from isaaclab.sim.spawners.from_files.from_files_cfg import GroundPlaneCfg
|
from isaaclab.sim.spawners.from_files.from_files_cfg import GroundPlaneCfg
|
||||||
from isaaclab.sim.spawners.materials import RigidBodyMaterialCfg
|
from isaaclab.sim.spawners.materials import RigidBodyMaterialCfg
|
||||||
from isaaclab.utils import configclass
|
from isaaclab.utils import configclass
|
||||||
|
from isaaclab.envs import ViewerCfg
|
||||||
|
|
||||||
from . import mdp
|
from . import mdp
|
||||||
|
|
||||||
@@ -277,6 +278,11 @@ class MindRobotDualArmIKAbsEnvCfg(ManagerBasedRLEnvCfg):
|
|||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
super().__post_init__()
|
super().__post_init__()
|
||||||
|
|
||||||
|
self.viewer = ViewerCfg(
|
||||||
|
eye=(2.0, -1.5, 1.8), # 相机位置
|
||||||
|
lookat=(0.0, 0.0, 0.8), # 瞄准点(机器人腰部高度附近)
|
||||||
|
origin_type="world",
|
||||||
|
)
|
||||||
self.decimation = 2
|
self.decimation = 2
|
||||||
self.episode_length_s = 50.0
|
self.episode_length_s = 50.0
|
||||||
self.sim.dt = 0.01 # 100 Hz
|
self.sim.dt = 0.01 # 100 Hz
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import os
|
|||||||
##
|
##
|
||||||
MINDBOT_ASSETS_DIR: str = os.environ.get(
|
MINDBOT_ASSETS_DIR: str = os.environ.get(
|
||||||
"MINDBOT_ASSETS_DIR",
|
"MINDBOT_ASSETS_DIR",
|
||||||
"/home/tangger/LYT/maic_usd_assets_moudle",
|
# "/home/tangger/LYT/maic_usd_assets_moudle",
|
||||||
|
"/home/maic/xh/maic_usd_assets_moudle"
|
||||||
# "/home/maic/LYT/maic_usd_assets_moudle",
|
# "/home/maic/LYT/maic_usd_assets_moudle",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user