Implementing Autonomous ArUco Target Tracking on the myAGV

Implementing Autonomous ArUco Target Tracking on the myAGV

July 16, 2026 by ThinkRobotics
Share
Implementing Autonomous ArUco Target Tracking on the myAGV
myAGV ยท Computer Vision

A technical walkthrough of an autonomous target-following module built with ROS, OpenCV, and ArUco visual fiducial markers.

ROS OpenCV ArUco Fiducial Markers DICT_4X4_50

Building autonomous mobile robots requires a seamless blend of robust hardware pipelines and efficient computer vision algorithms. In this technical walkthrough, we're breaking down how to implement an autonomous target-following module on Elephant Robotics' myAGV platform using ROS, OpenCV, and specialized ArUco visual fiducial markers.

Prerequisites: System Initialization

Before deploying any high-level dispatch scripts, the myAGV platform requires its low-level hardware communication layers to be actively initialized.

System Setup Notice

If this is your first time booting the platform, you must complete the primary network configuration and basic dependencies installation. Please visit the official Elephant Robotics myAGV Basic Setup Guide to prepare your environment. Once your system is configured, return here for the next steps.

By combining real-time edge processing with defensive programming mechanics like anti-stutter memory filters, we can transform the myAGV chassis into a responsive, target-tracking system.

Here is a comprehensive breakdown of the core mechanics powering the module.

Understanding the Vision Pipeline: The Role of ArUco Markers

For robotic platforms processing data on the edge, standard object detection models can be computationally expensive. ArUco markers solve this challenge. Acting essentially as high-contrast, optimized 2D binary matrices, they provide low-latency, high-accuracy structural recognition even under variable lighting conditions.

In our tracking script, the computer vision parameters are explicitly tuned for optimal feature calculation:

  • Dictionary Scope: The pipeline is initialized to look exclusively for the 4x4 ArUco dictionary matrix (DICT_4X4_50).
  • Sub-Pixel Refinement: To ensure smooth positioning vector calculations, the detector deploys the CORNER_REFINE_SUBPIX method. This mathematically refines the marker's corner arrays down to a fraction of a pixel, drastically reducing jitter when the robot calculates structural headings.

Motion Kinematics: Smoothed Tuning & Range Maintenance

Translating spatial data into smooth wheel velocities is critical to avoiding structural whiplash or physical collisions. The script approaches control through two distinct lenses:

  • Dynamic Angular Alignment: The code tracks the displacement (error_x) between the calculated midpoint of the marker and the absolute camera center line (320 pixels). By applying a tuned gain multiplier (-0.003), the chassis executes smooth, predictive turns. To guarantee the robot operates safely at an industrial pace, the final angular velocity commands are strictly clamped between -0.6 and 0.6 rad/s.
  • Proximity Boundaries: Instead of using an external ranging sensor, the system dynamically gauges distance by measuring the perceived pixel width of the marker bounds.
    • Chasing: If the marker width drops below 190 pixels, the AGV drives forward at a linear velocity of 0.20 m/s.
    • Recoiling: If the width expands past 210 pixels, the chassis safely reverses at -0.20 m/s to preserve its operational buffer zones.
    • Stationary: When hovering within the 190โ€“210 pixel sweet spot, linear velocity is zeroed out (0.0 m/s).

Fault Tolerance: Anti-Stutter Coasting Mechanics

In real-world testing environments, a momentary glare or a passing object can block the camera's view line, causing standard tracking algorithms to slam the motors to a violent stop. To counter this, the script introduces an Anti-Stutter Grace Period.

Python
# The Grace Period (Anti-Stutter)
time_since_last_seen = current_time - self.last_seen_time
if time_since_last_seen < self.COAST_TIME:
    twist = self.last_twist

The system implements a COAST_TIME constant set to 0.5 seconds. If the marker drops out of frame, the myAGV doesn't immediately stop; instead, it maintains its last verified trajectory vector (self.last_twist) for half a second. If the marker is recaptured within this window, tracking seamlessly continues without any mechanical stutter. If the timer expires, the robot executes a controlled full stop.

Real-Time Augmented Telemetry

To streamline testing and diagnostics, the node draws localized telemetry strings directly onto the live visual matrix window:

TRACKING ACTIVE
Confirms an uninterrupted locking matrix on the fiducial marker.
COASTING (BLUR)
Indicates visual interruption where the 0.5-second memory fallback is actively maintaining velocity.
TARGET LOST - STOPPED
The safe halt sequence executed immediately upon timeout expiration.

Deployment & Execution Checklist

Ready to run this build on your hardware environment? Ensure your system workspace is sourced, your dependencies (official page) are linked, and execute the following stack sequence across independent terminals:

  1. Initialize the Base Kinematics & Odometry Layer:

    Bash
    roslaunch myagv_odometry myagv_active.launch
  2. Boot up the Astra Pro Plus 3D Camera Node:

    Bash
    roslaunch orbbec_camera astra_pro2.launch

    Developer Note: Double-check that your CvBridge subscriber topic string points accurately to the Astra Pro Plus RGB broadcast node, typically mapping to /camera/color/image_raw or /camera/rgb/image_raw depending on your environment package schema.

  3. Run the Follower Module Node:

    Code for the same is available here.

    Bash
    python3 aruco_follower.py

Following screen can be seen initially, a window pops up to show the video feed:

Initial video feed window before ArUco marker detection
Initial video feed window before an ArUco marker is detected

Following screen can be seen when ArUco cube is detected:

ArUco cube detected and tracked by the myAGV
Live tracking view once the ArUco cube is detected

Next Steps for Enterprise Applications

This fundamental tracking module lays the perfect groundwork for scaling up your mobile robotics infrastructure. Because ArUco markers feature unique structural IDs, the codebase can easily be extended to trigger distinct warehouse logic chains based on the target recognized โ€” allowing you to route the myAGV to varying loading zones, change patrolling profiles, or trigger automated charging sequences simply by flashing a new marker ID.


Set up your myAGV before you begin

Follow the official Elephant Robotics myAGV Basic Setup Guide first.

View Setup Guide