Getting Started with Limelight
Hardware setup, networking into the Web UI, and initializing the Limelight 3A in FTC.
By the end you can
- Understand what the Limelight 3A is.
- Learn how to access the Limelight Web Interface.
- Initialize the Limelight in the FTC Hardware Map.
In the Intermediate section, we used Odometry to perfectly track our robot's position based on where its wheels rolled. But what happens if another robot picks us up and moves us? Or if we completely lose our tracking?
We need a way to look at the physical field and mathematically calculate our position. Enter the Limelight 3A.
What is the Limelight 3A?
The Limelight is an industry-standard smart camera used heavily in FRC, and recently brought to FTC. It is not just a webcam; it is a dedicated mini-computer with a massively powerful processor and a built-in ring light.
It handles all the complex, math-heavy Computer Vision (CV) processing entirely on its own hardware, and then simply sends the final data (e.g., "I am exactly at X: 24, Y: 48, Heading: 90") directly to your Control Hub. This prevents your Control Hub from lagging or crashing during intense autonomous routines!
Because the Limelight is its own computer, it has its own operating system and its own Web Interface where you configure all of its settings.
Hardware Setup & Networking
Before writing any Java code, you must physically install and configure the Limelight.
Always refer to the Official Limelight FTC Getting Started Guide for the most up-to-date instructions.
- Mounting: Mount the Limelight to your robot. It must be mounted rigidly so it doesn't vibrate. Measure its exact height off the floor and its offset from the center of your robot—you will need these numbers later!
- Wiring: Plug the Limelight into the USB port on your Control Hub. Then, wire the Limelight's power wires into a 12V port on your Rev Expansion/Control Hub.
- Connecting to the Web UI:
- Turn on the robot and connect your laptop to the Control Hub's Wi-Fi network.
- Open a web browser (Chrome/Edge).
- Navigate to
http://limelight.local:5801. - You should see the Limelight Web Interface!
- Configuration: Inside the Web UI, you must set your team number, define your camera's exact 3D position relative to the center of your robot, and update to the latest firmware.
Initializing in Java
Once the hardware is configured, we can add it to our FTCLib project.
First, ensure you have added the Limelight to your robot's configuration on the Driver Station phone (add it as an I2C device, even though it's plugged into USB, and name it limelight).
Here is a basic LimelightSubsystem that initializes the camera:
package org.firstinspires.ftc.teamcode.subsystems;
import com.arcrobotics.ftclib.command.SubsystemBase;
import com.qualcomm.hardware.limelightvision.Limelight3A;
import com.qualcomm.robotcore.hardware.HardwareMap;
public class LimelightSubsystem extends SubsystemBase {
// 1. Declare the Limelight object
private final Limelight3A limelight;
public LimelightSubsystem(HardwareMap hardwareMap) {
// 2. Fetch it from the hardware map using the exact name from the config
limelight = hardwareMap.get(Limelight3A.class, "limelight");
// 3. Start the Limelight polling process
limelight.start();
// (Optional) Switch to a specific pipeline you built in the Web UI
limelight.pipelineSwitch(0);
}
}The limelight.start() method is crucial. It tells the Limelight's SDK to begin actively polling the camera for new data in the background. If you forget this line, you will never get any vision data!
Check Your Understanding
Check yourself