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


Java RobotDrive.setSafetyEnabled方法代码示例

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


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

示例1: 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

示例2: 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

示例3: RoboDrive

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

示例4: Drive

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
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);
}
 
开发者ID:Nashoba-Robotics,项目名称:NR-2014-CMD,代码行数:25,代码来源:Drive.java

示例5: init

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

示例6: init

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

示例7: init

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

示例8: init

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

示例9: robotInit

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

示例10: SnobotDriveTrain

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

示例11: init

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
public static void init() {
	leftDriveMotor = new Talon(leftDriveMotorPin);
	LiveWindow.addActuator("driveTrain", "Left Motor",
			(Talon) leftDriveMotor);

	rightDriveMotor = new Talon(rightDriveMotorPin);
	LiveWindow.addActuator("driveTrain", "Right Motor",
			(Talon) rightDriveMotor);

	shifterSolenoid = new DoubleSolenoid(shifterSolenoidUpPin, shifterSolenoidDownPin);
	LiveWindow.addActuator("driveTrain", "Gearbox Shifter",
			(DoubleSolenoid) shifterSolenoid);
	
	winchMotor = new Talon(winchMotorPin);
	LiveWindow.addActuator("chainLifter", "Elevator Motor",
			(Talon) winchMotor);

	robotDrive = new RobotDrive(leftDriveMotor, rightDriveMotor);

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

	robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
	robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
	
	grabberSolenoid = new DoubleSolenoid(grabberSolenoidOpenPin, grabberSolenoidClosePin);
	LiveWindow.addActuator("grabberArm", "Grabber Solenoid",
			(DoubleSolenoid) grabberSolenoid);

	compressor = new Compressor();
	LiveWindow.addActuator("grabberArm", "compressor",
			(Compressor) compressor);

}
 
开发者ID:FRC-Team-3140,项目名称:FRC2015Code,代码行数:37,代码来源:RobotMap.java

示例12: initialize

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
@Override
public void initialize() {
	m_robot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
			RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
	m_robot.setExpiration(RobotDrive.kDefaultExpirationTime);  // set expiration time for motor movement if error occurs
	m_robot.setSafetyEnabled(true);  // enable safety so motors don't burn out
	m_robot.setInvertedMotor(MotorType.kFrontRight, true);
	//m_robot.setInvertedMotor(MotorType.kFrontLeft, true);
	m_robot.setInvertedMotor(MotorType.kRearRight, true);
	//m_robot.setInvertedMotor(MotorType.kRearLeft, true);
	
}
 
开发者ID:TechnoWolves5518,项目名称:2015RobotCode,代码行数:13,代码来源:DriveTrain.java

示例13: DriveTrain

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
public DriveTrain() {
    //initializing everything
    drive = new RobotDrive(1, 2);
    drive.setSafetyEnabled(false);
    rightJoystick = new Joystick(1);
    leftJoystick = new Joystick(2);
    leftShifter = new DoubleSolenoid(5, 6);
    rightShifter = new DoubleSolenoid(7, 8);
    rightShifterCommand = false;
    leftShifterCommand = false;
    rightMotorCommand = 0;
    leftMotorCommand = 0;
    joystickStateCommand = false;
    driverStation = DriverStation.getInstance();
}
 
开发者ID:FRCTeam3182,项目名称:FRC2014,代码行数:16,代码来源:DriveTrain.java

示例14: DriveTrain

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
public DriveTrain() {
    SpeedController leftMotor1 = new Talon(Constants.DRIVE_LEFT_MOTOR_1_PORT);
    SpeedController leftMotor2 = new Talon(Constants.DRIVE_LEFT_MOTOR_2_PORT);
    SpeedController rightMotor1 = new Talon(Constants.DRIVE_RIGHT_MOTOR_1_PORT);
    SpeedController rightMotor2 = new Talon(Constants.DRIVE_RIGHT_MOTOR_2_PORT);
    drive = new RobotDrive(leftMotor1, leftMotor2, rightMotor1, rightMotor2);
    
    // Enable safety mode
    drive.setSafetyEnabled(true);
    drive.setExpiration(SAFETY_EXPIRATION);
}
 
开发者ID:SaintsRobotics,项目名称:FRC-2014-test,代码行数:12,代码来源:DriveTrain.java

示例15: DriveTrain

import edu.wpi.first.wpilibj.RobotDrive; //导入方法依赖的package包/类
public DriveTrain() {
    // Set up the motors ...
    this.leftMotor = new Jaguar(Robot.KickMotors.LEFT_PORT);
    this.rightMotor = new Jaguar(Robot.KickMotors.RIGHT_PORT);

    // And the drive controller ...
    drive = new RobotDrive(leftMotor, rightMotor);
    drive.setInvertedMotor(Robot.KickMotors.LEFT_POSITION, Robot.KickMotors.LEFT_REVERSED);
    drive.setInvertedMotor(Robot.KickMotors.RIGHT_POSITION, Robot.KickMotors.RIGHT_REVERSED);
    drive.setSafetyEnabled(false);
    setMaxDriveSpeed(Robot.KickMotors.INITIAL_MAX_KICK_SPEED);
}
 
开发者ID:frc-4931,项目名称:2014-Robot,代码行数:13,代码来源:DriveTrain.java


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