update from denver

hope this works
(mostly atos fixed, centers and laft un tested)
This commit is contained in:
Luke Staudacher
2018-09-22 20:13:56 -06:00
parent 9ab79a69fa
commit 02285e5af3
13 changed files with 924 additions and 524 deletions
+8 -82
View File
@@ -1,18 +1,6 @@
// RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
package org.usfirst.frc4388.robot;
//import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.DriverStation;
@@ -35,13 +23,7 @@ import org.usfirst.frc4388.robot.subsystems.Drive;
import org.usfirst.frc4388.robot.subsystems.Carriage;
import org.usfirst.frc4388.robot.subsystems.LED;
import org.usfirst.frc4388.robot.subsystems.Drive.DriveControlMode;;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the TimedRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the build.properties file in
* the project.
*/
public class Robot extends IterativeRobot
{
@@ -49,7 +31,7 @@ public class Robot extends IterativeRobot
public static final Drive drive = new Drive();
//public static final Elevator elevator = new Elevator();
public static final Carriage carriage = new Carriage();
public static final Elevator elevator = new Elevator();
@@ -58,15 +40,8 @@ public class Robot extends IterativeRobot
public static final Climber climber = new Climber();
public static final Pnumatics pnumatics = new Pnumatics();
//public static FlashyBlinky flashyBlinky;
//public static Sensors sensors;
public static final long periodMS = 10;
public static final ControlLooper controlLoop = new ControlLooper("Main control loop", periodMS);
//public static final PowerDistributionPanel pdp = new PowerDistributionPanel();
//public static final String ElevatorAuton = null;
public static enum OperationMode { TEST, COMPETITION };
public static OperationMode operationMode = OperationMode.TEST;
@@ -82,33 +57,20 @@ public class Robot extends IterativeRobot
private Command LRautonomousCommand;
private Command LLautonomousCommand;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit()
{
//Printing game data to riolog
String gameData = DriverStation.getInstance().getGameSpecificMessage();
System.out.println(gameData);
CameraServer.getInstance().startAutomaticCapture();
CameraServer.getInstance().putVideo("res", 640, 480);
CameraServer.getInstance().putVideo("res", 300, 220);
try {
//drive = new Drive();
//controlLoop = new ControlLooper("Main control loop", periodMS);
oi = OI.getInstance();
//camera.initialize();
controlLoop.addLoopable(drive);
controlLoop.addLoopable(elevator);
// Waypoint[] points = new Waypoint[] {
// new Waypoint(0, 0, 0),
// new Waypoint(-95, -9, Pathfinder.d2r(-27))
// };
//
// PathGenerator boilerPath = new PathGenerator(points, 0.01, 120, 200.0, 700.0);
operationModeChooser = new SendableChooser<OperationMode>();
operationModeChooser.addDefault("Test", OperationMode.TEST);
@@ -200,11 +162,6 @@ public class Robot extends IterativeRobot
}
}
/**
* This function is called once each time the robot enters Disabled mode.
* You can use it to reset any subsystem information you want to clear when
* the robot is disabled.
*/
public void disabledInit(){
}
@@ -214,23 +171,12 @@ public class Robot extends IterativeRobot
updateStatus();
}
/**
* This autonomous (along with the chooser code above) shows how to select between different autonomous modes
* using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
* Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
* below the Gyro
*
* You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
* or additional comparisons to the switch structure below with additional strings & commands.
*/
public void autonomousInit() {
updateChoosers();
// Schedule the autonomous command (example)
controlLoop.start();
drive.endGyroCalibration();
drive.resetEncoders();
//elevator.resetElevatorEncoder();
drive.resetGyro();
drive.setIsRed(getAlliance().equals(Alliance.Red));
@@ -265,46 +211,30 @@ public class Robot extends IterativeRobot
public void autonomousPeriodic() {
Scheduler.getInstance().run();
//Robot.elevator.setControlMode(DriveControlMode.RAW);
updateStatus();
}
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (RRautonomousCommand != null) RRautonomousCommand.cancel();
if (RLautonomousCommand != null) RLautonomousCommand.cancel();
if (LRautonomousCommand != null) LRautonomousCommand.cancel();
if (LLautonomousCommand != null) LLautonomousCommand.cancel();
drive.setToBrakeOnNeutral(false); // coast to avoid tipping when driver stops suddenly
//MotionProfileCache.getInstance().release();
drive.setToBrakeOnNeutral(false);
updateChoosers();
controlLoop.start();
drive.resetEncoders();
drive.endGyroCalibration();
//shooter.setStage1Speed(0);
//shooter.setStage2Speed(0);
//shooterFeed.setSpeed(0);
//zarkerFeed.setSpeed(0);
//shooter.setHopperPosition(HopperState.CLOSE);
//Robot.elevator.setControlMode(DriveControlMode.JOYSTICK);
updateStatus();
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic()
{
Scheduler.getInstance().run();
updateStatus();
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
updateStatus();
@@ -325,11 +255,7 @@ public class Robot extends IterativeRobot
public void updateStatus() {
drive.updateStatus(operationMode);
elevator.updateStatus(operationMode);
//carriage.updateStatus(operationMode);
//shooter.updateStatus(operationMode);
//shooterFeed.updateStatus(operationMode);
//zarkerFeed.updateStatus(operationMode);
//camera.updateStatus(operationMode);
}
}