1
package com.shadowh511.mayor;
4
* For use with a barebones robot. It has two motors and two jags 1 and 2
5
* respectively. It also has a switch to get input for a sensor so it can
6
* automatically kick balls, if it had such a mechanism;
9
import edu.wpi.first.wpilibj.SimpleRobot;
10
import edu.wpi.first.wpilibj.Timer;
11
import com.shadowh511.mayor.inputs.Attack3;
12
import com.shadowh511.mayor.inputs.Switch;
13
import com.shadowh511.mayor.outputs.Driver;
14
import com.shadowh511.mayor.outputs.ConstantMotorThread;
15
import com.shadowh511.mayor.outputs.Firing;
16
import com.shadowh511.mayor.outputs.FiringThread;
17
import com.shadowh511.mayor.utils.EasyDriverStationLCD;
19
public class Tomo extends SimpleRobot {
20
Attack3 driver_L = new Attack3(1);
21
Attack3 driver_R = new Attack3(2);
22
Driver motors = new Driver(1,2);
23
EasyDriverStationLCD lcd = new EasyDriverStationLCD();
24
Switch balls = new Switch(4);
25
ConstantMotorThread magnet;
26
//Firing gun = new Firing();
27
FiringThread gun = new FiringThread();
28
private static Tomo instance; //The ConstantMotorThread gets data from the main Robot class, among other things
32
public void robotInit() {
33
magnet = new ConstantMotorThread(7);
35
System.out.println("ConstantMotor thread started");
36
getWatchdog().setEnabled(false);
41
* This function is called once each time the robot enters autonomous mode.
43
public void autonomous() {
45
getWatchdog().setEnabled(false);
48
System.out.println("Autonomous Enabled");
51
lcd.writeOnLine(0, "AUTONOMOUS", 0);
54
motors.drive(0.5); //Drives in a square, hopefully
56
motors.tankDrive(0.5, -0.5);
60
motors.tankDrive(0.5, -0.5);
64
motors.tankDrive(0.5, -0.5);
68
motors.tankDrive(0.5, -0.5);
71
System.out.println("Automous Disabled");
75
* This function is called once each time the robot enters operator control.
77
public void operatorControl() {
79
getWatchdog().setEnabled(false);
83
lcd.writeOnLine(0, "TELEOPERATED", 0);
88
System.out.println("Teleop Enabled");
91
lcd.writeOnLine(1, ""+loops, 0);
93
motors.tankDrive(driver_L, driver_R);
97
lcd.writeOnLine(2, "TRUE ", 0);
99
lcd.writeOnLine(2, "FALSE", 0);
105
System.out.println("Teleop Disabled");
108
public static Tomo getInstance() { //For other threads to use robot states