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


Java CANTalon.TalonControlMode方法代码示例

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


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

示例1: TalonConfiguration

import com.ctre.CANTalon; //导入方法依赖的package包/类
TalonConfiguration(
    @NotNull String name,
    @NotNull CANTalon.TalonControlMode mode,
    double setpointMax,
    Encoder encoder,
    Boolean brakeInNeutral,
    Boolean outputReversed,
    VelocityMeasurementPeriod velocityMeasurementPeriod,
    Integer velocityMeasurementWindow,
    LimitSwitch forwardLimitSwitch,
    LimitSwitch reverseLimitSwitch,
    SoftLimit forwardSoftLimit,
    SoftLimit reverseSoftLimit,
    Integer currentLimit,
    Double voltageRampRate) {
  this.name = name;
  this.mode = mode;
  this.setpointMax = setpointMax;
  this.encoder = encoder;
  this.brakeInNeutral = brakeInNeutral;
  this.outputReversed = outputReversed;
  this.velocityMeasurementPeriod = velocityMeasurementPeriod;
  this.velocityMeasurementWindow = velocityMeasurementWindow;
  this.forwardLimitSwitch = forwardLimitSwitch;
  this.reverseLimitSwitch = reverseLimitSwitch;
  this.forwardSoftLimit = forwardSoftLimit;
  this.reverseSoftLimit = reverseSoftLimit;
  this.currentLimit = currentLimit;
  this.voltageRampRate = voltageRampRate;
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:31,代码来源:TalonConfiguration.java

示例2: create

import com.ctre.CANTalon; //导入方法依赖的package包/类
/**
 * Create a {@link TalonConfiguration} based on supplied config.
 *
 * @param config the configuration
 * @return the TalonConfiguration
 * @throws IllegalArgumentException if mode is missing from config
 * @throws UnsupportedOperationException if mode not implemented yet
 */
@NotNull
public static TalonConfiguration create(Toml config) {
  TalonConfiguration talonConfiguration = null;
  CANTalon.TalonControlMode mode = getMode(config);
  switch (mode) {
    case Voltage:
      talonConfiguration = config.to(VoltageTalonConfiguration.class);
      break;
    case Position:
      talonConfiguration = config.to(PositionTalonConfiguration.class);
      break;
    case Speed:
      talonConfiguration = config.to(SpeedTalonConfiguration.class);
      break;
    case MotionMagic:
      talonConfiguration = config.to(MotionMagicTalonConfiguration.class);
      break;
    case PercentVbus:
    case Current:
    case Follower:
    case MotionProfile:
    case Disabled:
      throw new UnsupportedOperationException(mode.name());
  }
  return talonConfiguration;
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:35,代码来源:TalonConfigurationBuilder.java

示例3: getMode

import com.ctre.CANTalon; //导入方法依赖的package包/类
static CANTalon.TalonControlMode getMode(Toml config) {
  String mode = config.getString(MODE);
  if (mode == null) {
    throw new IllegalArgumentException("mode missing from configuration");
  }
  return CANTalon.TalonControlMode.valueOf(mode);
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:8,代码来源:TalonConfigurationBuilder.java

示例4: CANTalonOutput

import com.ctre.CANTalon; //导入方法依赖的package包/类
public CANTalonOutput(CANTalon.TalonControlMode controlMode, Gains gains, double setpoint) {
	this.controlMode = controlMode;
	this.setpoint = setpoint;
	profile = 0;
	this.gains = gains;
	
	accel = 0;
	cruiseVel = 0;
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:10,代码来源:CANTalonOutput.java

示例5: perform

import com.ctre.CANTalon; //导入方法依赖的package包/类
@Override
public void perform() {
  String[] types = {
    "Voltage",
    "Speed",
    "Position",
    "Current",
    "Percent Vbus",
    "Motion Magic",
    "Motion Profile",
    "Follower",
    "Disabled"
  };
  terminal.writer().println();
  for (int i = 0; i < types.length; i++) {
    terminal.writer().printf("%2d - %s%n", i + 1, types[i]);
  }
  boolean done = false;
  while (!done) {
    String line;
    try {
      line = reader.readLine(prompt()).trim();
    } catch (EndOfFileException | UserInterruptException e) {
      break;
    }

    if (line.isEmpty()) {
      logger.info("no value entered");
      break;
    }

    int choice;
    try {
      choice = Integer.valueOf(line);
    } catch (NumberFormatException nfe) {
      help(types.length);
      continue;
    }
    CANTalon.TalonControlMode mode;
    done = true;
    switch (choice) {
      case 1:
        mode = TalonControlMode.Voltage;
        break;
      case 2:
        mode = TalonControlMode.Speed;
        break;
      case 3:
        mode = TalonControlMode.Position;
        break;
      case 4:
        mode = TalonControlMode.Current;
        break;
      case 5:
        mode = TalonControlMode.PercentVbus;
        break;
      case 6:
        mode = TalonControlMode.MotionMagic;
        break;
      case 7:
        mode = TalonControlMode.MotionProfile;
        break;
      case 8:
        mode = TalonControlMode.Follower;
        break;
      case 9:
        mode = TalonControlMode.Disabled;
        break;
      default:
        continue;
    }
    for (CANTalon talon : talonSet.selected()) {
      talon.changeControlMode(mode);
      logger.info("set {} for {} to {}", name(), talon.getDescription(), mode);
    }
    talonSet.talonConfigurationBuilder().mode(mode);
  }
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:79,代码来源:SelectOperatingModeCommand.java

示例6: PIDTalonConfiguration

import com.ctre.CANTalon; //导入方法依赖的package包/类
PIDTalonConfiguration(
    @NotNull String name,
    @NotNull CANTalon.TalonControlMode mode,
    double setpointMax,
    Encoder encoder,
    Boolean isBrakeInNeutral,
    Boolean isOutputReversed,
    VelocityMeasurementPeriod velocityMeasurementPeriod,
    Integer velocityMeasurementWindow,
    LimitSwitch forwardLimitSwitch,
    LimitSwitch reverseLimitSwitch,
    SoftLimit forwardSoftLimit,
    SoftLimit reverseSoftLimit,
    Integer currentLimit,
    Double voltageRampRate,
    Double outputVoltageMax,
    Double closedLoopRampRate,
    Double forwardOutputVoltagePeak,
    Double reverseOutputVoltagePeak,
    Double forwardOutputVoltageNominal,
    Double reverseOutputVoltageNominal,
    Integer allowableClosedLoopError,
    Double nominalClosedLoopVoltage,
    Double pGain,
    Double iGain,
    Double dGain,
    Double fGain,
    Integer iZone) {
  super(
      name,
      mode,
      setpointMax,
      encoder,
      isBrakeInNeutral,
      isOutputReversed,
      velocityMeasurementPeriod,
      velocityMeasurementWindow,
      forwardLimitSwitch,
      reverseLimitSwitch,
      forwardSoftLimit,
      reverseSoftLimit,
      currentLimit,
      voltageRampRate);
  this.outputVoltageMax = outputVoltageMax;
  this.closedLoopRampRate = closedLoopRampRate;
  this.forwardOutputVoltagePeak = forwardOutputVoltagePeak;
  this.reverseOutputVoltagePeak = reverseOutputVoltagePeak;
  this.forwardOutputVoltageNominal = forwardOutputVoltageNominal;
  this.reverseOutputVoltageNominal = reverseOutputVoltageNominal;
  this.allowableClosedLoopError = allowableClosedLoopError;
  this.nominalClosedLoopVoltage = nominalClosedLoopVoltage;
  this.pGain = pGain;
  this.iGain = iGain;
  this.dGain = dGain;
  this.fGain = fGain;
  this.iZone = iZone;
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:58,代码来源:PIDTalonConfiguration.java

示例7: getControlMode

import com.ctre.CANTalon; //导入方法依赖的package包/类
public CANTalon.TalonControlMode getControlMode() {
	return controlMode;
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:4,代码来源:CANTalonOutput.java


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