Created
          January 25, 2017 17:24 
        
      - 
      
- 
        Save jonkiddy/fd9cf92fcd5b3de0659b5a560f79190c to your computer and use it in GitHub Desktop. 
    Possible CameraServer code for use with the SmartDashboard
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package org.usfirst.frc.team4930.robot; | |
| import edu.wpi.first.wpilibj.SampleRobot; | |
| import edu.wpi.first.wpilibj.Timer; | |
| import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; | |
| import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | |
| import edu.wpi.first.wpilibj.CameraServer; | |
| import edu.wpi.cscore.UsbCamera; | |
| public class Robot extends SampleRobot { | |
| CameraServer server; | |
| UsbCamera cam1; | |
| SendableChooser chooser; | |
| public Robot() { | |
| server = CameraServer.getInstance(); | |
| } | |
| public void robotInit() { | |
| chooser = new SendableChooser(); | |
| // not sure about these next few lines, will need to play with this a bit | |
| // aslo, smartdashboard will need a camera element added to its display | |
| cam1 = server.startAutomaticCapture(); | |
| // addtional cameras will nbe needed at some point... | |
| // server.addCamera(cam1); | |
| // server.startAutomaticCapture(cam1); | |
| cam1.setResolution(320, 240); | |
| } | |
| public void autonomous() { | |
| //nothing | |
| } | |
| public void operatorControl() { | |
| double randomInfo = 1.0; | |
| while (isOperatorControl() && isEnabled()) { | |
| // need to put something on dashbaord to have something show up under Java dashbaord | |
| SmartDashboard.putNumber("here is a number...", randomInfo); | |
| // wait for a motor update time | |
| Timer.delay(0.005); | |
| } | |
| } | |
| public void test() { | |
| //nothing | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment