Possible case issue fix
This commit is contained in:
parent
e04f4ba346
commit
d50d7e8556
21
src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java
Normal file
21
src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package org.usfirst.frc.team2059.robot.subsystems;
|
||||||
|
import org.usfirst.frc.team2059.robot.RobotMap;
|
||||||
|
import org.usfirst.frc.team2059.robot.commands.Drive;
|
||||||
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
|
import edu.wpi.first.wpilibj.CANTalon;
|
||||||
|
public class DriveBase extends Subsystem {
|
||||||
|
CANTalon leftMotorOne = new CANTalon(RobotMap.driveLeftMotorOne);
|
||||||
|
CANTalon leftMotorTwo = new CANTalon(RobotMap.driveLeftMotorTwo);
|
||||||
|
CANTalon rightMotorOne = new CANTalon(RobotMap.driveRightMotorOne);
|
||||||
|
CANTalon rightMotorTwo = new CANTalon(RobotMap.driveRightMotorOne);
|
||||||
|
public void initDefaultCommand() {
|
||||||
|
setDefaultCommand(new Drive());
|
||||||
|
}
|
||||||
|
public void driveArcade(double x, double y, double z, double sensitivity) {
|
||||||
|
leftMotorOne.set(-y + (x + z));
|
||||||
|
leftMotorTwo.set(-y + (x + z));
|
||||||
|
rightMotorOne.set(y + (x + z));
|
||||||
|
rightMotorTwo.set(y + (x + z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// vim: sw=2:ts=2:sts=2
|
@ -0,0 +1,29 @@
|
|||||||
|
package org.usfirst.frc.team2059.robot.subsystems;
|
||||||
|
import org.usfirst.frc.team2059.robot.RobotMap;
|
||||||
|
import org.usfirst.frc.team2059.robot.commands.Drive;
|
||||||
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
|
import edu.wpi.first.wpilibj.Encoder;
|
||||||
|
import org.usfirst.frc.team2059.robot.structs.EncoderValues;
|
||||||
|
public class EncoderBase extends Subsystem {
|
||||||
|
Encoder enc = new Encoder(0, 1, false, Encoder.EncodingType.k4X);
|
||||||
|
public void initDefaultCommand() {
|
||||||
|
//TODO: Not sure if we need a default command, not settingo one
|
||||||
|
//TODO: These are just defaults, they wil lneed to be changed
|
||||||
|
enc.setMaxPeriod(.1);
|
||||||
|
enc.setMinRate(10);
|
||||||
|
enc.setDistancePerPulse(5);
|
||||||
|
enc.setReverseDirection(false);
|
||||||
|
enc.setSamplesToAverage(7);
|
||||||
|
}
|
||||||
|
public void resetEncoder() {
|
||||||
|
enc.reset();
|
||||||
|
}
|
||||||
|
public EncoderValues getValues() {
|
||||||
|
//TODO: There are two ways to get distance:
|
||||||
|
//enc.getDistance();
|
||||||
|
//enc.getRaw();
|
||||||
|
//figure out which to use
|
||||||
|
return new EncoderValues(enc.get() , enc.getRaw() , enc.getPeriod() , enc.getRate() , enc.getDirection() , enc.getStopped());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// vim: sw=2:ts=2:sts=2
|
Loading…
Reference in New Issue
Block a user