Line Tracking Example

HuskyLens 2 line tracking lets micro:bit read line length, angle, X/Y vector and intersection branches; it’s like giving your robot road markings it can measure and follow precisely.

1. Line Tracking Project Example

Before You Start:

1.1 Line Tracking and Output Relevant Data

When line tracking is enabled, HuskyLens 2 can detect and track lines in its field of view, allowing you to access key data: line length, angle, X/Y components, intersection branch count, and specific branch data.

Example program:

Interface Diagram

Connect to micro:bit and click Download to transfer the program. After successful download, click Show Data to activate data output mode. Point the HuskyLens 2 camera at a line or track to observe the output.

As shown, when HuskyLens 2 detects lines and intersections, the following data will display:

How to use line tracking, please refer to the Line Tracking tutorial.

Result: The serial port will output: current line length, angle, X/Y components, intersection branch count.

Interface Diagram

1.2 Line Tracking Blocks Description

block Description
Used to obtain one set of Line Tracking data under the Line Tracking function of HUSKYLENS 2.
Determine if a line is present in the current frame.
Retrieves data of the detected line including vector components, orientation angle, and line length.
Obtain the number of branches at detected intersections.
When multiple branches are detected, retrieves data for a specified branch starting counterclockwise.

Was this article helpful?

TOP