Skip to content

Instantly share code, notes, and snippets.

@jonkiddy
Created January 25, 2017 17:24
Show Gist options
  • Save jonkiddy/fd9cf92fcd5b3de0659b5a560f79190c to your computer and use it in GitHub Desktop.
Save jonkiddy/fd9cf92fcd5b3de0659b5a560f79190c to your computer and use it in GitHub Desktop.

Revisions

  1. jonkiddy created this gist Jan 25, 2017.
    56 changes: 56 additions & 0 deletions Robot.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    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
    }

    }