当前位置: 首页>>代码示例>>Java>>正文


Java RobotDrive类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.RobotDrive的典型用法代码示例。如果您正苦于以下问题:Java RobotDrive类的具体用法?Java RobotDrive怎么用?Java RobotDrive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RobotDrive类属于edu.wpi.first.wpilibj包,在下文中一共展示了RobotDrive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:26,代码来源:RobotMap.java

示例2: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
}
 
开发者ID:TeamAutomatons,项目名称:Steamwork_2017,代码行数:20,代码来源:Robot.java

示例3: initTalonConfig

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
	}
 
开发者ID:frc2879,项目名称:2017-newcomen,代码行数:24,代码来源:Drivetrain.java

示例4: robotInit

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:23,代码来源:Robot.java

示例5: DriveSubsystem

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
}
 
开发者ID:FRC-1294,项目名称:frc2017,代码行数:21,代码来源:DriveSubsystem.java

示例6: initialize

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:22,代码来源:CANDriveAssembly.java

示例7: DriveTrainSubsystem

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
}
 
开发者ID:Team-2502,项目名称:RobotCode2017,代码行数:19,代码来源:DriveTrainSubsystem.java

示例8: DrivetrainSubsystem

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
	
	
}
 
开发者ID:Millerbots,项目名称:FRC2549-2016,代码行数:19,代码来源:DrivetrainSubsystem.java

示例9: DrivetrainPID

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
  }
 
开发者ID:SouthEugeneRoboticsTeam,项目名称:Stronghold-2016,代码行数:17,代码来源:DrivetrainPID.java

示例10: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:22,代码来源:Robot.java

示例11: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例12: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
    }
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例13: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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);
    }
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java

示例14: hdrive

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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));
		
	}
 
开发者ID:homosapien97,项目名称:UberbotsJava,代码行数:22,代码来源:UBMethods.java

示例15: Robot

import edu.wpi.first.wpilibj.RobotDrive; //导入依赖的package包/类
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
}
 
开发者ID:TechnoWolves5518,项目名称:2015RobotCode,代码行数:23,代码来源:Robot.java


注:本文中的edu.wpi.first.wpilibj.RobotDrive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。