Vision Follower (RGB)¶
2D Visual Servoing for target centering.
The VisionFollowerRGB is a reactive controller designed to keep a visual target (like a person or another robot) centered within the camera frame. Unlike the RGB-D variant, this controller operates purely on 2D image coordinates, making it compatible with any standard monocular camera.
It calculates velocity commands based on the relative shift and apparent size of a 2D bounding box.
How it Works¶
The controller uses a proportional control law to minimize the error between the target’s current position in the image and the desired center point.
Horizontal Centering - Rotation. The robot rotates to minimize the horizontal offset (-axis) of the target bounding box relative to the image center.
Scale Maintenance - Linear Velocity. The robot moves forward or backward to maintain a consistent bounding box size, effectively keeping a fixed relative distance without explicit depth data.
Target Recovery - Search Behavior. If the target is lost, the controller can initiate a search pattern (rotation in place) to re-acquire the target bounding box.
Supported Inputs¶
This controller requires 2D detection or tracking data.
Detections / Trackings - Must provide Detections2D, Trackings2D (contains the original image info).
Data Synchronization
The Controller does not subscribe directly to raw images. It expects the detection metadata (bounding boxes) to be provided by an external vision pipeline.
Configuration Parameters¶
Name |
Type |
Default |
Description |
|---|---|---|---|
rotation_gain |
|
|
Proportional gain for angular control (centering the target). |
speed_gain |
|
|
Proportional gain for linear speed (maintaining distance). |
tolerance |
|
|
Error margin for tracking before commands are issued. |
target_search_timeout |
|
|
Maximum duration (seconds) to perform search before timing out. |
enable_search |
|
|
Whether to rotate the robot to find a target if it exits the FOV. |
min_vel |
|
|
Minimum linear velocity allowed during following. |
Usage Example¶
import numpy as np
from kompass.control import VisionRGBFollowerConfig
# Configure the algorithm
config = VisionRGBFollowerConfig(
rotation_gain=0.9,
speed_gain=0.8,
enable_search=True
)
For full system integration including ML model deployment, check the Vision Tracking Tutorial: