项目:aeronautical-facilitation
文件:DriveTrain.java
/**
*
*/
public DriveTrain() {
super("DriveTrain");
FLeftMotor = new Victor(RobotMap.FLeftMotorPWM);
FRightMotor = new Victor(RobotMap.FRightMotorPWM);
BLeftMotor = new Victor(RobotMap.BLeftMotorPWM);
BRightMotor = new Victor(RobotMap.BRightMotorPWM);
//MLeftMotor = new Victor(RobotMap.MLeftMotorPWM);
//MRightMotor = new Victor(RobotMap.MRightMotorPWM);
drive = new RobotDrive(FLeftMotor,BLeftMotor,FRightMotor,BRightMotor);
//drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
//drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft,true);
GShiftSolDown = new Solenoid(RobotMap.DriveTrainLowGearSolenoid);
GShiftSolUp = new Solenoid(RobotMap.DriveTrainHighGearSolenoid);
display = DriverStationLCD.getInstance();
}
项目:2014Robot-
文件:RoboDrive.java
public RoboDrive(){
try {
//creates the motors
aLeft = new CANJaguar(RobotMap.LEFT_DRIVE_MOTOR_ALPHA);
bLeft = new CANJaguar(RobotMap.LEFT_DRIVE_MOTOR_BETA);//,CANJaguar.ControlMode.kSpeed);
aRight = new CANJaguar(RobotMap.RIGHT_DRIVE_MOTOR_ALPHA);
bRight = new CANJaguar(RobotMap.RIGHT_DRIVE_MOTOR_BETA);//,CANJaguar.ControlMode.kSpeed);
//creates the drive train
roboDrive = new RobotDrive(aLeft,bLeft,aRight,bRight);
roboDrive.setSafetyEnabled(false);
} catch(CANTimeoutException ex) {
ex.printstacktrace();
}
}
项目:rover
文件:Drivetrain.java
public Drivetrain()
{
frontModule = new SwerveModule(RobotMap.frontWheelEncoder,RobotMap.frontModuleEncoder,RobotMap.frontWheelMotor,RobotMap.frontModuleMotor,RobotMap.WHEEL_TOP_ABSOLUTE_SPEED,RobotMap.FRONT_BACK_LENGTH/2,"frontModule");
leftModule = new SwerveModule(RobotMap.leftWheelEncoder,RobotMap.leftModuleEncoder,RobotMap.leftWheelMotor,RobotMap.leftModuleMotor,-RobotMap.LEFT_RIGHT_WIDTH/2,"leftModule");
backModule = new SwerveModule(RobotMap.backWheelEncoder,RobotMap.backModuleEncoder,RobotMap.backWheelMotor,RobotMap.backModuleMotor,-RobotMap.FRONT_BACK_LENGTH/2,"backModule");
rightModule = new SwerveModule(RobotMap.rightWheelEncoder,RobotMap.rightModuleEncoder,RobotMap.rightWheelMotor,RobotMap.rightModuleMotor,RobotMap.LEFT_RIGHT_WIDTH/2,"rightModule");
//We were having occasional errors with the creation of the nav6 object,so we make 5 attempts before allowing the error to go through and being forced to redeploy.
int count = 0;
int maxTries = 5;
while(true) {
try {
nav6 = new IMUAdvanced(new BufferingSerialPort(57600));
if(nav6 != null) break;
} catch (ViSAException e) {
if (++count == maxTries)
{
e.printstacktrace();
break;
}
Timer.delay(.01);
}
}
LiveWindow.addSensor("Drivetrain","Gyro",nav6);
}
项目:legacy
文件:Autonomous1.java
public Autonomous1() {
System.out.println("Auton");
addParallel(new SetShooter(RobotMap.preset1),5.0);
addSequential(new ChangeElevation(true),5.0);
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new ShooterReady());
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new KickHopper());
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new ShooterReady());
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new KickHopper());
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new ShooterReady());
addParallel(new SetShooter(RobotMap.preset1));
addSequential(new KickHopper());
addSequential(new SetShooter(0.0),1.0);
}
项目:legacy
文件:Drivetrain.java
public boolean target() {
gyro.reset();
double leftValue = limit((getGyroAngle()-aimRotation)*-RobotMap.rotationKp);
double rightValue = limit((getGyroAngle()-aimRotation)*RobotMap.rotationKp);
if (leftValue<0) drive.tankDrive(-2.0+leftValue,2.0+rightValue);
else drive.tankDrive(2.0+leftValue,-2.0+rightValue);
if((getGyroAngle()>=-0.5 && getGyroAngle()<=0.5)) {
double checkRotation = getimage();
if ((getGyroAngle()-checkRotation>=-0.5) && (getGyroAngle()-checkRotation<=0.5)) {
drive.drive(0.0,0.0);
return true;
} else return false;
} else return false;
}
项目:ScraperBike2013
文件:UpdateSolenoidModule.java
protected void execute() {
// for (int i = 0; i < 8; i++){
//
// switch(i){
//
// case 1:
//
// }
// }
RobotMap.shifter_2.set(!RobotMap.shifter.get());
RobotMap.powerTakeoff_2.set(!RobotMap.powerTakeoff.get());
RobotMap.frontPusherFirst_2.set(!RobotMap.frontPusherFirst.get());
RobotMap.frontPusherSecond_2.set(!RobotMap.frontPusherSecond.get());
RobotMap.rearPusher_2.set(!RobotMap.rearPusher.get());
RobotMap.popper_2.set(!RobotMap.popper.get());
RobotMap.popper2_2.set(!RobotMap.popper2.get());
}
项目:ScraperBike2013
文件:ShooterElevationPID.java
protected void execute() {
this.determineSetpoint();
if (lastAngle != RobotMap.desiredShooterangle) {
VerticalTurretAxis.resetGyro();
lastAngle = RobotMap.desiredShooterangle;
}
// if (RobotMap.desiredShooterangle != 0.0) {
//
// VerticalTurretAxis.getGyro();
// this.setSetpoint(RobotMap.desiredShooterangle);
// //VerticalTurretAxis = RobotMap.desiredShooterangle;
// }
//
// if (Math.abs (RobotMap.desiredShooterangle - VerticalTurretAxis.readGyroDegress()) < 0.5) {
// RobotMap.desiredShooterangle = 0.0;
// }
}
项目:frc-3186
文件:ShooterMotorControl.java
public ShooterMotorControl() {
super("ShooterControl",Kp,Ki,Kd);
Encoder topEncoder = new Encoder(RobotMap.topEncoderChannelA,RobotMap.topEncoderChannelB);
Encoder bottomEncoder = new Encoder(RobotMap.bottomEncoderChannelA,RobotMap.bottomEncoderChannelB);
try {
shooterJagTop = new CANJaguar(RobotMap.shooterJagTopID);
shooterJagBottom = new CANJaguar(RobotMap.shooterJagBottomID);
} catch (CANTimeoutException e) {
e.printstacktrace();
}
// Use these to get going:
// setSetpoint() - Sets where the PID controller should move the system
// to
// enable() - Enables the PID controller.
enable();
}
项目:aeronautical-facilitation
文件:Pass.java
项目:aeronautical-facilitation
文件:AutoDriveForward.java
protected void execute() {
theDriveTrain.drive(RobotMap.Autonomousspeed);
if (time.get() > 1.00) {
timesup = true;
}
}
项目:aeronautical-facilitation
文件:Launch.java
项目:aeronautical-facilitation
文件:Launcher.java
public void launch() {
if (launcherSafetySwitch.get() == RobotMap.SafetoFire) {
launcherLeft.set(RobotMap.LaunchSolenoidValue);
launcherRight.set(RobotMap.LaunchSolenoidValue);
} else if (launcherSafetySwitch.get() != RobotMap.SafetoFire) {
launcherLeft.set(!RobotMap.LaunchSolenoidValue);
launcherRight.set(!RobotMap.LaunchSolenoidValue);
}
}
项目:aeronautical-facilitation
文件:Launcher.java
public void pass() {
if (launcherSafetySwitch.get() == RobotMap.SafetoFire) {
launcherLeft.set(RobotMap.LaunchSolenoidValue);
launcherRight.set(!RobotMap.LaunchSolenoidValue);
} else if (launcherSafetySwitch.get() != RobotMap.SafetoFire) {
launcherLeft.set(!RobotMap.LaunchSolenoidValue);
launcherRight.set(!RobotMap.LaunchSolenoidValue);
}
}
项目:aeronautical-facilitation
文件:DriveTrain.java
项目:aeronautical-facilitation
文件:DriveTrain.java
项目:2014Robot-
文件:Catapult.java
public Catapult() {
try {
//creates the motors
Arm2 = new CANJaguar(RobotMap.CATAPULT_MOTOR);//,CANJaguar.ControlMode.kSpeed);
} catch (CANTimeoutException ex) {
ex.printstacktrace();
}
}
项目:2014Robot-
文件:Arm.java
public Arm(){
try {
//creates the motors
arm = new CANJaguar(RobotMap.ARM_MOTOR);//,CANJaguar.ControlMode.kSpeed);
} catch(CANTimeoutException ex) {
ex.printstacktrace();
}
}
项目:rover
文件:Drivetrain.java
public boolean isOverRotated()
{
return Math.abs(frontModule.getModuleAngle()) > RobotMap.MAX_MODULE_ANGLE
|| Math.abs(leftModule.getModuleAngle()) > RobotMap.MAX_MODULE_ANGLE
|| Math.abs(backModule.getModuleAngle()) > RobotMap.MAX_MODULE_ANGLE
|| Math.abs(rightModule.getModuleAngle()) > RobotMap.MAX_MODULE_ANGLE;
}
项目:legacy
文件:UserHopper.java
protected void execute() {
switch(state) {
case 0:
startTime = System.currentTimeMillis();
hopper.set(true);
state = 1;
break;
case 1: //On
if(startTime+RobotMap.hopperKickLength*1000<=System.currentTimeMillis()) state = 2;
break;
case 2:
startTime = System.currentTimeMillis();
hopper.set(false);
state = 3;
break;
case 3: //Off
if(startTime+RobotMap.hopperKickReturnLength*1000<=System.currentTimeMillis()) state = 4;
break;
case 4: //Check
if(oi.gunStick.getRawButton(RobotMap.hopperKickerButton)) state = 0;
break;
}
}
项目:legacy
文件:Shooter.java
public Shooter() {
spinner = new Victor(RobotMap.spinnerVictor);
spinnerEncoder = new Encoder(RobotMap.spinnerEncoderA,RobotMap.spinnerEncoderB);
spinnerEncoder.setdistancePerpulse(-RobotMap.spinnerEncoderdistancePerpulse);
pid = new PIDController(RobotMap.spinnerKp,RobotMap.spinnerKi,RobotMap.spinnerKd,this,this);
//pid.setPercentTolerance(0.5);
}
项目:legacy
文件:Drivetrain.java
public void changeGears(boolean lowGear) {
boolean isEnabled = leftPID.isEnable() && rightPID.isEnable();
if(lowGear) {
leftPID.setPID(RobotMap.driveLowKp,RobotMap.driveLowKi,RobotMap.driveLowKd);
} else {
rightPID.setPID(RobotMap.driveHighKp,RobotMap.driveHighKi,RobotMap.driveHighKd);
}
if(!isEnabled) {
leftPID.reset();
rightPID.reset();
}
}
protected void usePIDOutput(double output) {
// Only give the PIDcommand output if the manual control is not on.
//this.driveTrain.rotate(-output*.55);
ScraperBike.debugToTable("DriveTrain targeting","Speed: " + RobotMap.LatMovOut + ",Rotation: " + output*.63);
if (Math.abs(RobotMap.LatMovOut) >= .1)
{
this.driveTrain.drive(RobotMap.LatMovOut*.3,-output*.63);
} else if (Math.abs(RobotMap.LatMovOut) < .1)
{
this.driveTrain.rotate(-output*.63);
}
}
项目:ScraperBike2013
文件:Shoot.java
/**
*
*/
public Shoot() {
super("Shoot");
shooter = ScraperBike.getShooterController();
requires(shooter);
joystick = RobotMap.dStick;
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}
项目:ScraperBike2013
文件:EnableJoystick.java
/**
*
*/
public EnableJoystick() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
super("EnableJoystick");
RobotMap.enableJoystick();
}
项目:ScraperBike2013
文件:SetpointRealignment.java
protected void execute() {
switch (Direction) {
case RobotMap.realignLeft: RobotMap.cameraXOffset += 1;
break;
case RobotMap.realignRight: RobotMap.cameraXOffset -= 1;
break;
case RobotMap.realignCenter: RobotMap.cameraXOffset = (double)RobotMap.defaultCameraOffset;
break;
}
}
项目:ScraperBike2013
文件:PIDShoot.java
/**
*
*/
public PIDShoot() {
super("PIDShoot",RobotMap.shooterKp,RobotMap.shooterKi,RobotMap.shooterKd);
getPIDController().setContinuous(false);
this.shooter = ScraperBike.getShooterController();
requires(this.shooter);
//RobotMap.shootRPM = rpm;
//this.getPIDController().setSetpoint(RobotMap.shootRPM);
this.getPIDController().setoutputRange(0.0,1.0);
this.getPIDController().setPercentTolerance(2);
}
项目:ScraperBike2013
文件:PIDShoot.java
/**
*
* @return
*/
protected double returnPIDinput() {
// Return your input value for the PID loop
// e.g. a sensor,like a potentiometer:
// yourPot.getAverageVoltage() / kYourMaxVoltage;
ScraperBike.debugToTable("PIDInput",RobotMap.shootEncoder.getRate()*60);
return RobotMap.shootEncoder.getRate()*60;
}
项目:ScraperBike2013
文件:PauseCancel.java
项目:ScraperBike2013
文件:Pusher.java
/** The Pusher constructor is called by the ScraperBike constructor.
*
*/
public Pusher() {
frontgripDeployed1 = false;
frontgripDeployed2 = false;
reargripDeployed = false;
frontgripContacted = false;
reargripContacted = false;
frontSolenoid1 = RobotMap.frontPusherFirst; // Solenoid 3
frontSolenoid2 = RobotMap.frontPusherSecond; // Solenoid 4
rearSolenoid = RobotMap.rearPusher; // Solenoid 5
this.moveFrontPusher(0);
this.moveRearPusher(0);
}
项目:ScraperBike2013
文件:VerticalTurretAxis.java
/** The VerticalTurretAxis constructor is called by the ScraperBike constructor.
*
*/
public VerticalTurretAxis(){
super("VerticalTurretAxis");
verTurretTalon = new Talon(RobotMap.VerTurretMotor);
gyro = new Gyro(RobotMap.gyroAnalogInput);
}
项目:ScraperBike2013
文件:DriveTrain.java
/** The DriveTrain constructor is called by the ScraperBike constructor.
*
*/
public DriveTrain(){
super("Drive Train");
// Log = new MetaCommandLog("DriveTrain","Left Jaguars,Right Jaguars");
//gyro1 = new Gyro(RobotMap.AnalogSideCar,RobotMap.DriveTrainGyroInput);
shifter = RobotMap.shifter; // Solenoid 1
powerTakeOff = RobotMap.powerTakeoff; // Solenoid 2
//shifter.setDirection(Relay.Direction.kBoth);
FrontLeftTalon = new Talon(RobotMap.frontLeftMotor);
RearLeftTalon = new Talon(RobotMap.rearLeftMotor);
FrontRightTalon = new Talon(RobotMap.frontRightMotor);
RearRightTalon = new Talon(RobotMap.rearRightMotor);
drive = new RobotDrive(FrontLeftTalon,RearLeftTalon,FrontRightTalon,RearRightTalon);
//drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft,true);
//drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
//drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft,true);
//drive.setInvertedMotor(RobotDrive.MotorType.kRearRight,true);
//lfFrontJag = new Jaguar (3);
//rtFrontJag = new Jaguar (4);
//joystick2 = new Joystick(2);
//sensor1 = new DigitalInput(1);
//sensor2 = new DigitalInput (2);
}
项目:GearsBot
文件:Elevator.java
public Elevator() {
super("Elevator",Kd);
motor = new Jaguar(RobotMap.elevatorMotor);
pot = new AnalogChannel(RobotMap.elevatorPot);
// Set default position and start PID
setSetpoint(STOW);
enable();
}
项目:GearsBot
文件:Wrist.java
public Wrist() {
super("Wrist",Kd);
motor = new Victor(RobotMap.wristMotor);
pot = new AnalogChannel(RobotMap.wristpot);
// Set the starting setpoint and have PID start running in the background
setSetpoint(STOW);
enable(); // - Enables the PID controller.
}
项目:aeronautical-facilitation
文件:Launcher.java
/**
*
*/
public Launcher() {
launcherLeft = new Solenoid(RobotMap.LaunchLeftSolenoid);
launcherRight = new Solenoid(RobotMap.LaunchRightSolenoid);
launcherSafetySwitch = new DigitalInput(RobotMap.LauncherSafetyDigitalInput);
}
项目:aeronautical-facilitation
文件:Launcher.java
public void retract() {
launcherLeft.set(!RobotMap.LaunchSolenoidValue);
launcherRight.set(!RobotMap.LaunchSolenoidValue);
}
项目:aeronautical-facilitation
文件:Roller.java
/**
*
*/
public Roller() {
rollermotor = new Victor(RobotMap.RollerMotorPWM);
extendPiston = new Solenoid(RobotMap.RollerExtensionSolenoid);
retractPiston = new Solenoid(RobotMap.RollerRetractSolenoid);
}
项目:aeronautical-facilitation
文件:Roller.java
public void setRolleroff() {
rollermotor.set(RobotMap.RollerOffMotorSpeed);
}
项目:aeronautical-facilitation
文件:Roller.java
public void setRelease() {
rollermotor.set(RobotMap.RollerReleaseMotorSpeed);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。