Computer Vision
Computer vision is a subset of algorthims and techniques that allow computers to interpret and understand visual information from the world, such as images and videos. The main goal is to develop methods to detect and track objects, recognize patterns, and extract meaningful information from visual data. In the context of FRC, computer vision is often used to help robots identify and interact with game pieces, and or field elements. It helps the robots better understand the environment around them, enabling more autonomous and intelligent behavior.
Presentation
Exercises
The exercises below are the Computer Vision lesson in Scriptum. It starts from your finished State Machines robot. Open the lesson, start the simulated robot and follow its README. Each step is checked with the Verify button.
New Java in this lesson: none. You practice what you already know: a new state and switch case, a PID, and a new case in the robot's state machine.
Vision
- Give each camera tag solution to the pose estimator in
LocalizationSubsystem- Use
addVisionMeasurement(...)with the pose the camera saw, the time the picture was taken, and the standard deviations
- Use
- Choose how much to trust the cameras
- The starter standard deviations of 5.0 mean "ignore the cameras". Pick better numbers
- Drive more than 5 meters, stop, and compare your estimate with the true pose on the AdvantageScope 2D field
- Your estimate should stay within 0.06 m and 0.017 rad (about 1 degree) of where the robot really is
Aiming
- Add an
AIMstate to the drivetrain- Turn in place to face the goal at (4.0, 4.0), using your pose estimate
- Use a PID with continuous input from -π to π radians, since headings wrap around
- Write
isAimed(): true only when the error is belowAIM_TOLERANCE_RAD(0.035 rad, about 2 degrees) and the robot has stopped turning - Add an
AIMcase toRobotContainerthat asks the drivetrain for itsAIMstate (the left bumper already asks the robot forAIMwhile held) - Tune
AIM_KPandAIM_KDso the robot gets there quickly without swinging past