feat: 启动命令不用环境变量

This commit is contained in:
Mock
2026-04-09 18:13:03 +08:00
parent 11e67282c7
commit d76230b9b0
8 changed files with 305 additions and 0 deletions

81
scripts/dev/README.md Normal file
View File

@@ -0,0 +1,81 @@
# Dev Startup Scripts
This directory lives inside the `OmniSocketGo` repo and acts as the main launch entry for the whole local setup.
Default layout:
```text
~/Documents/
OmniSocketGo/
scripts/dev/
robot-command-center/
```
The scripts assume:
- `OmniSocketGo` is the current repo
- `robot-command-center` is a sibling directory next to it
If your `robot-command-center` is elsewhere, set `ROBOT_COMMAND_CENTER_ROOT` in `robot-remote.env.local`.
## Files
- `robot-remote.env`: shared defaults for backend, frontend, ROS, and `b_side_omnid`
- `robot-remote.env.local`: optional local override file loaded after `robot-remote.env`
- `load-env.sh`: loads the shared environment into the current shell
- `start-backend.sh`: starts Django ASGI with `uvicorn`
- `start-frontend.sh`: starts the Vite dev server
- `start-ros-receiver.sh`: starts the ROS2 `udp_teleop_bridge` receiver
- `start-b-side-omnid.sh`: starts `./bin/b_side_omnid` and uses `sudo -E` by default
- `start-dev-tmux.sh`: optional one-command `tmux` launcher for all four processes
## Usage
Run these from the `OmniSocketGo` repo root:
```bash
bash scripts/dev/start-backend.sh
bash scripts/dev/start-frontend.sh
bash scripts/dev/start-ros-receiver.sh
bash scripts/dev/start-b-side-omnid.sh
```
If you prefer one command and use `tmux`:
```bash
bash scripts/dev/start-dev-tmux.sh
```
If you only want the shared environment for manual commands:
```bash
source scripts/dev/load-env.sh
```
## Customizing
Edit `scripts/dev/robot-remote.env` for shared changes such as:
- `ROBOT_COMMAND_CENTER_ROOT`
- `CONTROL_SIDE_OMNISOCKET_SERVER_ADDR`
- `CONTROL_SIDE_OMNISOCKET_RELAY_VIA`
- `ROBOT_SIDE_OMNISOCKET_SERVER_ADDR`
- `ROBOT_SIDE_OMNISOCKET_RELAY_VIA`
- `VITE_API_BASE_URL`
- `OMNI_CAMERA_DEVICE`
- `OMNI_VIDEO_PEER_ID`
- `OMNI_CONTROL_PEER_ID`
Role mapping:
- `start-backend.sh` uses the `CONTROL_SIDE_*` address pair
- `start-b-side-omnid.sh` uses the `ROBOT_SIDE_*` address pair
- `start-ros-receiver.sh` defaults to the robot-side address pair, but with `transport=unix_dgram` it usually does not need the server address
Put machine-specific overrides into `scripts/dev/robot-remote.env.local`. Example:
```bash
ROBOT_COMMAND_CENTER_ROOT="$HOME/Documents/robot-command-center"
OMNI_CAMERA_DEVICE="/dev/video30"
B_SIDE_OMNID_USE_SUDO="0"
```