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


Java CANTalon.enableBrakeMode方法代码示例

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


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

示例1: Chassis

import com.ctre.CANTalon; //导入方法依赖的package包/类
public Chassis() {
    leftMaster = new CANTalon(RobotMap.LEFT_MASTER);
    leftSlave = new CANTalon(RobotMap.LEFT_SLAVE);
    leftSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftSlave.set(leftMaster.getDeviceID());

    rightMaster = new CANTalon(RobotMap.RIGHT_MASTER);
    rightSlave = new CANTalon(RobotMap.RIGHT_SLAVE);
    rightSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightSlave.set(rightMaster.getDeviceID());

    rightMaster.enableBrakeMode(true);
    rightSlave.enableBrakeMode(true);
    leftMaster.enableBrakeMode(true);
    leftSlave.enableBrakeMode(true);
    System.out.println("Chassis sub system init");

    threadInit(() -> {
        SmartDashboard.putNumber("left speed:", leftMaster.get());
        SmartDashboard.putNumber("right speed:", rightMaster.get());
    });
}
 
开发者ID:FRCteam6414,项目名称:FRC6414program,代码行数:23,代码来源:Chassis.java

示例2: initTalonConfig

import com.ctre.CANTalon; //导入方法依赖的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

示例3: Shooter

import com.ctre.CANTalon; //导入方法依赖的package包/类
public Shooter() {
	super();
	shooterFeeder = new CANTalon(8);
    LiveWindow.addActuator("Shooter", "Feeder", shooterFeeder);
    shooterFeeder.enableBrakeMode(false);
    
    shooterShootMotor = new CANTalon(7);
    LiveWindow.addActuator("Shooter", "ShootMotor", shooterShootMotor);
    shooterShootMotor.enableBrakeMode(false);
       /* choose the sensor */
    shooterShootMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    shooterShootMotor.reverseSensor(true);
    shooterShootMotor.configEncoderCodesPerRev(PulsesPerRevolution); // if using FeedbackDevice.QuadEncoder

       /* set the peak and nominal outputs, 12V means full */
    shooterShootMotor.configNominalOutputVoltage(+0.0f, -0.0f);
    shooterShootMotor.configPeakOutputVoltage(+12.0f, -12.0f);
       
       /* set closed loop gains in slot0 */
    shooterShootMotor.setProfile(0);
    shooterShootMotor.setF(pidF);
       shooterShootMotor.setP(pidP);	
       
       //only change I and D to smooth out control
       shooterShootMotor.setI(0); 
       shooterShootMotor.setD(0);
    
    shooterAgitator = new CANTalon(10);
    LiveWindow.addActuator("Shooter", "Agitator", shooterAgitator);
    shooterAgitator.enableBrakeMode(false);
}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:32,代码来源:Shooter.java

示例4: BallIntake

import com.ctre.CANTalon; //导入方法依赖的package包/类
public BallIntake() {
	super();
	ballIntakeMotor = new CANTalon(9);
    LiveWindow.addActuator("BallIntake", "Intake", ballIntakeMotor);
    ballIntakeMotor.enableBrakeMode(false);
    
}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:8,代码来源:BallIntake.java

示例5: configureMaster

import com.ctre.CANTalon; //导入方法依赖的package包/类
private void configureMaster(CANTalon talon) {
  logger.info("init master: " + talon.getDeviceID());
  talon.changeControlMode(CANTalon.TalonControlMode.Voltage);
  talon.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
  talon.configEncoderCodesPerRev(RobotMap.QUAD_ENCODER_TICKS_PER_REV);
  talon.configNominalOutputVoltage(+0.0f, -0.0f);
  talon.configPeakOutputVoltage(+12.0f, -12.0f);
  talon.setProfile(0);
  talon.setF(0);
  talon.setP(0.5);
  talon.setI(0.0001);
  talon.setD(1.0);
  talon.setPosition(0);
  talon.enableBrakeMode(true);
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:16,代码来源:DriveTrain.java

示例6: Feeder

import com.ctre.CANTalon; //导入方法依赖的package包/类
/**
 * Creates the Feeder subsystem.
 */
public Feeder() {
  if (Robot.deviceFinder.isTalonAvailable(RobotMap.CT_ID_FEEDER)) {
    logger.trace("Initialize");
    feederTalon = new CANTalon(RobotMap.CT_ID_FEEDER);
    feederTalon.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
    feederTalon.enableBrakeMode(true);
    feederTalon.setSafetyEnabled(false);
  } else {
    logger.warn("Feeder unavailable");
  }
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:15,代码来源:Feeder.java

示例7: Lift

import com.ctre.CANTalon; //导入方法依赖的package包/类
public Lift() {
    super("Lift");
    //SmartDashboard.putData(this);
    
    liftTalon = new CANTalon(TALONS_LIFT);
    
    liftTalon.enableBrakeMode(true);
    liftTalon.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
    liftTalon.set(0);
}
 
开发者ID:frc2879,项目名称:2017-newcomen,代码行数:11,代码来源:Lift.java

示例8: Shooter

import com.ctre.CANTalon; //导入方法依赖的package包/类
/**
 * Create the instance of Shooter.
 */
public Shooter() {
  logger.info("Initialize");

  if (RobotMap.IS_ROADKILL) {
    return;
  }
  // account for missing Talons
  if (Robot.deviceFinder.isTalonAvailable(RobotMap.CT_ID_SHOOTER_MASTER)) {
    masterId = RobotMap.CT_ID_SHOOTER_MASTER;
    slaveId = RobotMap.CT_ID_SHOOTER_SLAVE;
  } else {
    logger.warn("Master talon is missing");
    masterId = RobotMap.CT_ID_SHOOTER_SLAVE;
    // in case it comes back
    slaveId = RobotMap.CT_ID_SHOOTER_MASTER;
  }
  
  shooterMaster = new CANTalon(masterId);
  // basic setup
  shooterMaster.changeControlMode(CANTalon.TalonControlMode.Speed);
  shooterMaster.enableBrakeMode(false); // probably bad for 775pros
  shooterMaster.setFeedbackDevice(CANTalon.FeedbackDevice.CtreMagEncoder_Relative);
  shooterMaster.reverseSensor(false);
  // the Talon needs peak and nominal output values
  shooterMaster.configNominalOutputVoltage(+0.0f, -0.0f);
  shooterMaster.configPeakOutputVoltage(+12.0f, -12.0f);
  // configure PID
  shooterMaster.setProfile(0);
  shooterMaster.setF(0);
  shooterMaster.setP(0.12);
  shooterMaster.setI(0.00012);
  shooterMaster.setD(0.5);
  // add to LiveWindow for easy testing
  LiveWindow.addActuator("Shooter", "Master", shooterMaster);

  shooterSlave = new CANTalon(slaveId);
  shooterSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
  shooterSlave.enableBrakeMode(false);
  shooterSlave.set(masterId);
  LiveWindow.addActuator("Shooter", "Slave", shooterSlave);

  Thread shooterWatchdog = new Thread(this::shooterWatchdogThread);
  // allow JVM to exit
  shooterWatchdog.setDaemon(true);
  // in the debugger, we'd like to know what this is
  shooterWatchdog.setName("Shooter Watchdog Thread");
  shooterWatchdog.start();
  
  SmartDashboard.putData(new InstantCommand("ForceOverrideShooterFault") {
    @Override
    public void execute() {
      shooterFault = false;
    }
  });
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:59,代码来源:Shooter.java

示例9: configureSlave

import com.ctre.CANTalon; //导入方法依赖的package包/类
private void configureSlave(CANTalon talon, int masterId) {
  logger.info("init slave: " + talon.getDeviceID() + " to master " + masterId);
  talon.changeControlMode(CANTalon.TalonControlMode.Follower);
  talon.set(masterId);
  talon.enableBrakeMode(true);
}
 
开发者ID:ligerbots,项目名称:Steamworks2017Robot,代码行数:7,代码来源:DriveTrain.java

示例10: Climber

import com.ctre.CANTalon; //导入方法依赖的package包/类
public Climber() {
	bagMotor = new CANTalon(RobotMap.CLIMBING_MOTOR);
	bagMotor.enableBrakeMode(false);
	//while(true)if (joystick.getRawButton(4))manualClimb(joystick);
}
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:6,代码来源:Climber.java

示例11: config

import com.ctre.CANTalon; //导入方法依赖的package包/类
@Override
protected void config(CANTalon talon, boolean value) {
  talon.enableBrakeMode(value); // true for brake
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:5,代码来源:BrakeInNeutralCommand.java

示例12: configure

import com.ctre.CANTalon; //导入方法依赖的package包/类
/**
 * Configure a Talon with stored parameters.
 *
 * @param talon the Talon to registerWith
 */
public void configure(@NotNull CANTalon talon) {
  talon.setSafetyEnabled(false);
  talon.setProfile(0);
  talon.setExpiration(MotorSafety.DEFAULT_SAFETY_EXPIRATION);
  Encoder enc = encoder != null ? encoder : Encoder.DEFAULT;
  enc.configure(talon);

  talon.enableBrakeMode(brakeInNeutral != null ? brakeInNeutral : true);
  talon.reverseOutput(outputReversed != null ? outputReversed : false);

  if (velocityMeasurementPeriod != null) {
    talon.SetVelocityMeasurementPeriod(velocityMeasurementPeriod);
  } else {
    talon.SetVelocityMeasurementPeriod(VelocityMeasurementPeriod.Period_100Ms);
  }

  if (velocityMeasurementWindow != null) {
    talon.SetVelocityMeasurementWindow(velocityMeasurementWindow);
  } else {
    talon.SetVelocityMeasurementWindow(64);
  }

  LimitSwitch fls = forwardLimitSwitch != null ? forwardLimitSwitch : LimitSwitch.DEFAULT;
  LimitSwitch rls = reverseLimitSwitch != null ? reverseLimitSwitch : LimitSwitch.DEFAULT;
  talon.enableLimitSwitch(fls.isEnabled(), rls.isEnabled());
  if (fls.isEnabled()) {
    talon.ConfigFwdLimitSwitchNormallyOpen(fls.isNormallyOpen());
  }
  if (rls.isEnabled()) {
    talon.ConfigRevLimitSwitchNormallyOpen(rls.isNormallyOpen());
  }

  SoftLimit sl = forwardSoftLimit != null ? forwardSoftLimit : SoftLimit.DEFAULT;
  talon.enableForwardSoftLimit(sl.isEnabled());
  if (sl.isEnabled()) {
    talon.setForwardSoftLimit(sl.getPosition());
  }
  sl = reverseSoftLimit != null ? reverseSoftLimit : SoftLimit.DEFAULT;
  talon.enableReverseSoftLimit(sl.isEnabled());
  if (sl.isEnabled()) {
    talon.setReverseSoftLimit(sl.getPosition());
  }
  if (currentLimit != null && currentLimit > 0) {
    talon.setCurrentLimit(currentLimit);
    talon.EnableCurrentLimit(true);
  } else {
    talon.EnableCurrentLimit(false);
  }
  talon.setVoltageRampRate(voltageRampRate != null ? voltageRampRate : 0);
  addTalonId(talon.getDeviceID());
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:57,代码来源:TalonConfiguration.java


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