Man's Next Best Friend

Man's Next Best Friend is a vision-guided autonomous follower built on the Unitree Go2 quadruped. Rather than relying on the Go2's closed-source follow firmware, we built a full ROS 2 pipeline from scratch—giving us complete control over perception, tracking, and motor commands.


Perception

The system decodes the Go2's raw H.264 camera stream via a low-latency ffmpeg subprocess. It runs YOLOv8 person detection with ByteTrack ID persistence and publishes two signals:

  • Bearing ($\theta$): Normalized horizontal offset in $[-1, 1]$.
  • Estimated distance ($d$): Derived from bounding-box height using the monocular approximation:

$$d = \frac{k}{h}$$

Where $h$ is the detected bounding-box height in pixels and $k = f \cdot H$ is a calibration constant folding focal length and real-world person height.


Control Logic

The control loop runs at 20 Hz and computes forward and yaw velocity commands using two proportional gains:

  • Forward Velocity: $$v_x = \text{clamp}(K_{p,\text{dist}} \cdot (d - d^*), v_{x,\text{min}}, v_{x,\text{max}})$$

  • Yaw Velocity: $$v_{\text{yaw}} = \text{clamp}(-K_{p,\text{yaw}} \cdot \theta, -v_{\text{yaw,max}}, v_{\text{yaw,max}})$$

Slew limits prevent gait jerks by capping per-tick velocity changes: $$|v_x^t - v_x^{t-1}| \leq a_x \cdot \Delta t, \quad |v_{\text{yaw}}^t - v_{\text{yaw}}^{t-1}| \leq a_{\text{yaw}} \cdot \Delta t$$


Implementation & Safety

Commands go directly to the firmware's low-level Move() API, bypassing the built-in obstacle avoidance to keep the control loop predictable. Safety gates halt the robot on:

  • Target loss
  • Proximity violations
  • Unsafe firmware states

The result: A quadruped that locks onto a person, follows them across a room, course-corrects smoothly through turns, and stops cleanly the moment it loses line-of-sight—carrying up to 15 kg the whole time.

Built With

Share this project:

Updates