项目:snobot-2017
文件:EncoderWrapper.java
private void setEncodingFactor(EncodingType aFactor)
{
switch (aFactor)
{
case k1X:
mEncodingFactor = 1.0;
break;
case k2X:
mEncodingFactor = 0.5;
break;
case k4X:
mEncodingFactor = 0.25;
break;
default:
// This is never reached,EncodingType enum limits values
mEncodingFactor = 0.0;
break;
}
}
public DriveTrainSubsystem() {
motors = new SpeedController[RobotMap.DRIVE_TRAIN.MOTORS.length];
for (int i = 0; i < RobotMap.DRIVE_TRAIN.MOTORS.length; i++) {
motors[i] = new Victor(RobotMap.DRIVE_TRAIN.MOTORS[i]);
}
doubleSidedPid = new PIDController649(EncoderBasedDriving.AUTO_DRIVE_P,EncoderBasedDriving.AUTO_DRIVE_I,EncoderBasedDriving.AUTO_DRIVE_D,this,this);
doubleSidedPid.setAbsolutetolerance(EncoderBasedDriving.ABSOLUTE_TOLERANCE);
doubleSidedPid.setoutputRange(-EncoderBasedDriving.MAX_MOTOR_POWER,EncoderBasedDriving.MAX_MOTOR_POWER);
encoders = new Encoder[RobotMap.DRIVE_TRAIN.ENCODERS.length / 2];
for (int x = 0; x < RobotMap.DRIVE_TRAIN.ENCODERS.length; x += 2) {
encoders[x / 2] = new Encoder(RobotMap.DRIVE_TRAIN.ENCODERS[x],RobotMap.DRIVE_TRAIN.ENCODERS[x + 1],x == 0,EncodingType.k2X);
encoders[x / 2].setdistancePerpulse(EncoderBasedDriving.ENCODER_disTANCE_PER_pulse);
}
lastRates = new Vector();
shifterSolenoid = new DoubleSolenoid(RobotMap.DRIVE_TRAIN.FORWARD_SOLENOID_CHANNEL,RobotMap.DRIVE_TRAIN.REVERSE_SOLENOID_CHANNEL);
}
项目:snobot-2017
文件:EncoderWrapper.java
public EncoderWrapper(int aIndexA,int aIndexB)
{
super("Encoder (" + aIndexA + "," + aIndexB + ")");
setEncodingFactor(CounterBase.EncodingType.k4X);
mdistancePerTick = 1;
}
项目:FRC-2015-Robot-Java
文件:RobotHardwareWoodbot.java
public void initialize()
{
rearLeftMotor = new Jaguar(0);
frontLeftMotor = new Jaguar(1);
liftMotor = new Jaguar(2);
liftMotor2 = new Jaguar(3);
liftEncoder = new Encoder(6,7,false,EncodingType.k4X);
drivetrain = new RobotDrive(rearLeftMotor,frontLeftMotor);
drivetrain.setInvertedMotor(MotorType.kFrontLeft,true);
drivetrain.setInvertedMotor(MotorType.kFrontRight,true);
halsensor = new DigitalInput(0);
horizontalCamera = new Servo(8);
verticalCamera = new Servo(9);
solenoid = new DoubleSolenoid(0,1);
gyro = new Gyro(1);
accelerometer = new BuiltInAccelerometer();
liftEncoder.reset();
RobotHardwareWoodbot hardware = (RobotHardwareWoodbot)Robot.bot;
LiveWindow.addActuator("Drive Train","Front Left Motor",(Jaguar)hardware.frontLeftMotor);
LiveWindow.addActuator("Drive Train","Back Left Motor",(Jaguar)hardware.rearLeftMotor);
//LiveWindow.addActuator("Drive Train","Front Right Motor",(Jaguar)hardware.frontRightMotor);
//LiveWindow.addActuator("Drive Train","Back Right Motor",(Jaguar)hardware.rearRightMotor);
}
项目:FRC-2015-Robot-Java
文件:RobotHardwareCompbot.java
@Override
public void initialize()
{
//PWM
liftMotor = new Victor(0); //2);
leftMotors = new Victor(1);
rightMotors = new Victor(2); //0);
armMotors = new Victor(3);
transmission = new Servo(7);
//CAN
armSolenoid = new DoubleSolenoid(4,5);
//dio
liftEncoder = new Encoder(0,1,EncodingType.k4X);
liftBottomLimit = new DigitalInput(2);
liftTopLimit = new DigitalInput(3);
backupLiftBottomLimit = new DigitalInput(5);
switch1 = new DigitalInput(9);
switch2 = new DigitalInput(8);
//ANALOG
gyro = new Gyro(0);
//roboRio
accelerometer = new BuiltInAccelerometer();
//Stuff
drivetrain = new RobotDrive(leftMotors,rightMotors);
liftSpeedratio = 1; //Half power default
liftGear = 1;
driverSpeedratio = 1;
debounceComp = 0;
drivetrain.setInvertedMotor(MotorType.kRearLeft,true);
drivetrain.setInvertedMotor(MotorType.kRearRight,true);
}
项目:Woodchuck-2013
文件:Drive.java
public Drive(JoystickControl controller)
{
leftMotor = new Motor(JAGUAR_LEFT_ID,JAGUAR_LEFT_INVERTED);
rightMotor = new Motor(JAGUAR_RIGHT_ID,JAGUAR_RIGHT_INVERTED);
leftEncoderInput = new DigitalInput(ENCODER_DIGITAL_SIDECAR_CHANNEL,ENCODER_LEFT_CHANNEL);
rightEncoderInput = new DigitalInput(ENCODER_DIGITAL_SIDECAR_CHANNEL,ENCODER_RIGHT_CHANNEL);
leftEncoder = new Encoder(leftEncoderInput,leftEncoderInput,EncodingType.k1X);
rightEncoder = new Encoder(rightEncoderInput,rightEncoderInput,EncodingType.k1X);
raiseServo = new Servo(5);
this.controller = controller;
}
项目:STEAMworks
文件:DriveTrain.java
public DriveTrain() {
super();
frontLeft = new CANTalon(RobotMap.DRIVE_TRAIN_FRONT_LEFT);
frontRight = new CANTalon(RobotMap.DRIVE_TRAIN_FRONT_RIGHT);
backLeft = new CANTalon(RobotMap.DRIVE_TRAIN_BACK_LEFT);
backRight = new CANTalon(RobotMap.DRIVE_TRAIN_BACK_RIGHT);
frontLeft.set(0);
frontRight.set(0);
backLeft.set(0);
backRight.set(0);
double voltageRampRate = 150;//20;
frontLeft.setVoltageRampRate(voltageRampRate);
frontRight.setVoltageRampRate(voltageRampRate);
backLeft.setVoltageRampRate(voltageRampRate);
backRight.setVoltageRampRate(voltageRampRate);
//backRight.setCurrentLimit(0);
setBrake(false);
drive = new RobotDrive(frontLeft,backLeft,frontRight,backRight);
// Scale encoder pulses to distance in inches
double wheelDiameter = 4.0; // inches
double encoderToShaftRatio = 3; // 3X gear reduction
double pulsesPerRevolution = 256;
double stage3Ratio = 50.0 / 34.0;
double distancePerpulse = Math.PI * wheelDiameter / (encoderToShaftRatio * pulsesPerRevolution);
distancePerpulse /= stage3Ratio;
leftEncoder = new Encoder(RobotMap.DRIVE_TRAIN_ENCODER_LEFT_A,RobotMap.DRIVE_TRAIN_ENCODER_LEFT_B,true,EncodingType.k4X);
leftEncoder.reset();
leftEncoder.setdistancePerpulse(distancePerpulse);
rightEncoder = new Encoder(RobotMap.DRIVE_TRAIN_ENCODER_RIGHT_A,RobotMap.DRIVE_TRAIN_ENCODER_RIGHT_B,EncodingType.k4X);
rightEncoder.reset();
rightEncoder.setdistancePerpulse(distancePerpulse);
}
项目:2017SteamBot2
文件:DriveTrain.java
public DriveTrain() {
Robot.logList.add(this);
ahrs = new AHRS(RobotMap.Ports.AHRS);
left = new VictorSP(RobotMap.Ports.leftDriveMotor);
right = new VictorSP(RobotMap.Ports.rightDriveMotor);
right.setInverted(true);
final double gearRatio = 4/3;
final double ticksPerRev = 2048;
final double radius = 1.5;
final double magic = 1/.737;
final double calculated = (radius * 2 * Math.PI) * gearRatio * magic / ticksPerRev;
ahrs.reset();
leftEncoder = new Encoder(RobotMap.Ports.leftEncoderOne,RobotMap.Ports.leftEncoderTwo,EncodingType.k4X);
leftEncoder.setdistancePerpulse(calculated);
leftEncoder.setPIDSourceType(PIDSourceType.kRate);
rightEncoder = new Encoder(RobotMap.Ports.rightEncoderOne,RobotMap.Ports.rightEncoderTwo,EncodingType.k4X);
rightEncoder.setdistancePerpulse(calculated);
rightEncoder.setPIDSourceType(PIDSourceType.kRate);
leftPID = new PIDController(
RobotMap.Values.driveTrainP,RobotMap.Values.driveTrainI,RobotMap.Values.driveTrainD,RobotMap.Values.driveTrainF,new RateEncoder(leftEncoder),left);
leftPID.setInputRange(-300,300);
leftPID.setoutputRange(-1,1);
rightPID = new PIDController(
RobotMap.Values.driveTrainP,new RateEncoder(rightEncoder),right);
rightPID.setInputRange(-300,300);
rightPID.setoutputRange(-1,1);
// Let's show everything on the LiveWindow
LiveWindow.addActuator("Drive Train","Left Motor",(VictorSP) left);
LiveWindow.addActuator("Drive Train","Right Motor",(VictorSP) right);
LiveWindow.addSensor("Drive Train","Left Encoder",leftEncoder);
LiveWindow.addSensor("Drive Train","Right Encoder",rightEncoder);
LiveWindow.addSensor("Drive Train","Gyro",ahrs);
LiveWindow.addActuator("Drive Train","PID",leftPID);
}
项目:Bernie
文件:RobotMap.java
public static void init() {
// Sparks!
////Change for competition Robot start DONE DONE DONE DOOOONNNEE
dTSparkController1 = new Spark(2);
dTSparkController2 = new Spark(3);
dTSparkController3 = new Talon(4);
dTSparkController4 = new Talon(5);
//dTSparkController1 = new Spark(1);
//dTSparkController2 = new Spark(3);
//dTSparkController3 = new Spark(2);
//dTSparkController4 = new Spark(4);
////Change for Competition Robot end
driveTrainRobotDrive = new RobotDrive(dTSparkController1,dTSparkController2,dTSparkController3,dTSparkController4);
winchMotor = new CANTalon(7);
armMotor = new CANTalon(8);
//remember CANTalons are named by the RIO Interface ID number
//parallelBar = new CANTalon(9);
////Change for Competition Robot start DONE DONE DONE DOOOONNNEE
intakeRoller = new Talon(1);
//intakeRoller = new Talon(6);
////Change for Competition Robot end
intake = new Talon(6);
// Encoder Code CP&P - Fred
EncoderLeft = new Encoder(2,3,EncodingType.k4X);
LiveWindow.addSensor("Encoders","Quadrature Encoder Left",EncoderLeft);
EncoderLeft.setSamplesToAverage(5);
EncoderLeft.setdistancePerpulse(1.0/360);
//EncoderLeft.setPIDSourceParameter(PIDSourceParameter.kdistance);
EncoderRight = new Encoder(4,5,"Quadrature EncoderRight",EncoderRight);
EncoderRight.setSamplesToAverage(5);
EncoderRight.setdistancePerpulse(1.0/360);
ParallelEncoder = new Encoder(0,"Quadrature Encoder Arm",ParallelEncoder);
ParallelEncoder.setSamplesToAverage(5);
ParallelEncoder.setdistancePerpulse(1.0/360);
//Ultrasonic ultra = new Ultrasonic(6,7);
//ultra.setAutomaticMode(true);
PressureGauge = new AnalogInput(4);
limitSwitch = new DigitalInput(9);
// Change for Practice to Competition Robot DONE DONE DONE DOOOONNNEE
wCylinder = new Solenoid(1);
trigger = new Solenoid(2);
//wCylinder = new DoubleSolenoid(3,4);
//trigger = new DoubleSolenoid(1,2);
// Change for Practice to Competition Robot End
//light = new DoubleSolenoid(3,1);
navXBoard = new SerialPort(57600,SerialPort.Port.kMXP);
byte update_rate_hz = 50;
imu = new AHRS(navXBoard,update_rate_hz);
pneumaticsCompressor = new Compressor(0);
}
public static void init() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrainleftFrontTalon0 = new TalonSRX(0);
LiveWindow.addActuator("DriveTrain","leftFrontTalon0",(TalonSRX) driveTrainleftFrontTalon0);
driveTrainleftBackTalon1 = new TalonSRX(1);
LiveWindow.addActuator("DriveTrain","leftBackTalon1",(TalonSRX) driveTrainleftBackTalon1);
driveTrainrightFrontTalon2 = new TalonSRX(2);
LiveWindow.addActuator("DriveTrain","rightFrontTalon2",(TalonSRX) driveTrainrightFrontTalon2);
driveTrainrightBackTalon3 = new TalonSRX(3);
LiveWindow.addActuator("DriveTrain","rightBackTalon3",(TalonSRX) driveTrainrightBackTalon3);
driveTrainRobotDrive = new RobotDrive(driveTrainleftFrontTalon0,driveTrainleftBackTalon1,driveTrainrightFrontTalon2,driveTrainrightBackTalon3);
driveTrainRobotDrive.setSafetyEnabled(true);
driveTrainRobotDrive.setExpiration(0.1);
driveTrainRobotDrive.setSensitivity(0.5);
driveTrainRobotDrive.setMaxOutput(1.0);
driveTraingyro = new Gyro(0);
LiveWindow.addSensor("DriveTrain","gyro",driveTraingyro);
driveTraingyro.setSensitivity(0.007);
driveTrainleftFrontEncoder = new Encoder(17,18,EncodingType.k4X);
LiveWindow.addSensor("DriveTrain","leftFrontEncoder",driveTrainleftFrontEncoder);
driveTrainleftFrontEncoder.setdistancePerpulse(1.0);
driveTrainleftFrontEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
driveTrainleftBackEncoder = new Encoder(19,20,"leftBackEncoder",driveTrainleftBackEncoder);
driveTrainleftBackEncoder.setdistancePerpulse(1.0);
driveTrainleftBackEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
driveTrainrightFrontEncoder = new Encoder(21,22,"rightFrontEncoder",driveTrainrightFrontEncoder);
driveTrainrightFrontEncoder.setdistancePerpulse(1.0);
driveTrainrightFrontEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
driveTrainrightBackEncoder = new Encoder(23,24,"rightBackEncoder",driveTrainrightBackEncoder);
driveTrainrightBackEncoder.setdistancePerpulse(1.0);
driveTrainrightBackEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
public static void init() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrainleftMotor = new Talon(0);
LiveWindow.addActuator("DriveTrain","leftMotor",(Talon) driveTrainleftMotor);
driveTrainrightMotor = new Talon(1);
LiveWindow.addActuator("DriveTrain","rightMotor",(Talon) driveTrainrightMotor);
driveTrainMotors = new RobotDrive(driveTrainleftMotor,driveTrainrightMotor);
driveTrainMotors.setSafetyEnabled(true);
driveTrainMotors.setExpiration(0.1);
driveTrainMotors.setSensitivity(0.5);
driveTrainMotors.setMaxOutput(1.0);
driveTrainwheelRotations = new Encoder(2,"wheelRotations",driveTrainwheelRotations);
driveTrainwheelRotations.setdistancePerpulse(0.102);
driveTrainwheelRotations.setPIDSourceParameter(PIDSourceParameter.kRate);
driveTraingyro = new Gyro(0);
LiveWindow.addSensor("DriveTrain",driveTraingyro);
driveTraingyro.setSensitivity(0.0015);
driveTrainrangeFinder = new AnalogInput(1);
LiveWindow.addSensor("DriveTrain","rangeFinder",driveTrainrangeFinder);
armSolenoid = new DoubleSolenoid(0,1);
LiveWindow.addActuator("Arms","armSolenoid",armSolenoid);
armWidthLimit = new DigitalInput(1);
LiveWindow.addSensor("Arms","armWidthLimit",armWidthLimit);
elevatorlimitSwitch = new DigitalInput(0);
LiveWindow.addSensor("Elevator","limitSwitch",elevatorlimitSwitch);
elevatorSolenoid = new DoubleSolenoid(0,6,7);
LiveWindow.addActuator("Elevator","elevatorSolenoid",elevatorSolenoid);
rcSolenoid = new DoubleSolenoid(0,4,5);
LiveWindow.addActuator("RC Picker Upper Sole","rcSolenoid",rcSolenoid);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:HolonomicDrive
文件:RobotMap.java
public static void init()
{
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrainLeftFront = new Talon(0);
LiveWindow.addActuator("DriveTrain","Left Front",(Talon) driveTrainLeftFront);
driveTrainLeftRear = new Talon(1);
LiveWindow.addActuator("DriveTrain","Left Rear",(Talon) driveTrainLeftRear);
driveTrainRightFront = new Talon(2);
LiveWindow.addActuator("DriveTrain","Right Front",(Talon) driveTrainRightFront);
driveTrainRightRear = new Talon(3);
LiveWindow.addActuator("DriveTrain","Right Rear",(Talon) driveTrainRightRear);
driveTrainHolonomicDrive = new RobotDrive(driveTrainLeftFront,driveTrainLeftRear,driveTrainRightFront,driveTrainRightRear);
driveTrainHolonomicDrive.setSafetyEnabled(false);
driveTrainHolonomicDrive.setExpiration(0.1);
driveTrainHolonomicDrive.setSensitivity(0.5);
driveTrainHolonomicDrive.setMaxOutput(1.0);
driveTrainHolonomicDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
driveTrainHolonomicDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight,true);
forkliftMotor = new Talon(4);
LiveWindow.addActuator("Forklift","Motor",(Talon) forkliftMotor);
forkliftEncoder = new Encoder(0,EncodingType.k4X);
LiveWindow.addSensor("Forklift","Encoder",forkliftEncoder);
forkliftEncoder.setdistancePerpulse(0.012);
forkliftEncoder.setPIDSourceParameter(PIDSourceParameter.kdistance);
rollerMotor = new Talon(5);
LiveWindow.addActuator("Roller",(Talon) rollerMotor);
stabilizerBackLeft = new Servo(6);
LiveWindow.addActuator("Stabilizer","Back Left",stabilizerBackLeft);
stabilizerBackRight = new Servo(8);
LiveWindow.addActuator("Stabilizer","Back Right",stabilizerBackRight);
stabilizerFrontLeft = new Servo(7);
LiveWindow.addActuator("Stabilizer","Front Left",stabilizerFrontLeft);
stabilizerFrontRight = new Servo(9);
LiveWindow.addActuator("Stabilizer","Front Right",stabilizerFrontRight);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrainGyro = new HVAGyro(0);
LiveWindow.addSensor("DriveTrain",driveTrainGyro);
driveTrainGyro.setSensitivity(0.007);
powerdistributionPanel = new PowerdistributionPanel();
}
项目:2013_drivebase_proto
文件:WsDriveBase.java
public WsDriveBase(String name) {
super(name);
WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(),"wheel_diameter",6);
TICKS_PER_ROTATION_config = new DoubleConfigFileParameter(this.getClass().getName(),"ticks_per_rotation",360.0);
THRottLE_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(),"throttle_low_gear_accel_factor",0.250);
heading_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(),"heading_low_gear_accel_factor",0.500);
THRottLE_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(),"throttle_high_gear_accel_factor",0.125);
heading_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(),"heading_high_gear_accel_factor",0.250);
MAX_HIGH_GEAR_PERCENT_config = new DoubleConfigFileParameter(this.getClass().getName(),"max_high_gear_percent",0.80);
ENCODER_GEAR_RATIO_config = new DoubleConfigFileParameter(this.getClass().getName(),"encoder_gear_ratio",7.5);
DEADBAND_config = new DoubleConfigFileParameter(this.getClass().getName(),"deadband",0.05);
SLOW_TURN_FORWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(),"slow_turn_forward_speed",0.16);
SLOW_TURN_BACKWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(),"slow_turn_backward_speed",-0.19);
Feed_FORWARD_VELociTY_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(),"Feed_forward_veLocity_constant",1.00);
Feed_FORWARD_acceleration_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(),"Feed_forward_acceleration_constant",0.00018);
MAX_acceleration_DRIVE_PROFILE_config = new DoubleConfigFileParameter(this.getClass().getName(),"max_acceleration_drive_profile",600.0);
MAX_SPEED_INCHES_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(),"max_speed_inches_lowgear",90.0);
DECELERATION_VELociTY_THRESHOLD_config = new DoubleConfigFileParameter(this.getClass().getName(),"deceleration_veLocity_threshold",48.0);
DECELERATION_MOTOR_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(),"deceleration_motor_speed",0.3);
STOPPING_disTANCE_AT_MAX_SPEED_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(),"stopping_distance_at_max_speed_lowgear",10.0);
DRIVE_OFFSET_config = new AutonomousDoubleConfigFileParameter("DriveOffset",1.00);
USE_LEFT_SIDE_FOR_OFFSET_config = new AutonomousBooleanConfigFileParameter("UseLeftDriveForOffset",true);
QUICK_TURN_CAP_config = new DoubleConfigFileParameter(this.getClass().getName(),"quick_turn_cap",10.0);
QUICK_TURN_ANTITURBO_config = new DoubleConfigFileParameter(this.getClass().getName(),"quick_turn_antiturbo",10.0);
//Anti-Turbo button
registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_8);
//Turbo button
registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_7);
//Shifter Button
registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_6);
//Left/right slow turn buttons
registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_1);
registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_3);
//Initialize the drive base encoders
leftDriveEncoder = new Encoder(2,EncodingType.k4X);
leftDriveEncoder.reset();
leftDriveEncoder.start();
rightDriveEncoder = new Encoder(4,EncodingType.k4X);
rightDriveEncoder.reset();
rightDriveEncoder.start();
//Initialize the gyro
//@Todo: Get the correct port
driveheadingGyro = new Gyro(1);
//Initialize the PIDs
drivedistancePidInput = new WsDriveBasedistancePidinput();
drivedistancePidOutput = new WsDriveBasedistancePidOutput();
drivedistancePid = new WsPidController(drivedistancePidInput,drivedistancePidOutput,"WsDriveBasedistancePid");
driveheadingPidInput = new WsDriveBaseheadingPidinput();
driveheadingPidOutput = new WsDriveBaseheadingPidOutput();
driveheadingPid = new WsPidController(driveheadingPidInput,driveheadingPidOutput,"WsDriveBaseheadingPid");
driveSpeedPidInput = new WsDriveBaseSpeedPidinput();
driveSpeedPidOutput = new WsDriveBaseSpeedPidOutput();
driveSpeedPid = new WsspeedPidController(driveSpeedPidInput,driveSpeedPidOutput,"WsDriveBaseSpeedPid");
continuousaccelerationFilter = new ContinuousAccelFilter(0,0);
init();
}
项目:2013_drivebase_proto
文件:Encoder.java
public Encoder(int i,int j,boolean t,EncodingType e) {
//Do nothing
}
项目:CMonster2014
文件:RobotMap.java
public static void init() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveSubsystemFrontLeftJaguar = new Jaguar(1,1);
LiveWindow.addActuator("Drive Subsystem","Front Left Jaguar",(Jaguar) driveSubsystemFrontLeftJaguar);
driveSubsystemFrontRightJaguar = new Jaguar(1,2);
LiveWindow.addActuator("Drive Subsystem","Front Right Jaguar",(Jaguar) driveSubsystemFrontRightJaguar);
driveSubsystemRearLeftJaguar = new Jaguar(1,3);
LiveWindow.addActuator("Drive Subsystem","Rear Left Jaguar",(Jaguar) driveSubsystemRearLeftJaguar);
driveSubsystemRearRightJaguar = new Jaguar(1,4);
LiveWindow.addActuator("Drive Subsystem","Rear Right Jaguar",(Jaguar) driveSubsystemRearRightJaguar);
driveSubsystemRearRightEncoder = new Encoder(1,2,EncodingType.k2X);
LiveWindow.addSensor("Drive Subsystem","Rear Right Encoder",driveSubsystemRearRightEncoder);
driveSubsystemRearRightEncoder.setdistancePerpulse(0.002908882);
driveSubsystemRearRightEncoder.setPIDSourceParameter(PIDSourceParameter.kdistance);
driveSubsystemRearRightEncoder.start();
compressorSubsystemCompressor = new Compressor(1,1);
sweeperSubsystemSolenoid = new Solenoid(1,2);
LiveWindow.addActuator("sweeper Subsystem","Solenoid",sweeperSubsystemSolenoid);
sweeperSubsystemJaguar = new Jaguar(1,5);
LiveWindow.addActuator("sweeper Subsystem","Jaguar",(Jaguar) sweeperSubsystemJaguar);
catcherSubsytemSolenoid = new Solenoid(1,1);
LiveWindow.addActuator("Catcher Subsytem",catcherSubsytemSolenoid);
ledSubsystemPin0 = new DigitalOutput(1,4);
ledSubsystemPin1 = new DigitalOutput(1,5);
ledSubsystemPin2 = new DigitalOutput(1,6);
ledSubsystemPin3 = new DigitalOutput(1,7);
ledSubsystemPin4 = new DigitalOutput(1,8);
ledSubsystemPin5 = new DigitalOutput(1,9);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveSubsystemSteeringGyro = new BetterGyro(1,1);
driveSubsystemSteeringGyroTemp = new TempSensor(2);
driveSubsystemAccelerometer = new ADXL345_I2C(1,ADXL345_I2C.DataFormat_Range.k4G);
}
项目:2014_software
文件:DriveBase.java
public DriveBase(String name) {
super(name);
WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(),10.0);
//Anti-Turbo button
registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_8);
//Turbo button
registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_7);
//Shifter Button
registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_6);
//Initialize the drive base encoders
leftDriveEncoder = new Encoder(2,EncodingType.k4X);
rightDriveEncoder.reset();
rightDriveEncoder.start();
//Initialize the gyro
//@Todo: Get the correct port
driveheadingGyro = new Gyro(1);
continuousaccelerationFilter = new ContinuousAccelFilter(0,0);
driveSpeedPidInput = new DriveBaseSpeedPidinput();
driveSpeedPidOutput = new DriveBaseSpeedPidOutput();
driveSpeedPid = new SpeedPidController(driveSpeedPidInput,"DriveBaseSpeedPid");
init();
}
项目:2014_software
文件:Encoder.java
public Encoder(int i,EncodingType e) {
//Do nothing
}
项目:2013_robot_software
文件:WsDriveBase.java
public WsDriveBase(String name) {
super(name);
WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(),10.0);
//Anti-Turbo button
Subject subject = WsInputManager.getInstance().getoiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON8);
subject.attach(this);
//Turbo button
subject = WsInputManager.getInstance().getoiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON7);
subject.attach(this);
//Shifter Button
subject = WsInputManager.getInstance().getoiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON6);
subject.attach(this);
//Left/right slow turn buttons
subject = WsInputManager.getInstance().getoiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON1);
subject.attach(this);
subject = WsInputManager.getInstance().getoiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON3);
subject.attach(this);
//Initialize the drive base encoders
leftDriveEncoder = new Encoder(2,0);
init();
}
项目:2013_robot_software
文件:Encoder.java
public Encoder(int i,EncodingType e) {
//Do nothing
}