Skip to content

Commit a93473f

Browse files
author
liu.ning@northeastern.edu
committed
update ros2 reply and model switch mode with configuration file
1 parent d66ec77 commit a93473f

4 files changed

Lines changed: 856 additions & 1 deletion

File tree

deployment/config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ROS2 Inspire Policy Agent Configuration
2+
# Mode: 'model' for model inference, 'replay' for HDF5 action replay
3+
4+
# Operation mode: 'model' or 'replay'
5+
mode: 'model' # Change to 'replay' to use HDF5 action replay
6+
7+
# Model inference configuration (used when mode='model')
8+
model_path: '/home/ubuntu/neil/pick_up_apple/checkpoints/300000/pretrained_model'
9+
10+
# HDF5 replay configuration (used when mode='replay')
11+
h5_path: '/media/jushen/neil-liu/dataNmodels/h5_data/trajectory.hdf5'
12+
13+
# Camera configuration
14+
camera_name: 'camera'
15+
16+
# Action publishing rate (Hz)
17+
action_rate: 20.0
18+

deployment/readme.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,64 @@ def publish_action(self, action):
3939
right_hand_pos = action[20:26] # right hand 6
4040
```
4141

42-
42+
43+
44+
45+
# Deployment Scripts
46+
47+
- `ros2_inspire_config.py`: Deployment script for robots using **Inspire** hands.
48+
- `ros2_brainco_config.py`: Deployment script for robots using **BrainCo** hands.
49+
50+
## Usage
51+
52+
Both scripts support a YAML configuration file to define runtime parameters.
53+
54+
### Execution Command
55+
56+
```bash
57+
# For Inspire hand robots
58+
python3 ros2_inspire_config.py --config config.yaml
59+
60+
# For BrainCo hand robots
61+
python3 ros2_brainco_config.py --config config.yaml
62+
```
63+
64+
If the `--config` parameter is omitted, scripts default to `config.yaml` in the current directory.
65+
66+
## Configuration File
67+
68+
### Configuration Guide (YAML)
69+
70+
The configuration file allows switching between model inference and data replay modes, and configuring hardware-specific parameters.
71+
72+
```yaml
73+
# Mode: 'model' (for real-time inference) or 'replay' (for trajectory playback)
74+
mode: 'model'
75+
76+
# --- Model Inference Mode ---
77+
# Path to the pretrained model
78+
model_path: '/path/to/your/pretrained_model'
79+
80+
# --- Data Replay Mode ---
81+
# Path to the HDF5 trajectory file
82+
h5_path: '/path/to/your/trajectory.hdf5'
83+
84+
# --- General Configuration ---
85+
# Camera name (used for image topics like /{camera_name}/color/image_raw)
86+
camera_name: 'camera'
87+
# Action publishing rate (Hz)
88+
action_rate: 20.0
89+
90+
```
91+
92+
## Operation Modes
93+
94+
1. **Model Inference (`model`)**:
95+
- Loads the specified strategy model.
96+
- Synchronizes RGB and Depth image streams.
97+
- Performs real-time inference and publishes joint actions to arm and hand controllers.
98+
99+
2. **Data Replay (`replay`)**:
100+
- Reads action sequences from the specified HDF5 file.
101+
- Streams actions to hardware at the specified `action_rate`.
102+
- Useful for verifying hardware communication and trajectory execution.

0 commit comments

Comments
 (0)