本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例7: getControlMode
import com.ctre.CANTalon; //导入方法依赖的package包/类
public CANTalon.TalonControlMode getControlMode() {
return controlMode;
}