激活机器人
检查配置文件
请检查本地残差强化学习端侧目录/hil-residual-rl/experiments/place_upright/config.yaml配置文件是否正确填写机械臂夹爪端口、相机端口、实验信息等配置信息。
以抓航插的实验为例,配置如下:
# ============ 实验配置 ============
experiment:
# 随机种子
seed: 42
# 任务指令 (发送给云端)
instruction: "Pick up the blue aviation plug, and place it upright on the sponge pad on the right"
# 成功演示数量阈值 (达到后停止采集)
successes_needed: 2
# 最大 episode 数量 (超过后停止采集)
max_episode_num: 50
# 最大 episode 长度
max_episode_length: 1000
# 输出目录
output: "./test_output"
# 跳步:每 jump_step 步执行一次 action
jump_step: 2
# 动作缩放
action_scalar: [0.01, 0.01, 0.01, 0.05, 0.05, 0.05]
# 环境频率
# frequency: 20
frequency: 1
# 图像裁剪配置
# 启用 IMAGE_CROP 会使可视化时显示更多视图 (n_physical_cameras * 2)
image_crop:
base_camera: "lambda img: img[:,:]"
# ============ 机器人配置 ============
robot:
type: ur5e
ip: 192.168.5.152
obs_latency: 0.0001
action_latency: 0.1
tcp_offset: 0.235
# R2C Bundle 路径 (用于连接云端)
r2c_bundle: "/xxx/hil-residual-rl/r2c_certification/cert_config_UR5_PWD_TEST_20260813152414.zip"
# ============ 相机配置 ============
# 获取相机序列号,一般在机身底部或背面
realsense_cameras:
wrist_camera:
serial_number: "045322075954"
dim: [640, 360]
exposure: 10500
base_camera:
serial_number: "134222076113"
dim: [640, 360]
exposure: 10500
# ============ 姿态配置 ============
# 以下姿态为抓放航插实验使用的姿态,不同实验可按需修改
# 目标姿态 (x, y, z, rx, ry, rz)
target_pose: [0.69, -0.42, 0.20, 2.30, -2.58, 1.0]
# 复位姿态
reset_pose: [0.70, 0.0, 0.08, 2.213, -2.256, -0.14]
# 初始姿态
initial_pose: [0.55, 0.0, 0.30, -1.755, 1.92, -0.608]
# 复位持续时间 (秒)
reset_duration: 3
# ============ 随机复位配置 ============
random_reset: true
random_xy_range: 0.15
random_rz_range: 1
# ============ 动作空间限制 ============
# 绝对姿态限制上界
abs_pose_limit_high: [0.89, 0.18, 0.50, 4.30, -0.58, 1.30]
# 绝对姿态限制下界
abs_pose_limit_low: [0.39, -0.52, 0.02, 0.00, -4.58, 0.70]
# ============ 夹爪配置 ============
gripper:
type: dh
port: /dev/ttyUSBDH_
obs_latency: 0.01
action_latency: 0.1 建议修改的配置参数如表1。
| 参数 | 说明 |
|---|---|
experiment.instruction | 任务指令 |
experiment.successes_needed | 成功演示数量阈值(达到后停止程序) |
experiment.max_episode_num | 最大episode(超过后停止采集) |
experiment.max_episode_length | 单条轨迹最大长度(超过算失败轨迹) |
experiment.jump_step | 跳步数(默认为2,执行index 0,2,4,6的action) |
robot.r2c_bundle | 机器人R2C证书存放路径 |
robot.type | 机器人型号(默认为ur5e) |
robot.ip | 机器人的局域网IP,可通过机器人控制面板查看 |
robot.realsense_cameras.wrist_camera.serial_number | 相机序列号,一般在机身底部或背面 |
robot.realsense_cameras.wrist_camera.dim | 相机拍摄图像[H,W] |
robot.realsense_cameras.wrist_camera.exposure | 相机曝光 |
启动端侧采集脚本
启动端侧脚本时,如果下载的证书文件 r2c_bundle是带私钥的,脚本执行过程中会提示用户输入密码,如果不带私钥,则会自动连接上云。
conda activate hil-residual-rl cd hil-residual-rl python src/env_worker/residual_intervene_chunk_record.py --experiment_name place_upright
启动后日志
启动后日志如下所示。r2c成功连接到CloudRobo平台后,机器人状态由“待激活”变更为“在线”,即可以开始调试该机器人。
2026-07-17 11:17:33,525 - [INFO] - ============================================================
2026-07-17 11:17:33,525 - [INFO] - Residual 干预 Chunk 记录模式
2026-07-17 11:17:33,525 - [INFO] - ============================================================
2026-07-17 11:17:33,529 - [INFO] - Experiment: place_upright
2026-07-17 11:17:33,529 - [INFO] - Output: ./test_output
2026-07-17 11:17:33,529 - [INFO] - R2C Bundle: /home/test/r2c_ur5e_pwd_test.zip
2026-07-17 11:17:33,529 - [INFO] - Instruction: Pick up the blue aviation plug, and place it upright on the sponge pad on the right
2026-07-17 11:17:33,529 - [INFO] - Successes needed: 2
2026-07-17 11:17:33,529 - [INFO] - Max episodes: 50
2026-07-17 11:17:33,529 - [INFO] - Demo data will be saved to: ./test_output/demos_20260717_111733
2026-07-17 11:17:33,529 - [INFO] - ==================================================
2026-07-17 11:17:33,529 - [INFO] - Initializing REAL environment with wrappers
2026-07-17 11:17:33,529 - [INFO] - ==================================================
Gym has been unmaintained since 2022 and does not support NumPy 2.0 amongst other critical functionality.
Please upgrade to Gymnasium, the maintained drop-in replacement of Gym, or contact the authors of your software and request that they upgrade.
Users of this version of Gym should be able to simply replace 'import gym' with 'import gymnasium as gym' in the vast majority of cases.
See the migration guide at https://gymnasium.farama.org/introduction/migration_guide/ for additional information.
2026-07-17 11:17:33,798 - [INFO] - Initializing environment: place_upright
2026-07-17 11:17:33,798 - [INFO] - Connecting to REAL robot...
2026-07-17 11:17:33.804 | INFO | robot_infra.envs.ur5e_env:__init__:147 - In UR5eEnv, observation space is Dict('base_camera': Box(0, 255, (224, 224, 3), uint8), 'robot0_eef_pos': Box(-inf, inf, (3,), float32), 'robot0_eef_rot_axis_angle': Box(-inf, inf, (3,), float32), 'robot0_gripper_width': Box(-inf, inf, (1,), float32), 'robot0_tcp_vel': Box(-inf, inf, (6,), float32), 'robot_tcp_force': Box(-inf, inf, (6,), float32), 'timestamp': Box(-inf, inf, (1,), float32), 'wrist_camera': Box(0, 255, (224, 224, 3), uint8)), action space is Box(-1.0, 1.0, (7,), float32)
[BimanualUmiRsEnv] Detected connected RealSense devices: ['045322075954', '134222076113']
[BimanualUmiRsEnv] Initializing MultiRealsense with serial numbers: ['134222076113', '045322075954']
[BimanualUmiRsEnv] Camera logical name to internal index mapping: {'base_camera': 0, 'wrist_camera': 1}
[MultiRealsense] Starting camera 134222076113, is_alive=False, pid=None
[MultiRealsense] Starting camera 045322075954, is_alive=False, pid=None
robot_ip 192.168.5.152
[DHController] Controller process spawned at 4029077
Serial Open Success
open successful
Send grip init
SpaceMouse Compact found
==============Keyboard Usage=================
Positional movements in base frame
q (- z-axis) w (- x-axis) e (+ z-axis)
a (- y-axis) s (+ x-axis) d (+ y-axis)
Rotational movements in base frame
u (- z-axis-rot) i (neg y-axis-rot) o (+ z-axis)
j (pos x-axis-rot) k (pos y-axis-rot) l (neg x-axis-rot)
Toggle gripper open and close
z
t (success) y (success record) n (fail)
` (skill complete) r (reset) p (paused) c (continue) b (undo)
===============================
env observation space is Dict('base_camera': Box(0, 255, (224, 224, 3), uint8), 'robot0_eef_pos': Box(-inf, inf, (3,), float32), 'robot0_eef_rot_axis_angle': Box(-inf, inf, (3,), float32), 'robot0_gripper_width': Box(-inf, inf, (1,), float32), 'robot0_tcp_vel': Box(-inf, inf, (6,), float32), 'robot_tcp_force': Box(-inf, inf, (6,), float32), 'timestamp': Box(-inf, inf, (1,), float32), 'wrist_camera': Box(0, 255, (224, 224, 3), uint8)), action space is Box(-1.0, 1.0, (7,), float32)
2026-07-17 11:17:44,466 - [INFO] - Observation space: Dict('base_camera': Box(0, 255, (224, 224, 3), uint8), 'robot0_eef_pos': Box(-inf, inf, (3,), float32), 'robot0_eef_rot_axis_angle': Box(-inf, inf, (3,), float32), 'robot0_gripper_width': Box(-inf, inf, (1,), float32), 'robot0_tcp_vel': Box(-inf, inf, (6,), float32), 'robot_tcp_force': Box(-inf, inf, (6,), float32), 'timestamp': Box(-inf, inf, (1,), float32), 'wrist_camera': Box(0, 255, (224, 224, 3), uint8))
2026-07-17 11:17:44,468 - [INFO] - Action space: Box(-1.0, 1.0, (7,), float32)
2026-07-17 11:17:44,468 - [INFO] - ============================================================
2026-07-17 11:17:44,468 - [INFO] - Step 2: Connecting to R2C Router
2026-07-17 11:17:44,468 - [INFO] - ============================================================
2026-07-17 11:17:44,468 - [INFO] - Connecting to R2C Router with bundle: /home/test/r2c_ur5e_pwd_test.zip
2026-07-17 11:17:44,692 - [INFO] - Connected to R2C Router successfully
2026-07-17 11:17:44,692 - [INFO] - Preparing the gripper
2026-07-17 11:17:47,695 - [INFO] - Resetting environment...
2026-07-17 11:17:47.700 | INFO | experiments.place_upright.place_upright:reset:139 - current pose is [ 5.49989174e-01 -1.99375846e-05 2.99997588e-01 -1.75503336e+00
1.92001677e+00 -6.08062227e-01], gripper: [0.08]
Gym Environment Resetted. New episode started.
entering go to reset
2026-07-17 11:17:50.705 | INFO | experiments.place_upright.place_upright:go_to_reset:164 - Reset pose (with random offset): [ 0.74626405 -0.00469021 0.08 2.213 -2.256 -0.14 ]
2026-07-17 11:17:55.709 | INFO | experiments.place_upright.place_upright:go_to_reset:167 - Initial pose: [ 0.55 0. 0.3 -1.755 1.92 -0.608]
2026-07-17 11:17:58,813 - [INFO] - Reset done!
2026-07-17 11:17:58,823 - [INFO] - Published observation, episode_id=0
2026-07-17 11:17:58,823 - [INFO] - Sent observation, waiting for cloud inference...