mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Include delays and template code from other examples to show how to use these examples in a full robot program. Change Java example in example finder to Simple Vision to match C++. Add comments about how to find cam number and change default to cam0. Change-Id: I85846ccfaf016c538a750b057a7fd766cdff9447
30 lines
787 B
C++
30 lines
787 B
C++
#include "WPILib.h"
|
|
|
|
/**
|
|
* Uses the CameraServer class to automatically capture video from a USB webcam
|
|
* and send it to the FRC dashboard without doing any vision processing. This
|
|
* is the easiest way to get camera images to the dashboard. Just add this to the
|
|
* RobotInit() method in your program.
|
|
*/
|
|
class QuickVisionRobot : public SampleRobot
|
|
{
|
|
public:
|
|
void RobotInit() override {
|
|
CameraServer::GetInstance()->SetQuality(50);
|
|
//the camera name (ex "cam0") can be found through the roborio web interface
|
|
CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
|
}
|
|
|
|
void OperatorControl()
|
|
{
|
|
while (IsOperatorControl() && IsEnabled())
|
|
{
|
|
/** robot code here! **/
|
|
Wait(0.005); // wait for a motor update time
|
|
}
|
|
}
|
|
};
|
|
|
|
START_ROBOT_CLASS(QuickVisionRobot);
|
|
|