Class MockCANMotorController
java.lang.Object
xbot.common.controls.actuators.XCANMotorController
xbot.common.controls.actuators.mock_adapters.MockCANMotorController
- All Implemented Interfaces:
DataFrameRefreshable
Mock XCANMotorController for simulation.
- Power and voltage is grouped.
- The user is responsible for updating its position and velocity.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classNested classes/interfaces inherited from class XCANMotorController
XCANMotorController.MotorPidMode, XCANMotorController.XCANMotorControllerFactory -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubledoubledoubledoubledoubledoubledoubledoubleFields inherited from class XCANMotorController
akitName, busId, deviceId, firstPeriodicCall, inputs, kDTunables, kGravityFFTunables, kITunables, kMaxOutputTunable, kMinOutputTunable, kPTunables, kStaticFFTunables, kVelocityFFTunables, MAX_VOLTAGE, pidProperties, softwareForwardLimit, softwareReverseLimit, tunableFactory, usesTunables -
Constructor Summary
ConstructorsConstructorDescriptionMockCANMotorController(CANMotorControllerInfo info, String owningSystemPrefix, TunableFactory tunableFactory, DevicePolice police, String pidTunablePrefix, XCANMotorControllerPIDProperties defaultPIDProperties, DataFrameRegistry dataFrameRegistry, PowerDistributionProperties pdProperties) -
Method Summary
Modifier and TypeMethodDescriptiondoublegetPower()org.wpilib.units.measure.Angleorg.wpilib.units.measure.Angleorg.wpilib.units.measure.AngularVelocityorg.wpilib.units.measure.AngularVelocityorg.wpilib.units.measure.AnglebooleanvoidsetClosedLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod) voidsetConfiguration(CANMotorControllerOutputConfig outputConfig) voidsetOpenLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod) voidsetPidDirectly(XCANMotorControllerPIDProperties pidProperties, int slot) Set the PID values for the motor controller directly, without using tunables.voidsetPositionAndVelocityUpdateFrequency(org.wpilib.units.measure.Frequency frequency) voidsetPower(double power) voidsetPowerInternal(double power) voidsetPowerRange(double minPower, double maxPower) voidsetRawPosition(org.wpilib.units.measure.Angle position) Override the position of the motor controller.voidsetRawPositionTarget(org.wpilib.units.measure.Angle rawPosition, XCANMotorController.MotorPidMode mode, int slot) Set the target position for the motor controller.voidsetRawVelocity(org.wpilib.units.measure.AngularVelocity rawVelocity) voidsetRawVelocityTarget(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, int slot) Set the target velocity for the motor controller.voidsetRawVelocityTargetWithFeedForward(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, double feedForward, int slot) Set the target velocity for the motor controller.voidsetTrapezoidalProfileAcceleration(org.wpilib.units.measure.AngularAcceleration acceleration) voidsetTrapezoidalProfileJerk(org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> jerk) voidsetTrapezoidalProfileMaxVelocity(org.wpilib.units.measure.AngularVelocity velocity) voidsetVelocity(org.wpilib.units.measure.AngularVelocity velocity) voidsetVoltage(org.wpilib.units.measure.Voltage voltage) voidsetVoltageRange(org.wpilib.units.measure.Voltage minVoltage, org.wpilib.units.measure.Voltage maxVoltage) protected voidMethods inherited from class XCANMotorController
convertDistanceToRawAngle, convertRawAngleToDistance, convertRawAngleToScaledAngle, convertRawVelocityToScaledVelocity, convertScaledAngleToRawAngle, convertScaledVelocityToRawVelocity, getCurrent, getPosition, getPositionAsDistance, getRawPosition, getRawVelocity, getVelocity, getVoltage, isValidPowerRequest, isValidVoltageRequest, periodic, refreshDataFrame, setAngleScaleFactor, setDistancePerMotorRotationsScaleFactor, setPidDirectly, setPidDirectly, setPidDirectly, setPosition, setPositionTarget, setPositionTarget, setPositionTarget, setRawPositionTarget, setRawPositionTarget, setRawVelocityTarget, setRawVelocityTarget, setRawVelocityTargetWithFeedForward, setRawVelocityTargetWithFeedForward, setSoftwareForwardLimit, setSoftwareReverseLimit, setVelocityTarget, setVelocityTarget, setVelocityTarget, setVelocityTargetWithFeedForward, setVelocityTargetWithFeedForward, setVelocityTargetWithFeedForward
-
Field Details
-
p
public double p -
i
public double i -
d
public double d -
s
public double s -
f
public double f -
g
public double g -
maxPower
public double maxPower -
minPower
public double minPower
-
-
Constructor Details
-
MockCANMotorController
@AssistedInject public MockCANMotorController(@Assisted("info") CANMotorControllerInfo info, @Assisted("owningSystemPrefix") String owningSystemPrefix, TunableFactory tunableFactory, DevicePolice police, @Assisted("pidTunablePrefix") String pidTunablePrefix, @Assisted("defaultPIDProperties") XCANMotorControllerPIDProperties defaultPIDProperties, DataFrameRegistry dataFrameRegistry, PowerDistributionProperties pdProperties)
-
-
Method Details
-
setConfiguration
- Specified by:
setConfigurationin classXCANMotorController
-
setOpenLoopRampRates
public void setOpenLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod) - Specified by:
setOpenLoopRampRatesin classXCANMotorController
-
setClosedLoopRampRates
public void setClosedLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod) - Specified by:
setClosedLoopRampRatesin classXCANMotorController
-
setTrapezoidalProfileAcceleration
public void setTrapezoidalProfileAcceleration(org.wpilib.units.measure.AngularAcceleration acceleration) - Specified by:
setTrapezoidalProfileAccelerationin classXCANMotorController
-
setTrapezoidalProfileJerk
public void setTrapezoidalProfileJerk(org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> jerk) - Specified by:
setTrapezoidalProfileJerkin classXCANMotorController
-
setTrapezoidalProfileMaxVelocity
public void setTrapezoidalProfileMaxVelocity(org.wpilib.units.measure.AngularVelocity velocity) - Specified by:
setTrapezoidalProfileMaxVelocityin classXCANMotorController
-
setPidDirectly
Description copied from class:XCANMotorControllerSet the PID values for the motor controller directly, without using tunables.- Specified by:
setPidDirectlyin classXCANMotorController- Parameters:
pidProperties- The PID properties to set.slot- The PID slot to set the values for.
-
getHealth
- Specified by:
getHealthin classXCANMotorController
-
setPower
public void setPower(double power) - Specified by:
setPowerin classXCANMotorController
-
setPowerInternal
public void setPowerInternal(double power) -
getPower
public double getPower()- Specified by:
getPowerin classXCANMotorController
-
setPowerRange
public void setPowerRange(double minPower, double maxPower) - Specified by:
setPowerRangein classXCANMotorController
-
getRawPosition_internal
public org.wpilib.units.measure.Angle getRawPosition_internal() -
setRawPosition
public void setRawPosition(org.wpilib.units.measure.Angle position) Description copied from class:XCANMotorControllerOverride the position of the motor controller.Typically, this would be called to zero the reported position of the motor as part of a calibration routine.
- Specified by:
setRawPositionin classXCANMotorController- Parameters:
position- The new position to set.
-
setRawPositionTarget
public void setRawPositionTarget(org.wpilib.units.measure.Angle rawPosition, XCANMotorController.MotorPidMode mode, int slot) Description copied from class:XCANMotorControllerSet the target position for the motor controller.- Specified by:
setRawPositionTargetin classXCANMotorController- Parameters:
rawPosition- The target position to set.mode- The PID mode to use when setting the target position.slot- The PID slot to use when setting the target position.
-
getTargetPosition
public org.wpilib.units.measure.Angle getTargetPosition() -
getRawTargetPosition
public org.wpilib.units.measure.Angle getRawTargetPosition() -
getRawVelocity_internal
public org.wpilib.units.measure.AngularVelocity getRawVelocity_internal() -
setVelocity
public void setVelocity(org.wpilib.units.measure.AngularVelocity velocity) -
setRawVelocity
public void setRawVelocity(org.wpilib.units.measure.AngularVelocity rawVelocity) -
setRawVelocityTarget
public void setRawVelocityTarget(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, int slot) Description copied from class:XCANMotorControllerSet the target velocity for the motor controller.- Specified by:
setRawVelocityTargetin classXCANMotorController- Parameters:
rawVelocity- The target velocity to set.mode- The PID mode to use when setting the target velocity.slot- The PID slot to use when setting the target velocity.
-
setRawVelocityTargetWithFeedForward
public void setRawVelocityTargetWithFeedForward(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, double feedForward, int slot) Description copied from class:XCANMotorControllerSet the target velocity for the motor controller.- Specified by:
setRawVelocityTargetWithFeedForwardin classXCANMotorController- Parameters:
rawVelocity- The target velocity to set.mode- The PID mode to use when setting the target velocity.feedForward- The additional feed forward to apply (in volts for voltage PID modes or -1..1 for duty-cycle PID modes).slot- The PID slot to use when setting the target velocity.
-
getRawTargetVelocity
public org.wpilib.units.measure.AngularVelocity getRawTargetVelocity() -
setVoltage
public void setVoltage(org.wpilib.units.measure.Voltage voltage) - Specified by:
setVoltagein classXCANMotorController
-
setVoltageRange
public void setVoltageRange(org.wpilib.units.measure.Voltage minVoltage, org.wpilib.units.measure.Voltage maxVoltage) - Specified by:
setVoltageRangein classXCANMotorController
-
isInverted
public boolean isInverted()- Specified by:
isInvertedin classXCANMotorController
-
getControlMode
-
setPositionAndVelocityUpdateFrequency
public void setPositionAndVelocityUpdateFrequency(org.wpilib.units.measure.Frequency frequency) - Specified by:
setPositionAndVelocityUpdateFrequencyin classXCANMotorController
-
updateInputs
- Specified by:
updateInputsin classXCANMotorController
-