Version 8 (modified by 5 years ago) (diff) | ,
---|
Camera Feed Display
Cameras are crucial to competitions since many parts of the field are not directly visible to the driver. You can read about how to use the CameraServer class on ScreenStepsLive.
- Open FRC VSCode
- Create a new FRC project.
- Type the following into Robot.java
import edu.wpi.first.cameraserver.CameraServer;
- Inside robotInit(), configure the camera with:
CameraServer.getInstance().startAutomaticCapture();
You can see the complete Robot.java code here
- You can view the camera video in the smart dashboard or on the shuffleboard.
- To view the camera feed on the smart dashboard, use the pull-down chooser in the lower left corner to select USB Camera 0.
- To display the camera feed using shuffleboard, read about it here
Smartdashboard and shuffleboard can be used interchangeably, however,shuffleboard is far more user friendly and visually appealing.
- To display the camera open up Shuffleboard and read this
It's often desirable for a robot to have more than one camera; the camera server supports this and you can select cameras using a game controller button or even automatically when the robot changes direction. You can read about multiple camera selection here
It's possible to do many more advanced things with cameras including processing the video stream in software to identify game pieces and targets. Team 2537 generally doesn't do this processing on the !RoboRIO because it lack sufficient processing power; instead we use a Raspberry Pi with its own camera to do the processing; a Raspberry Pi is several times more powerful than the !RoboRIO.
Another way to make driving by camera easier is to create overlays on the video feed such as cross-hairs to show where a shooter is aimed. Doing this requires using the NIVision libraries and software provided with FRC Update Suite. Note: ask a mentor for the team's serial number. You may also need the acquisition software.