wiki:ControlSystems/SoftwareTeam/Training/GettingStarted/Targeting

FRC competitions almost always allow for and encourage automated identification of targets. The field pieces usually have retro-reflective tape around the target in some pattern that makes it easier to identify. Robots illuminate the targets with bright colored LEDs and then look for the glowing target tape using a camera and software that processes the video from the camera to find the target pattern. The processing usually involves filtering the video frames (a frame is an individual picture from the video stream) to find just the target tape (e.g. by eliminating all colors but the color of the LEDs that is being reflected back by the tape), using edge detection algorithms to find the edges and corners of the target tape, and then calculating how to adjust the robot's position to line up with the target. For example, if the camera is in the center of the robot but the image of the target is left of center, the robot must turn left to properly face the target.

OpenCV allows you to do sophisticated processing of the received frames using various algorithms to filter the images, detect edges, and more. Unfortunately, image processing is very CPU intensive and the RoboRIO is not really up to the task. The $435 RoboRIO has a 667MHz dual-core processor with 256MB of RAM. For comparison, a $40 Raspberry Pi 3B has a 1.2GHz quad-core processor with 1GB of RAM or nearly 4x the computing power. If you try to do much video processing using the RoboRIO, it slows to a crawl and can't perform its other robot-control duties well.

For this reason, 2537, and most other teams, don't do much video processing on the RoboRIO, instead doing video processing on a separate platform such as a Raspberry Pi and send the concise results (e.g. target angle) to the RoboRIO. Choices for video co-processors include:

2537 has traditionally used a Raspberry Pi running custom C++ OpenCV software because Java adds enough overhead that it significantly reduces processing resolution/framerates. The system is described in detail here.

There are now pre-packaged Raspberry Pi Vision for FRC images that are more friendly such as FRCVision.

When using a co-processor, there are multiple ways to send the results back to the RoboRIO including:

To learn more about vision processing, see ScreenStepsLive, this comprehensive Vision Processing document, and this video from the RoboJackets

To learn more about using OpenCV in Java, see here.

Last modified 18 months ago Last modified on Dec 2, 2019, 11:21:15 PM