--- /dev/null
+package org.usfirst.frc.team3501.robot;
+
+/**
+ * The Constants stores constant values for all subsystems. This includes the
+ * port values for motors and sensors, as well as important operational
+ * constants for subsystems such as max and min values.
+ */
+
+public class Constants {
+ public static class OI {
+ public final static int LEFT_STICK_PORT = 0;
+ public final static int RIGHT_STICK_PORT = 0;
+ }
+
+ public static class DriveTrain {
+ public static final int FRONT_LEFT = 0;
+ public static final int FRONT_RIGHT = 0;
+ public static final int REAR_LEFT = 0;
+ public static final int REAR_RIGHT = 0;
+ }
+
+ public static enum Direction {
+ LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot;
+
+public class MathLib {
+
+ /***
+ * This method gives speed as a function of % distance covered so the speed
+ * forms a parabola starting and ending at minSpeed when you start and end and
+ * achieving maxSpeed exactly halfway.
+ *
+ * @param minSpeed
+ * the starting and ending speed, in range [0, 1]
+ * @param maxSpeed
+ * the max speed, achieved at percentComplete = 1/2.
+ * @param percentComplete
+ * should be currentDistance / targetDistance
+ * @return the speed (motor value) to set motors to for smooth acceleration.
+ * Note that since velocity is a parabola, acceleration is linear. It
+ * may exceed the maximum value robot can accelerate without wheel
+ * slipping.
+ */
+ public static double getSpeedForLinearAccel(double minSpeed, double maxSpeed,
+ double percentComplete) {
+ return 4 * (minSpeed - maxSpeed) * (percentComplete - 0.5)
+ * (percentComplete - 0.5) + maxSpeed;
+ }
+
+ /***
+ * This method gives speed as a function of % distance covered so the speed
+ * increases linearly from minSpeed to maxSpeed and then back down again.
+ *
+ * @param minSpeed
+ * the starting and ending speed, in range [0, 1]
+ * @param maxSpeed
+ * the max speed, achieved at percentComplete = 1/2.
+ * @param percentComplete
+ * should be currentDistance / targetDistance
+ * @return the speed (motor value) to set motors to.
+ */
+ public static double getSpeedForConstantAccel(double minSpeed,
+ double maxSpeed, double percentComplete) {
+ return maxSpeed + 2 * (minSpeed - maxSpeed)
+ * Math.abs(percentComplete - 0.5);
+ }
+
+ /***
+ * Restricts an input value to the range [low, high]. If value > high it will
+ * be set to high. If value < low it will be set to low.
+ *
+ * This method is used for defensive programming for inputs to motors to
+ * restrict them to valid ranges.
+ *
+ * @param value
+ * the value to restrict.
+ * @param low
+ * the smallest acceptable value.
+ * @param high
+ * the largest acceptable value.
+ * @return returns value restricted to be within the range [low, high].
+ */
+ public static double restrictToRange(double value, double low, double high) {
+ value = Math.max(value, low);
+ value = Math.min(value, high);
+ return value;
+ }
+
+ /***
+ * Returns true if val is in the range [low, high]
+ *
+ * @param val
+ * value to test
+ * @param low
+ * low end of range
+ * @param high
+ * high end of range
+ * @return boolean return true if val is in the range [low, high]
+ */
+ public static boolean inRange(double val, double low, double high) {
+ return (val <= high) && (val >= low);
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot;
+
+import org.usfirst.frc.team3501.robot.Constants.DriveTrain;
+import edu.wpi.first.wpilibj.IterativeRobot;
+import edu.wpi.first.wpilibj.command.Scheduler;
+
+public class Robot extends IterativeRobot {
+ public static OI oi;
+ public static DriveTrain driveTrain;
+
+ @Override
+ public void robotInit() {
+ driveTrain = new DriveTrain();
+ oi = new OI();
+ }
+
+ @Override
+ public void autonomousInit() {
+ }
+
+ @Override
+ public void autonomousPeriodic() {
+ Scheduler.getInstance().run();
+
+ }
+
+ @Override
+ public void teleopInit() {
+ }
+
+ @Override
+ public void teleopPeriodic() {
+ Scheduler.getInstance().run();
+
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.subsystems;
+
+import org.usfirst.frc.team3501.robot.Constants;
+import edu.wpi.first.wpilibj.CANTalon;
+import edu.wpi.first.wpilibj.command.Subsystem;
+
+public class DriveTrain extends Subsystem {
+ private CANTalon frontLeft, frontRight, rearLeft, rearRight;
+
+ public DriveTrain() {
+ frontLeft = new CANTalon(Constants.DriveTrain.FRONT_LEFT);
+ frontRight = new CANTalon(Constants.DriveTrain.FRONT_RIGHT);
+ rearLeft = new CANTalon(Constants.DriveTrain.REAR_LEFT);
+ rearRight = new CANTalon(Constants.DriveTrain.REAR_RIGHT);
+ }
+
+ @Override
+ protected void initDefaultCommand() {
+ }
+
+}