# Qnbot Exo Std - Demo Workspace

Qnbot exoskeleton teleoperation demo project, demonstrating exoskeleton data reception, visualization, and robot control mapping.

## Package Structure

This workspace contains three ROS2 packages:

### 1. interface_protocol
**Message Interface Definitions**

Defines custom message types required by the exoskeleton system:
- `ExoFullState.msg` - Exoskeleton full state (joints + dual IMU + reset flags)
- `ImuInfo.msg` - IMU data (quaternion, Euler angles, acceleration, angular velocity)
- `JointCommand.msg` - Joint command
- `JointState.msg` - Joint state
- `HandCommand.msg` - Hand/gripper command

### 2. qnbot_teleoperator
**Exoskeleton Teleoperation Core Package**

Main features:
- **WebSocket Server**: Receives exoskeleton real-time data (port 19091)
- **RViz Visualization**: Displays exoskeleton URDF model and real-time pose
- **Retargeting Configuration**: Exoskeleton-to-robot joint mapping configuration
- **Protocol Parsing**: Parses exoskeleton data protocol

### 3. qnbot_replay
**Data Replay Package**

Replays `.msgpack` recorded data via Action Server, supporting:
- WebSocket data stream replay
- Replay speed control
- Replay progress query

## Quick Start

### Clone & Build
```bash
# Create workspace and clone
mkdir -p ~/your_workspace/src
cd ~/your_workspace/src
git clone <this_repo_url> .

# Build
cd ~/your_workspace
colcon build
source install/setup.bash
```

### One-click Launch (WebSocket + RViz)
```bash
ros2 launch qnbot_teleoperator demo_full.launch.py
```

### Launch RViz Visualization Only
```bash
# Use GUI sliders to control joints
ros2 launch qnbot_teleoperator exoskeleton_display.launch.py source:=gui

# Subscribe to exoskeleton data
ros2 launch qnbot_teleoperator exoskeleton_display.launch.py source:=exo_command
```

## Network Isolation

If multiple computers on the LAN are running ROS2, set different Domain IDs to avoid interference:
```bash
export ROS_DOMAIN_ID=42
```

## Topic List

| Topic | Type | Description |
|-------|------|-------------|
| `/exo/joint_command` | sensor_msgs/JointState | Exoskeleton joint command (16 joints) |
| `/exo/gamepad_keys` | sensor_msgs/Joy | Joystick and button data |
| `/exo/full_state` | interface_protocol/ExoFullState | Exoskeleton full state |

## Directory Structure
```
your_workspace/
├── src/                           # This repo cloned here
│   ├── interface_protocol/        # Message definitions
│   ├── qnbot_teleoperator/        # Teleoperation core
│   │   ├── config/                # Configuration files
│   │   ├── launch/                # Launch files
│   │   ├── resource/              # URDF, mesh resources
│   │   └── scripts/               # Utility scripts
│   ├── qnbot_replay/              # Data replay
│   └── README.md
├── build/                         # Build output (auto-generated)
├── install/                       # Install directory (auto-generated)
└── log/                           # Logs (auto-generated)
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
