4‐Following Logic & Architecture - LOG795-UAV-Search-and-Rescue/documentation GitHub Wiki
Rover Following Logic & Control Architecture
This page explains how the rover follows the drone using localization data from the VOXL (drone).
It covers:
- The control logic
- Reset synchronization handling
- Safety & smoothing features
- System behavior diagrams
Overview
The rover receives VIO (Visual‑Inertial Odometry) data streamed over Wi‑Fi from the drone.
The laptop acts as the brain and sends %JSON motor commands to the rover.
Pipeline
Drone (VOXL QVIO) → UDP Position Packets → Laptop → JSON Drive Commands → Rover Motors
The laptop continuously:
- Reads drone X,Y,Quality
- Computes rover movement toward drone
- Sends JSON motor commands to rover
- Handles resets and low‑quality state
Rover Following Controller
Control Equations
dx = drone_x - rover_x
dy = drone_y - rover_y
T = clamp(Kt * dy) # forward motion
W = clamp(Kr * dx) # turn rate
L = clamp(T - W) # left wheel
R = clamp(T + W) # right wheel
| Parameter | Meaning |
|---|---|
Kt |
Forward gain |
Kr |
Turning gain |
STOP_DIST |
Distance threshold before stopping |
This creates a smooth proportional controller.
Reset Synchronization Logic
The VOXL odometry resets to (0,0) when tracking quality collapses.
Goal
If drone resets:
- Rover should move to the last true drone location
- Only then reset its own coordinate frame to (0,0)
- Prevent jumps / teleport behavior
Logic
| Event | Rover Action |
|---|---|
| Tracking OK | Follow normally |
| Drone reset triggered | Finish going to last known good pos |
| Rover reaches that pos | Reset to (0,0) together |
Rover turns yellow in GUI during reset‑sync.
Low‑Quality Filter
Poor vision → noisy / fake coordinates.
| Quality | Behavior |
|---|---|
| Good (>= 40%) | Accept & follow |
| Low (< 40%) | Ignore updates, keep smooth trajectory |
| 0% | Likely blackout → treat as candidate reset |
Drone dot turns gray when low‑quality.
Two Operating Modes
| Mode | Behavior |
|---|---|
| Live Follow | Rover constantly tracks drone |
| Summon Mode ("Come to Me") | Drone sends a command, rover travels to drone only once |
User triggers summon by pressing Enter on drone SSH session.
Testing Workflow
| Step | Action |
|---|---|
| 1 | Start QVIO + UDP on drone |
| 2 | Start rover sim on laptop |
| 3 | Move drone → rover follows |
| 4 | Cover cameras → simulate reset |
| 5 | Confirm graceful recovery |
Related Files
| File | Description |
|---|---|
read_vio_send_udp.py |
Drone VIO streaming + summon trigger |
rover_follow_sim.py |
Laptop controller + UI viz |
Result
This module delivers:
- Real robotic following behavior
- Smooth motion, no jumps
- True multi‑robot frame sync logic
- Reset recovery system
- Field‑tested reliability