Line Tracking
For line-following robots. Detects a line on the floor and provides its offset from the frame center, its tilt angle, and its vector, which are used to correct steering.
Commands
| Command | Description |
|---|---|
| Line Info | Writes the detection result, offset, angle, vector, and line width of the detected line. This is the core command for steering control. |
| Has Line? | Checks whether a line is detected. |
| All Info (JSON) | Writes all line tracking information as JSON. |
Settings
| Setting | Description |
|---|---|
| Color Mode | Dark Line on Light BG (default), Light Line on Dark BG, or Custom Color. Custom Color detects lines whose color lies between the Start Color and End Color below. |
| Start Color / End Color | The color range for Custom Color mode. Both default to #FF0000. |
| Sensitivity (%) | 0 to 100, default 50. Higher values detect faint lines but increase false detections; lower values detect only clear lines. |
Output Variables
| Field | Type | Value |
|---|---|---|
| Detected | Digital | True when a line is detected. |
| Offset X (-1~1) | Number | Horizontal position of the line relative to the frame center: -1 (left edge) to 1 (right edge), 0 when centered. Used for left/right correction. |
| Angle (deg) | Number | Tilt of the line, -90 to 90 degrees, 0 when vertical. Used for heading correction. |
| Vector X0 / Y0 / X1 / Y1 | Number | Pixel coordinates of the line vector's start (X0, Y0) and end (X1, Y1). |
| Line Width | Number | Line width as a fraction of the frame width, 0 to 1. |
| Output (JSON Text) | Text | A JSON object with all values. |
When no line is detected, Detected becomes false and the remaining numeric values are written as 0.
JSON Output
A single object, not an array. offset_x and line_width are fractions as described in the table.
{
"detected": true,
"offset_x": 0.15,
"angle": 12.5,
"line_width": 0.06,
"vector_x0": 100,
"vector_y0": 200,
"vector_x1": 540,
"vector_y1": 210
}