Files

143 lines
5.5 KiB
Markdown
Raw Permalink Normal View History

# Open Source Go2 Dashboard
This dashboard replaces the old `~/GO2` dashboard service for the open-source
`go2-nav2-amcl` trial.
## Safety Boundary
This service is a VM-side integration only. It must not modify the Go2 onboard
system, DDS configuration, network routes, systemd services, startup scripts, or
packages.
The only robot-side SSH behavior allowed by this dashboard is the explicit
user-approved waypoint action command, which runs the existing photo script and
then exits. Configuration and development changes belong on the VM.
It serves a small web UI on port `8090` and talks directly to the current ROS 2
Nav2 graph:
- `/map`
- `/amcl_pose`
- `/initialpose`
- `/cmd_vel`
- `/cmd_vel_nav`
- `/navigate_to_pose`
## Fixed Inspection Route
The dashboard supports one VM-side fixed inspection route. Operators create it
by selecting route edit mode, dragging fixed poses on the map, then saving.
The route is stored here:
```text
go2_dashboard/data/inspection_routes/default.json
```
Saved routes are bound to the current map yaml and map revision. If the map is
rebuilt or replaced, save the route again before starting inspection.
Route execution is single-run only. The dashboard sends each Nav2 goal in order,
confirms that the robot has really arrived, calls the VM-side realtime segment
HTTP integration, then keeps the original 3 second dwell before continuing.
Navigation failure still stops the route and waits for an operator.
Camera-facing patrol points must finish yaw alignment before arrival is accepted.
The dashboard keeps `GO2_INSPECTION_YAW_TOLERANCE_DEG` at `8.0` by default, and
the Nav2 controller is tuned to rotate into that final heading faster instead of
skipping the heading check.
The realtime segment call is made from the VM after arrival confirmation and
before the 3 second dwell:
```text
POST http://192.168.0.199:5000/realtime-segment
```
The dashboard uploads the current Unitree video JPEG frame as
`multipart/form-data`. The default file field is `image`; override it with
`GO2_REALTIME_SEGMENT_IMAGE_FIELD` if the service expects another field name.
The target URL can be overridden with `GO2_REALTIME_SEGMENT_URL`.
By default, realtime segment failures are shown in `/api/state.inspection_run`
and the UI, then the route continues to the 3 second dwell and the next point.
Set `GO2_REALTIME_SEGMENT_CONTINUE_ON_FAILURE=false` if a missed realtime
segment call must stop the inspection. Timeouts are controlled by
`GO2_REALTIME_SEGMENT_TIMEOUT_S` and `GO2_REALTIME_SEGMENT_FRAME_TIMEOUT_S`.
Before a route can start, the dashboard now enforces a navigation preflight:
- Nav2 launch is running and `/navigate_to_pose` is ready.
- Fresh real Go2 source data is being received from `/lf/sportmodestate`,
`/lf/lowstate`, `/utlidar/robot_pose`, and `/utlidar/cloud_deskewed`.
- The robot accepts `/api/sport/request`.
- The current map-frame pose is fresh.
- The operator has explicitly confirmed that the displayed robot position and
yaw match the real robot in the room after setting the initial pose.
The UI button order is: start navigation, set initial pose, confirm localization,
then send a manual goal or start the saved inspection route. If any preflight
item is missing, route start is blocked and `/api/state.preflight` lists the
blocking reasons.
The live camera panel serves MJPEG through `/api/video`. Frames are sampled from
Unitree's official `VideoClient.GetImageSample()` on the robot network
interface. By default the interface is `ens160`; override it with
`GO2_CAMERA_IFACE` when starting the service.
Robot pose displayed on the web map goes through a small pose pipeline reserved
for later localization optimization:
```text
go2_dashboard/config/pose_pipeline.json
```
Current default behavior is pass-through with optional offsets. The preferred
source is `tf:map->base_link`, then
`amcl:/amcl_pose`.
After a Nav2 goal returns `succeeded`, the dashboard can run one onboard
waypoint action after the robot is actually settled at the requested pose. This
is configured here:
```text
go2_dashboard/config/waypoint_action.json
```
The default action SSH target is the Go2 onboard computer:
```bash
cd /unitree_go2_ws/src/action/action && python3 testaction5.py
```
The hook checks position tolerance, yaw tolerance, fresh pose data, and a short
stable hold time before it runs the command. Each goal sequence can trigger the
action at most once. If a new goal or stop command arrives while settling, the
pending action is superseded.
Nav2 obstacle avoidance is required for dashboard-started navigation. The VM
side startup path refuses to launch navigation if the Nav2 local/global costmap
obstacle and inflation layers are disabled in
`src/go2_navigation2/config/nav2_params.yaml`.
Do not store passwords in `waypoint_action.json`. If password SSH is needed,
create `go2_dashboard/config/dashboard.env` on the VM and set
`GO2_ROBOT_PASSWORD` there. That file is loaded by
`start_go2_dashboard.sh` and should stay local to the VM.
The dashboard expects the robot ROS network interface to be `ens160` by
default. Override it with `GO2_ROS_IFACE` in `dashboard.env` if the VM uses a
different bridged NIC. If that interface is down, the web service falls back to
an available VM network interface so the UI can show diagnostics, but it refuses
to start Nav2 until the robot ROS interface is restored and the service is
restarted.
Start it from the VM:
```bash
cd ~/go2_robot_system
./go2_dashboard/start_go2_dashboard.sh
```
The service intentionally does not implement the legacy `/api/v1/...` GO2
dashboard API.