Files
tienkung-szu/Deploy_Tienkung/udp_loopback/README_omnisocket.md

111 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
服务器:
ssh bj-txy
cd OmniSocketGo
./bin/kcpserver -listen 0.0.0.0:10909
ssh gz-txy
cd OmniSocketGo
./bin/kcpserver -mode=relay -listen 0.0.0.0:10909 -relay-remote 172.21.32.15:10909
MuJoCo端
终端1
source /opt/ros/humble/setup.zsh
export ROS_DOMAIN_ID=10
cd tienkung-szu/xSIM_MUJOCO
python scripts/simulator_view_asyn.py -m evt2
终端2
source /opt/ros/humble/setup.zsh
export ROS_DOMAIN_ID=10
cd tienkung-szu/Deploy_Tienkung
python3 rl_control_node_sim.py
控制端:
键盘控制:
cd tienkung-szu/Deploy_Tienkung
python3 udp_loopback/omnisocket_keyboard_sender.py
xbox:
终端1
source /opt/ros/humble/setup.bash
ros2 run joy joy_node --ros-args -r joy:=/xbox_data
终端2
cd tienkung-szu/Deploy_Tienkung
python3 udp_loopback/omnisocket_xbox_sender.py
# OmniSocket Integration
This repo now supports an OmniSocket-based control path alongside the original UDP loopback.
## Files
- `omnisocket_control.py`: binary control packet codec shared by sender/receiver.
- `omnisocket_keyboard_sender.py`: keyboard -> OmniSocket sender.
- `omnisocket_xbox_sender.py`: ROS2 `/xbox_data` -> OmniSocket sender.
- `omnisocket_fsm_controller.py`: OmniSocket receiver that converts packets into `ControlFlag`.
- `config/omnisocket_demo.yaml`: OmniSocket transport config template.
## Main-node integration
Set `control_tool: omnisocket_loopback` in `config/dex_config.yaml`, then run `rl_control_node.py` or `rl_control_node_sim.py`.
The main node will instantiate `OmniSocketFSMController`, which receives binary control packets and maps them into the same FSM commands used by the UDP loopback path.
## Sender usage
Keyboard sender:
```bash
cd Deploy_Tienkung
python3 udp_loopback/omnisocket_keyboard_sender.py
```
Xbox sender:
```bash
cd Deploy_Tienkung
source /opt/ros/jazzy/setup.bash
ros2 run joy joy_node --ros-args -r joy:=/xbox_data
python3 udp_loopback/omnisocket_xbox_sender.py
```
## Notes
- Install the `omnisocket` Python package before using this path.
- `omnisocket_xbox_sender.py` still reuses `config/dex_config.yaml` for Xbox axis/button overrides so it stays aligned with the existing repo configuration.
- The original UDP files remain unchanged, so you can switch back by restoring `control_tool: udp_loopback`.
- OmniSocket keyboard/Xbox mappings are aligned with the cleaned walk-only FSM flow: `ZERO`, `STOP`, and `WALKAMP`.
- Keyboard sender supports `4/5/6` for clearing `x/y/yaw` speed independently, and `r` still clears all three axes.
## B-side OmniDaemon
The B-side stack now supports a local daemon that owns OmniSocket control receive and manages the video sender worker.
Start the daemon:
```bash
cd OmniSocketGo
make b_side_video_sender
python3 -m pip install -e ./python
python3 -m omnisocket_b_side.daemon --config config/b_side_omnidaemon.yaml
```
Or with the helper script:
```bash
cd OmniSocketGo
./scripts/start_b_side.sh
```
With `OMNI_TRANSPORT_BACKEND=daemon` (the default), `OmniSocketFSMController` connects to `/tmp/omnisocket-b-ctrl.sock` and receives raw `ControlPacket` bytes from the daemon instead of creating its own OmniSocket session.
Fallback to the previous direct mode when needed:
```bash
export OMNI_TRANSPORT_BACKEND=direct
python3 rl_control_node_sim.py
```
In simulation / MuJoCo mode, keep `video_sender.enabled: false` in `OmniSocketGo/config/b_side_omnidaemon.yaml` so the daemon only provides the control path and does not require `/dev/video0`.