Java 类edu.wpi.first.wpilibj.RobotDrive 实例源码

项目:2017-emmet    文件:RobotMap.java   
public static void init() {
    driveTrainCIMRearLeft = new CANTalon(2); // rear left motor
    driveTrainCIMFrontLeft = new CANTalon(12); // 
    driveTrainCIMRearRight = new CANTalon(1);
    driveTrainCIMFrontRight = new CANTalon(11);
    driveTrainRobotDrive41 = new RobotDrive(driveTrainCIMRearLeft, driveTrainCIMFrontLeft, 
            driveTrainCIMRearRight, driveTrainCIMFrontRight);
    climberClimber = new CANTalon(3);
    c1 = new Talon(5);
    pDPPowerDistributionPanel1 = new PowerDistributionPanel(0);
    gyro = new ADXRS450_Gyro(Port.kOnboardCS0);
    c2 = new Talon(6);
    ultra = new AnalogInput(0);

    LiveWindow.addSensor("PDP", "PowerDistributionPanel 1", pDPPowerDistributionPanel1);
    LiveWindow.addSensor("Ultra", "Ultra", ultra);
   //  LiveWindow.addActuator("Intake", "Intake", intakeIntake);
    LiveWindow.addActuator("Climber", "Climber", climberClimber);
    LiveWindow.addActuator("RearLeft (2)", "Drivetrain", driveTrainCIMRearLeft);
    LiveWindow.addActuator("FrontLeft (12)", "Drivetrain", driveTrainCIMFrontLeft);
    LiveWindow.addActuator("RearRight (1)", "Drivetrain", driveTrainCIMRearRight);
    LiveWindow.addActuator("FrontRight (11)", "Drivetrain", driveTrainCIMFrontRight);
    LiveWindow.addActuator("Drive Train", "Gyro", gyro);
    // LiveWindow.addActuator("Shooter", "Shooter", shooter1);
}
项目:Steamwork_2017    文件:Robot.java   
public Robot() {
    stick = new Joystick(0);
    driveLeftFront = new Victor(LEFT_FRONT_DRIVE);
    driveLeftRear = new Victor(LEFT_REAR_DRIVE);
    driveRightFront = new Victor(RIGHT_FRONT_DRIVE);
    driveRightRear = new Victor(RIGHT_REAR_DRIVE);
    enhancedDriveLeft = new Victor(ENHANCED_LEFT_DRIVE);
    enhancedDriveRight = new Victor(ENHANCED_RIGHT_DRIVE);
    gearBox = new DoubleSolenoid(GEAR_BOX_PART1, GEAR_BOX_PART2);
    climber1 = new Victor(CLIMBER_PART1);
    climber2 = new Victor(CLIMBER_PART2);
    vexSensorBackLeft = new Ultrasonic(0, 1);
    vexSensorBackRight = new Ultrasonic(2, 3);
    vexSensorFrontLeft = new Ultrasonic(4, 5);
    vexSensorFrontRight = new Ultrasonic(6, 7);

    Skylar = new RobotDrive(driveLeftFront, driveLeftRear, driveRightFront, driveRightRear);
    OptimusPrime = new RobotDrive(enhancedDriveLeft, enhancedDriveRight);
}
项目:2017-newcomen    文件:Drivetrain.java   
public void initTalonConfig() {

        talons = new CANTalon[] {
                new CANTalon(TALONS_FRONT_LEFT), new CANTalon(TALONS_FRONT_RIGHT),
                new CANTalon(TALONS_REAR_LEFT), new CANTalon(TALONS_REAR_RIGHT)};

        talons[MotorType.kFrontLeft.value].setInverted(true);
        talons[MotorType.kFrontRight.value].setInverted(false);
        talons[MotorType.kRearLeft.value].setInverted(true);
        talons[MotorType.kRearRight.value].setInverted(false);

        for (CANTalon t: talons) {
            t.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
            t.enableBrakeMode(false);
            t.setFeedbackDevice(FeedbackDevice.QuadEncoder);
            t.configEncoderCodesPerRev(ENC_CODES_PER_REV);
            t.setEncPosition(0);
            t.set(0);
        }
        robotDrive = new RobotDrive(talons[MotorType.kFrontLeft.value], talons[MotorType.kRearLeft.value], 
                                    talons[MotorType.kFrontRight.value], talons[MotorType.kRearRight.value]);
        robotDrive.setSafetyEnabled(false);
    }
项目:snobot-2017    文件:Robot.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
@Override
public void robotInit() {

       driveLeftA = new CANTalon(2);
       driveLeftB = new CANTalon(1);
       driveRightA = new CANTalon(3);
       driveRightB = new CANTalon(4);

       climberMotorA = new Talon(1);
       climberMotorB = new Talon(2);

       drive = new RobotDrive(driveLeftA, driveLeftB, driveRightA, driveRightB);

       joystick = new Joystick(0);

       SmartDashboard.putNumber("SlowClimber", .5);
       SmartDashboard.putNumber("FastClimber", 1);
}
项目:frc2017    文件:DriveSubsystem.java   
public DriveSubsystem() {
  super("DriveSubsystem");

  leftFrontTalon = new CANTalon(RobotMap.TALON_DRIVEBASE_LEFT_FRONT);
  leftRearTalon = new CANTalon(RobotMap.TALON_DRIVEBASE_LEFT_REAR);
  rightFrontTalon = new CANTalon(RobotMap.TALON_DRIVEBASE_RIGHT_FRONT);
  rightRearTalon = new CANTalon(RobotMap.TALON_DRIVEBASE_RIGHT_REAR);

  leftFrontTalon.setVoltageRampRate(RAMP_RATE);
  rightFrontTalon.setVoltageRampRate(RAMP_RATE);
  leftRearTalon.setVoltageRampRate(RAMP_RATE);
  rightRearTalon.setVoltageRampRate(RAMP_RATE);

  leftFrontTalon.setFeedbackDevice(CANTalon.FeedbackDevice.CtreMagEncoder_Relative);
  rightRearTalon.setFeedbackDevice(CANTalon.FeedbackDevice.CtreMagEncoder_Relative);
  rightRearTalon.reverseSensor(true);

  robotDrive = new RobotDrive(leftFrontTalon, leftRearTalon, rightFrontTalon, rightRearTalon);
  robotDrive.setSafetyEnabled(false);
}
项目:FRC-2017    文件:CANDriveAssembly.java   
public static void initialize()
{
    if (!initialized) {
        mFrontLeft = new CANTalon(LEFT_FRONT_TALON_ID);
        mBackLeft = new CANTalon(LEFT_REAR_TALON_ID);
        mFrontRight = new CANTalon(RIGHT_FRONT_TALON_ID);
        mBackRight = new CANTalon(RIGHT_REAR_TALON_ID);

        drive = new RobotDrive(mFrontLeft, mBackLeft, mFrontRight, mBackRight);

        drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
        drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);   

        leftStick = new Joystick(LEFT_JOYSTICK_ID);
        rightStick = new Joystick(RIGHT_JOYSTICK_ID);

        initialized = true;
    }
}
项目:RobotCode2017    文件:DriveTrainSubsystem.java   
public DriveTrainSubsystem()
{
    lastLeft = 0.0D;
    lastRight = 0.0D;

    leftTalon0 = new CANTalon(RobotMap.Motor.LEFT_TALON_0);
    leftTalon1 = new CANTalon(RobotMap.Motor.LEFT_TALON_1);
    rightTalon0 = new CANTalon(RobotMap.Motor.RIGHT_TALON_0);
    rightTalon1 = new CANTalon(RobotMap.Motor.RIGHT_TALON_1);

    drive = new RobotDrive(leftTalon0, leftTalon1, rightTalon0, rightTalon1);
    drive.setExpiration(0.1D);

    setTalonSettings(leftTalon0);
    setTalonSettings(leftTalon1);
    setTalonSettings(rightTalon0);
    setTalonSettings(rightTalon1);
}
项目:FRC2549-2016    文件:DrivetrainSubsystem.java   
public DrivetrainSubsystem(){
    leftMotor = RobotMap.leftDriveMotor.getController();
    rightMotor = RobotMap.rightDriveMotor.getController();
    drive = new RobotDrive(leftMotor, rightMotor);

    accelerometer = new IntegratedBuiltinAccelerometer(Range.k2G);

    leftEncoder = new Encoder(RobotMap.leftEncoder[0], RobotMap.leftEncoder[1]);
    rightEncoder = new Encoder(RobotMap.rightEncoder[0], RobotMap.rightEncoder[1]);
    leftEncoder.setReverseDirection(true);
    rightEncoder.setReverseDirection(true);

    driveGyro = new AnalogGyro(RobotMap.driveGyroPort);
    driveGyro.reset();
    driveGyro.setSensitivity(0.007);


}
项目:Stronghold-2016    文件:DrivetrainPID.java   
public DrivetrainPID() {
    super(RobotMap.DRIVE_TURN_P, RobotMap.DRIVE_TURN_I, RobotMap.DRIVE_TURN_D);
    frontLeft = new CANTalon(RobotMap.FRONT_LEFT_MOTOR);
frontRight = new CANTalon(RobotMap.FRONT_RIGHT_MOTOR);
rearLeft = new CANTalon(RobotMap.REAR_LEFT_MOTOR);
rearRight = new CANTalon(RobotMap.REAR_RIGHT_MOTOR);

frontLeft.enableControl();
frontRight.enableControl();
rearLeft.enableControl();
rearRight.enableControl();

oneDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
SmartDashboard.putNumber("Front right", 0);
SmartDashboard.putNumber("Front left", 0);
  }
项目:turtleshell    文件:Robot.java   
public Robot() {
     myRobot = new RobotDrive(0, 1);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
项目:turtleshell    文件:Robot.java   
public Robot() {
     myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
            frontRightChannel, rearRightChannel);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
项目:turtleshell    文件:Robot.java   
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
            frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
      ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
项目:turtleshell    文件:Robot.java   
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel, 
         frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
        ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
项目:turtleshell    文件:Robot.java   
public Robot() {
     myRobot = new RobotDrive(0, 1);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
项目:turtleshell    文件:Robot.java   
public Robot() {
     myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
            frontRightChannel, rearRightChannel);
     myRobot.setExpiration(0.1);
     stick = new Joystick(0);
     try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
         ahrs = new AHRS(SPI.Port.kMXP); 
     } catch (RuntimeException ex ) {
         DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
     }
 }
项目:turtleshell    文件:Robot.java   
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
            frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
      ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
项目:turtleshell    文件:Robot.java   
public Robot() {
    myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel, 
         frontRightChannel, rearRightChannel);
    myRobot.setExpiration(0.1);
    stick = new Joystick(0);
    try {
/***********************************************************************
 * navX-MXP:
 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
 * 
 * navX-Micro:
 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
 * 
 * Multiple navX-model devices on a single robot are supported.
 ************************************************************************/
        ahrs = new AHRS(SPI.Port.kMXP); 
    } catch (RuntimeException ex ) {
        DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
    }
}
项目:UberbotsJava    文件:UBMethods.java   
public static void hdrive(RobotDrive drive, int pwm_hmotor, Joystick js, boolean squared) {
//      hdrive_L = js.getY() * (js.getY()) + js.getZ();
//      hdrive_R = js.getY() - js.getZ();
//      hdrive_H = js.getX();
//      hdrive_hmotor = new Jaguar(pwm_hmotor);
//      drive.setLeftRightMotorOutputs((hdrive_L > 1) ? 1 : ((hdrive_L < -1) ? -1 : hdrive_L),
//              (hdrive_R > 1) ? 1 : ((hdrive_R < -1) ? -1 : hdrive_R));
//      hdrive_hmotor.set((hdrive_H > 1) ? 1 : ((hdrive_H < -1) ? -1 : hdrive_H));
        hdrive_X = js.getX();
        hdrive_X *= (squared ? hdrive_X : 1);
        hdrive_Y = js.getX();
        hdrive_Y *= (squared ? hdrive_Y : 1);
        hdrive_Z = js.getX();
        hdrive_Z *= (squared ? hdrive_Z : 1);
        hdrive_hmotor = new Jaguar(pwm_hmotor);
        drive.setLeftRightMotorOutputs(
                (hdrive_Y + hdrive_Z > 1) ? 1 : ((hdrive_Y + hdrive_Z < -1) ? -1 : hdrive_Y + hdrive_Z),
                (hdrive_Y - hdrive_Z > 1) ? 1 : ((hdrive_Y - hdrive_Z < -1) ? -1 : hdrive_Y - hdrive_Z));
        hdrive_hmotor.set((hdrive_X > 1) ? 1 : ((hdrive_X < -1) ? -1 : hdrive_X));

    }
项目:2015RobotCode    文件:Robot.java   
public Robot() {    // initialize variables in constructor
    stick = new Joystick(RobotMap.JOYSTICK_PORT); // set the stick to refer to joystick #0
    button = new JoystickButton(stick, RobotMap.BTN_TRIGGER);

    myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
            RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
    myRobot.setExpiration(RobotDrive.kDefaultExpirationTime);  // set expiration time for motor movement if error occurs

    pdp = new PowerDistributionPanel();  // instantiate class to get PDP values

    compressor = new Compressor(); // Compressor is controlled automatically by PCM

    solenoid = new DoubleSolenoid(RobotMap.SOLENOID_PCM_PORT1, RobotMap.SOLENOID_PCM_PORT2); // solenoid on PCM port #0 & #1

    /*camera = CameraServer.getInstance();
    camera.setQuality(50);
    camera.setSize(200);*/
    frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);  // create the image frame for cam
    session = NIVision.IMAQdxOpenCamera("cam0",
            NIVision.IMAQdxCameraControlMode.CameraControlModeController);  // get reference to camera
    NIVision.IMAQdxConfigureGrab(session);  // grab current streaming session
}
项目:2014-Aerial-Assist    文件:RobotTemplate.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit() {
    // instantiate the command used for the autonomous period
    autonomousCommand = new ExampleCommand();

    frontLeft = new Victor(1); // Creating Victor motors
    frontRight = new Victor(2);
    rearLeft = new Victor(3);
    rearRight = new Victor(4);

    myDrive = new RobotDrive(frontLeft, frontRight);
    // myDrive = new RobotDrive(frontLeft,frontRight,rearLeft,rearRight);

    driveStick = new Joystick(1);

    gyro = new Gyro(1);

    // Initialize all subsystems
    CommandBase.init();
}
项目: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();
}
项目:2014-Assist-Robot-Prime    文件:DrivePart.java   
public DrivePart(BotRunner runner){
    super(runner);

    bot = runner;

    shotRange = 90;
    highRange = 60;
    lowRange = 30;

    autoTime = new Timer();

    frontRight = new Jaguar(1);
    frontLeft = new Jaguar(2);
    backRight = new Jaguar(3);
    backLeft = new Jaguar(4);

    roboDrive = new RobotDrive(frontLeft, backLeft, frontRight, backRight);

    roboDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
    roboDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
}
项目: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();
    }
}
项目:TitanRobot2014    文件:TankDriveHandler.java   
public void run() {
    /* Call tank drive after adjusting for drive direction */
    if (stateRegistry.getDriveDirection() == REVERSE) {
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
        robotDrive.tankDrive(rightDriveJoystick, leftDriveJoystick);
    }
    else {
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
        robotDrive.tankDrive(leftDriveJoystick, rightDriveJoystick);
    }
}
项目:TitanRobot2014    文件:TankDriveHandler.java   
public void run() {
    /* Call tank drive after adjusting for drive direction */
    if (stateRegistry.getDriveDirection() == REVERSE) {
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
        robotDrive.tankDrive(rightDriveJoystick, leftDriveJoystick);
    }
    else {
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
        robotDrive.tankDrive(leftDriveJoystick, rightDriveJoystick);
    }
}
项目:2014-robot    文件:Drive.java   
/**
 * Used to create a FroboDrive object to control all driving operations
 *
 */
public Drive(){
    //Binds the joysticks...
    this.rightJoystick = ControlPack.getInstance().getRightJoystick();
    this.leftJoystick = ControlPack.getInstance().getLeftJoystick(); 
    this.gamepad = ControlPack.getInstance().getGamepad();


    //Creates a RobotDrive...
    chassis = new RobotDrive(Channels.FRONT_LEFT_DRIVE_CHANNEL, 
            Channels.BACK_LEFT_DRIVE_CHANNEL, 
            Channels.FRONT_RIGHT_DRIVE_CHANNEL, 
            Channels.BACK_RIGHT_DRIVE_CHANNEL);

    //setting up encoders
    this.LeftEncoder = SensorPack.getInstance().getLeftEncoder();
    this.RightEncoder = SensorPack.getInstance().getRightEncoder();

    //gyro
    this.gyro = SensorPack.getInstance().getGyro();

    // resetNeeded = true;
    // ^ gyro already reset during init
    System.out.println("Drive online");
}
项目:NR-2014-CMD    文件:Drive.java   
private Drive()
{
    drive = new RobotDrive(new Talon(1),new Talon(2),new Talon(3),new Talon(4));
    drive.setSafetyEnabled(false);


    e1 = new Encoder(RobotMap.ENCODER_1_A, RobotMap.ENCODER_1_B, false, CounterBase.EncodingType.k4X);
    e2 = new Encoder(RobotMap.ENCODER_2_A, RobotMap.ENCODER_2_B, false, CounterBase.EncodingType.k4X);

    //A calculated constant to convert from encoder ticks to feet on 4 inch diameter wheels
    e1.setDistancePerPulse(0.0349065850388889/12);
    e2.setDistancePerPulse(0.0349065850388889/12);
    startEncoders();

    drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);      
    drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);

    sonic = new Ultrasonic(RobotMap.ULTRASONIC_A, RobotMap.ULTRASONIC_B);
    sonic.setAutomaticMode(true);
    sonic.setEnabled(true);


    shifter = new DoubleSolenoid(RobotMap.SHIFTER_ENGAGE, RobotMap.SHIFTER_DISENGAGE);
}
项目:bainbridgefirst    文件:RobotTemplate.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit() {
    // instantiate the command used for the autonomous period
    autonomousCommand = new ExampleCommand();

    frontLeft = new Victor(1); // Creating Victor motors
    frontRight = new Victor(2);
    rearLeft = new Victor(3);
    rearRight = new Victor(4);

    myDrive = new RobotDrive(frontLeft, frontRight);
    // myDrive = new RobotDrive(frontLeft,frontRight,rearLeft,rearRight);

    driveStick = new Joystick(1);

    gyro = new Gyro(1);

    // Initialize all subsystems
    CommandBase.init();
}
项目:Hyperion3360-2012    文件:DriveTrain.java   
public DriveTrain() {
    mjGauche = JoystickDevice.GetTankDriveGauche();
    mjDroite = JoystickDevice.GetTankDriveDroite();
    mDriveTrain = new RobotDrive(PwmDevice.mMoteurGaucheAvant,
            PwmDevice.mMoteurGaucheArriere,
            PwmDevice.mMoteurDroiteAvant,
            PwmDevice.mMoteurDroiteArriere);


    msTransmissionHi = new Solenoid(SolenoidDevice.mTransmissionHi);
    msTransmissionLow = new Solenoid(SolenoidDevice.mTransmissionLow);
    meTransmissionGauche = new Encoder(DigitalDevice.mTransmissionGaucheEncodeurA,
            DigitalDevice.mTransmissionGaucheEncodeurB);
    mfMoteurGauche = new FiltrePasseBas(25);
    meTransmissionDroite = new Encoder(DigitalDevice.mTransmissionDroiteEncodeurA,
            DigitalDevice.mTransmissionDroiteEncodeurB);
    mfMoteurDroite = new FiltrePasseBas(25);

    msTransmissionHi.set(false);
    msTransmissionLow.set(true);
}
项目:2013-code-v2    文件:DriveTrain.java   
public DriveTrain(){
    try{
        leftFront = new CANJaguar(1);
        leftRear = new CANJaguar(2);
        rightFront = new CANJaguar(4);
        rightRear = new CANJaguar(3);
    }catch(Exception e){
        System.out.println(e);
        System.out.println(leftFront);
        System.out.println(leftRear);
        System.out.println(rightFront);
        System.out.println(rightRear);
    }

    drive = new RobotDrive(leftFront, leftRear, rightFront, rightRear);
    gyro.reset();
    gyro.setSensitivity(0.007);
}
项目:Robot2013    文件:Drive.java   
public Drive(){

    try {

        //Setup the drive motors
        leftFront = new CANJaguar(1);
        rightFront = new CANJaguar(2);
        leftRear = new CANJaguar(3);
        rightRear = new CANJaguar(4);

        //Setup the Drive
        robotDrive = new RobotDrive(leftFront, leftRear, rightFront, rightRear);

    } catch (CANTimeoutException ex) {
        ex.printStackTrace();
    }

}
项目:Robot_2017    文件:RobotMap.java   
public static void init() {
      // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    compressor = new Compressor();

      driveTrainLeftFront = new CANTalon(1);
      LiveWindow.addActuator("DriveTrain", "LeftFront", driveTrainLeftFront);
      driveTrainRightFront = new CANTalon(3);
      LiveWindow.addActuator("DriveTrain", "RightFront", driveTrainRightFront);
      driveTrainLeftRear = new CANTalon(2);
      driveTrainLeftRear.changeControlMode(TalonControlMode.Follower);
      driveTrainLeftRear.set(driveTrainLeftFront.getDeviceID());
      LiveWindow.addActuator("DriveTrain", "LeftRear", driveTrainLeftRear);
      driveTrainRightRear = new CANTalon(4);
      driveTrainRightRear.changeControlMode(TalonControlMode.Follower);
      driveTrainRightRear.set(driveTrainRightFront.getDeviceID());
      driveTrainRightRear.reverseOutput(false);
      LiveWindow.addActuator("DriveTrain", "RightRear", driveTrainRightRear);

      driveTrainLeftFront.setInverted(true);
      driveTrainRightFront.setInverted(true);
      driveTrainLeftRear.setInverted(true);
      driveTrainRightRear.setInverted(true);

      driveTrainRobotDrive41 = new RobotDrive(driveTrainRightFront, driveTrainLeftFront);
driveTrainRobotDrive41.setSafetyEnabled(true);
driveTrainRobotDrive41.setExpiration(0.1);
driveTrainRobotDrive41.setSensitivity(0.5);
driveTrainRobotDrive41.setMaxOutput(1.0);

      climbMotor = new CANTalon(5);
      LiveWindow.addActuator("Climbing", "Motor", climbMotor);

      lightsLightEnable = new Relay(0);
      LiveWindow.addActuator("Lights", "LightEnable", lightsLightEnable);

      gearIntakeRamp = new DoubleSolenoid(1, 0);
      LiveWindow.addActuator("GearIntake", "IntakeRamp", gearIntakeRamp);

      // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
  }
项目:SteamWorks    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainLeftFront = new Victor(0);
    LiveWindow.addActuator("DriveTrain", "LeftFront", (Victor) driveTrainLeftFront);

    driveTrainLeftRear = new Victor(1);
    LiveWindow.addActuator("DriveTrain", "LeftRear", (Victor) driveTrainLeftRear);

    driveTrainRightFront = new Victor(2);
    LiveWindow.addActuator("DriveTrain", "RightFront", (Victor) driveTrainRightFront);

    driveTrainRightRear = new Victor(3);
    LiveWindow.addActuator("DriveTrain", "RightRear", (Victor) driveTrainRightRear);

    driveTrainRobotDrive = new RobotDrive(driveTrainLeftFront, driveTrainLeftRear,
          driveTrainRightFront, driveTrainRightRear);

    driveTrainRobotDrive.setSafetyEnabled(false);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(1.0);
    driveTrainRobotDrive.setMaxOutput(1.0);

    shootershooterTalon = new CANTalon(0);
    LiveWindow.addActuator("Shooter", "shooterTalon", shootershooterTalon);


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    // set this up
    gyro = new ADXRS450_Gyro();
}
项目:Practice_Robot_Code    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    motorRelayMotorRelay1 = new Relay(0);
    LiveWindow.addActuator("MotorRelay", "MotorRelay1", motorRelayMotorRelay1);

    lFront = new CANTalon(1);
    LiveWindow.addActuator("Wheels", "Speed Controller 1", (CANTalon) lFront);

    rFront = new CANTalon(3);
    LiveWindow.addActuator("Wheels", "Speed Controller 2", (CANTalon) rFront);

    lRear = new CANTalon(2);
    LiveWindow.addActuator("Wheels", "Speed Controller 3", (CANTalon) lRear);

    rRear = new CANTalon(4);
    LiveWindow.addActuator("Wheels", "Speed Controller 4", (CANTalon) rRear);

    driveSystem = new RobotDrive(lFront, lRear,
          rFront, rRear);

    driveSystem.setSafetyEnabled(true);
    driveSystem.setExpiration(0.1);
    driveSystem.setSensitivity(0.5);
    driveSystem.setMaxOutput(1.0);

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:VikingRobot    文件:Drivebase.java   
public Drivebase() {
    super();

    left = new CANTalon(FRONT_LEFT_MOTOR_DEVICE_NUMBER);
    leftSlave = new CANTalon(BACK_LEFT_MOTOR_DEVICE_NUMBER);
    leftSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftSlave.set(FRONT_LEFT_MOTOR_DEVICE_NUMBER);

    right = new CANTalon(FRONT_RIGHT_MOTOR_DEVICE_NUMBER);
    rightSlave =  new CANTalon(BACK_RIGHT_MOTOR_DEVICE_NUMBER);
    rightSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightSlave.set(FRONT_RIGHT_MOTOR_DEVICE_NUMBER);

    left.setInverted(true);
    right.setInverted(true);
    leftSlave.setInverted(true);
    rightSlave.setInverted(true);

    left.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
    right.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
    left.configEncoderCodesPerRev(TICS_PER_REVOLUTION);
    right.configEncoderCodesPerRev(TICS_PER_REVOLUTION);
    left.reverseSensor(true);
    right.reverseSensor(true);

    // PID Stuff
    left.setPID(0.1, 0, 0, 0.025, 0, 1, 0);
    right.setPID(0.1, 0, 0, 0.025, 0, 1, 0);

    left.configNominalOutputVoltage(+0, -0);
    right.configPeakOutputVoltage(+12, -12);
    left.setProfile(0);
    right.setProfile(0);

    robotDrive = new RobotDrive(left, right);
}
项目:DriveStraightBot    文件:Drivetrain.java   
public Drivetrain() {
    //TODO: Init Gyro gyro = new Gyro();
    pidOutput = new DrivetrainOutput(this);
    pidInput = new GyroInput(gyro);
    controller = new PIDController(0.0,0.0,0.0, pidInput, pidOutput);

    //super(Kp, Ki, Kd);
    leftFrontMotor = new CANTalon(RobotMap.LEFT_FRONT_MOTOR_PORT);
    rightFrontMotor = new CANTalon(RobotMap.RIGHT_FRONT_MOTOR_PORT);
    leftBackMotor = new CANTalon(RobotMap.LEFT_BACK_MOTOR_PORT);
    rightBackMotor = new CANTalon(RobotMap.RIGHT_BACK_MOTOR_PORT);
    //Assume the team does not have encoders if they do not have a mobility auton command.
    robotDrive = new RobotDrive(leftBackMotor, leftFrontMotor, rightBackMotor, rightFrontMotor);
}
项目:RobotBuilderTest    文件:RobotMap.java   
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);

    driveTrainRobotDrive = new RobotDrive(driveTrainLeftMotor, driveTrainRightMotor);

    driveTrainRobotDrive.setSafetyEnabled(true);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(0.5);
    driveTrainRobotDrive.setMaxOutput(1.0);

    intakeintakeMotor = new Talon(2);
    LiveWindow.addActuator("Intake", "intakeMotor", (Talon) intakeintakeMotor);

    pneumaticSystemCompressor = new Compressor(0);


    pneumaticSystemDoubleSolenoidPusher = new DoubleSolenoid(0, 0, 1);
    LiveWindow.addActuator("Pneumatic System", "DoubleSolenoidPusher", pneumaticSystemDoubleSolenoidPusher);

    sensorBaseUltraSonicMaxbotix = new AnalogInput(0);
    LiveWindow.addSensor("SensorBase", "UltraSonicMaxbotix", sensorBaseUltraSonicMaxbotix);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:FRC-2016-Robot-Code    文件:Robot.java   
public void robotInit() {

        frontLeft = new VictorSP(0);
        backLeft = new VictorSP(1);       
        frontRight = new VictorSP(2);
        backRight = new VictorSP(3);
        intakeMotor = new VictorSP(4);
        compressor = new Compressor(0);
        intakeSolenoid = new Solenoid(0);


        driveTrain = new RobotDrive(frontLeft, backLeft, frontRight, backRight);

        driveTrain.setSafetyEnabled(false);
        driveTrain.setExpiration(0.1);
        driveTrain.setSensitivity(0.5);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);

        XboxController = new Joystick(2);

        rightJoystick = new Joystick(1);

        leftJoystick = new Joystick(0);
    }
项目:snobot-2017    文件:SnobotDriveTrain.java   
/**
 * Takes 2 speed controllers and joy stick arguments
 * 
 * @param aSpeedControllerLeft
 *            Argument for left Speed Controller
 * @param aSpeedControllerRight
 *            Argument for right Speed Controller
 * @param aDriverJoystick
 *            Argument Driver Joy stick
 */
public SnobotDriveTrain(
        SpeedController aSpeedControllerLeft, 
        SpeedController aSpeedControllerRight,
        DriverJoystick aDriverJoystick)
{
    mSpeedControllerLeft = aSpeedControllerLeft;
    mSpeedControllerRight = aSpeedControllerRight;
    mRobotDrive = new RobotDrive(mSpeedControllerLeft, mSpeedControllerRight);
    mJoystick = aDriverJoystick;

    mRobotDrive.setSafetyEnabled(false);
}
项目:liastem    文件:Robot.java   
public Robot() {
    //make objects for drive train, joystick, and gyro
    myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel),
      new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel));
    myRobot.setInvertedMotor(MotorType.kFrontLeft, true); // invert the left side motors
    myRobot.setInvertedMotor(MotorType.kRearLeft, true); // you may need to change or remove this to match your robot

    joystick = new Joystick(0);
    gyro = new AnalogGyro(gyroChannel);
}