Class CANdiSimState
CANdi
.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe orientation of the PWM1 sensor relative to the robot chassis.The orientation of the PWM2 sensor relative to the robot chassis.int
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi.The orientation of the Quadrature sensor relative to the robot chassis. -
Constructor Summary
ConstructorsConstructorDescriptionCANdiSimState
(CoreCANdi device) Creates an object to control the state of the givenCANdi
.CANdiSimState
(CoreCANdi device, ChassisReference pwm1Orientation, ChassisReference pwm2Orientation, ChassisReference quadratureOrientation) Creates an object to control the state of the givenCANdi
. -
Method Summary
Modifier and TypeMethodDescriptionsetOutputCurrent
(double amps) Sets the simulated output current of the CANdi.setOutputCurrent
(Current current) Sets the simulated output current of the CANdi.setPwm1Connected
(boolean connected) Sets whether a PWM sensor is connected to the S1 pin.setPwm1Position
(double rotations) Sets the simulated pulse width position of the CANdi.setPwm1Position
(Angle position) Sets the simulated pulse width position of the CANdi.setPwm1RiseFall
(double timeSeconds) Sets the simulated PWM1 Rise to Fall timing of the CANdi.setPwm1RiseFall
(Time time) Sets the simulated PWM1 Rise to Fall timing of the CANdi.setPwm1RiseRise
(double timeSeconds) Sets the simulated PWM1 Rise to Rise timing of the CANdi.setPwm1RiseRise
(Time time) Sets the simulated PWM1 Rise to Rise timing of the CANdi.setPwm1Velocity
(double rps) Sets the simulated pulse width velocity of the CANdi.setPwm1Velocity
(AngularVelocity velocity) Sets the simulated pulse width velocity of the CANdi.setPwm2Connected
(boolean connected) Sets whether a PWM sensor is connected to the S2 pin.setPwm2Position
(double rotations) Sets the simulated pulse width position of the CANdi.setPwm2Position
(Angle position) Sets the simulated pulse width position of the CANdi.setPwm2RiseFall
(double timeSeconds) Sets the simulated PWM2 Rise to Fall timing of the CANdi.setPwm2RiseFall
(Time time) Sets the simulated PWM2 Rise to Fall timing of the CANdi.setPwm2RiseRise
(double timeSeconds) Sets the simulated PWM2 Rise to Rise timing of the CANdi.setPwm2RiseRise
(Time time) Sets the simulated PWM2 Rise to Rise timing of the CANdi.setPwm2Velocity
(double rps) Sets the simulated pulse width velocity of the CANdi.setPwm2Velocity
(AngularVelocity velocity) Sets the simulated pulse width velocity of the CANdi.setQuadratureVelocity
(double rps) Sets the simulated quadrature velocity of the CANdi.setQuadratureVelocity
(AngularVelocity velocity) Sets the simulated pulse width velocity of the CANdi.setRawQuadraturePosition
(double rotations) Sets the simulated raw quadrature position of the CANdi.setRawQuadraturePosition
(Angle position) Sets the simulated raw quadrature position of the CANdi.setS1State
(S1StateValue state) Sets the state of the S1 pinsetS2State
(S2StateValue state) Sets the state of the S2 pinsetSupplyVoltage
(double volts) Sets the simulated supply voltage of the CANdi.setSupplyVoltage
(Voltage voltage) Sets the simulated supply voltage of the CANdi.
-
Field Details
-
Pwm1Orientation
The orientation of the PWM1 sensor relative to the robot chassis.This value should not be changed based on the CANdi PWM1 invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
-
Pwm2Orientation
The orientation of the PWM2 sensor relative to the robot chassis.This value should not be changed based on the CANdi PWM2 invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
-
QuadratureOrientation
The orientation of the Quadrature sensor relative to the robot chassis.This value should not be changed based on the CANdi Quadrature invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
-
QuadratureEdgesPerRotation
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi.
-
-
Constructor Details
-
CANdiSimState
Creates an object to control the state of the givenCANdi
.Note the recommended method of accessing simulation features is to use
CoreCANdi.getSimState()
- Parameters:
device
- Device to which this simulation state is attached
-
CANdiSimState
public CANdiSimState(CoreCANdi device, ChassisReference pwm1Orientation, ChassisReference pwm2Orientation, ChassisReference quadratureOrientation) Creates an object to control the state of the givenCANdi
.Note the recommended method of accessing simulation features is to use
CoreCANdi.getSimState()
- Parameters:
device
- Device to which this simulation state is attachedpwm1Orientation
- Orientation of the PWM1 sensor relative to the robot chassispwm2Orientation
- Orientation of the PWM2 sensor relative to the robot chassisquadratureOrientation
- Orientation of the Quadrature sensor relative to the robot chassis
-
-
Method Details
-
setSupplyVoltage
Sets the simulated supply voltage of the CANdi.The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts
- The supply voltage in Volts- Returns:
- Status code
-
setSupplyVoltage
Sets the simulated supply voltage of the CANdi.The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
voltage
- The supply voltage- Returns:
- Status code
-
setOutputCurrent
Sets the simulated output current of the CANdi.- Parameters:
amps
- The output current in amps- Returns:
- Status code
-
setOutputCurrent
Sets the simulated output current of the CANdi.- Parameters:
current
- The output current- Returns:
- Status code
-
setPwm1RiseRise
Sets the simulated PWM1 Rise to Rise timing of the CANdi.- Parameters:
timeSeconds
- The time between two Rise events in seconds- Returns:
- Status code
-
setPwm1RiseRise
Sets the simulated PWM1 Rise to Rise timing of the CANdi.- Parameters:
time
- The time between two Rise events- Returns:
- Status code
-
setPwm1RiseFall
Sets the simulated PWM1 Rise to Fall timing of the CANdi.- Parameters:
timeSeconds
- The time between the Rise and Fall events in seconds- Returns:
- Status code
-
setPwm1RiseFall
Sets the simulated PWM1 Rise to Fall timing of the CANdi.- Parameters:
time
- The time between the Rise and Fall events- Returns:
- Status code
-
setPwm1Connected
Sets whether a PWM sensor is connected to the S1 pin.- Parameters:
connected
- True if sensor is connected- Returns:
- Status code
-
setPwm1Position
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S1 pin.- Parameters:
rotations
- The new position in rotations- Returns:
- Status code
-
setPwm1Position
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S1 pin.- Parameters:
position
- The new position- Returns:
- Status code
-
setPwm1Velocity
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S1 pin.- Parameters:
rps
- The new velocity in rotations per second- Returns:
- Status code
-
setPwm1Velocity
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S1 pin.- Parameters:
velocity
- The new velocity- Returns:
- Status code
-
setPwm2RiseRise
Sets the simulated PWM2 Rise to Rise timing of the CANdi.- Parameters:
timeSeconds
- The time between two Rise events in seconds- Returns:
- Status code
-
setPwm2RiseRise
Sets the simulated PWM2 Rise to Rise timing of the CANdi.- Parameters:
time
- The time between two Rise events- Returns:
- Status code
-
setPwm2RiseFall
Sets the simulated PWM2 Rise to Fall timing of the CANdi.- Parameters:
timeSeconds
- The time between the Rise and Fall events in seconds- Returns:
- Status code
-
setPwm2RiseFall
Sets the simulated PWM2 Rise to Fall timing of the CANdi.- Parameters:
time
- The time between the Rise and Fall events- Returns:
- Status code
-
setPwm2Connected
Sets whether a PWM sensor is connected to the S2 pin.- Parameters:
connected
- True if sensor is connected- Returns:
- Status code
-
setPwm2Position
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S2 pin.- Parameters:
rotations
- The new position in rotations- Returns:
- Status code
-
setPwm2Position
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S2 pin.- Parameters:
position
- The new position- Returns:
- Status code
-
setPwm2Velocity
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S2 pin.- Parameters:
rps
- The new velocity in rotations per second- Returns:
- Status code
-
setPwm2Velocity
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S2 pin.- Parameters:
velocity
- The new velocity- Returns:
- Status code
-
setRawQuadraturePosition
Sets the simulated raw quadrature position of the CANdi.Inputs to this function over time should be continuous, as user calls of
CoreCANdi.setQuadraturePosition(double)
will be accounted for in the callee.The CANdi integrates this to calculate the true reported quadrature position.
When using the WPI Sim GUI, you will notice a readonly
position
and settablerawPositionInput
. The readonly signal is the emulated position which will match self-test in Tuner and the hardware API. Changes torawPositionInput
will be integrated into the emulated position. This way a simulator can modify the position without overriding hardware API calls for home-ing the sensor.- Parameters:
rotations
- The raw position in rotations- Returns:
- Status code
-
setRawQuadraturePosition
Sets the simulated raw quadrature position of the CANdi.Inputs to this function over time should be continuous, as user calls of
CoreCANdi.setQuadraturePosition(double)
will be accounted for in the callee.The CANdi integrates this to calculate the true reported quadrature position.
When using the WPI Sim GUI, you will notice a readonly
position
and settablerawPositionInput
. The readonly signal is the emulated position which will match self-test in Tuner and the hardware API. Changes torawPositionInput
will be integrated into the emulated position. This way a simulator can modify the position without overriding hardware API calls for home-ing the sensor.- Parameters:
position
- The raw position- Returns:
- Status code
-
setQuadratureVelocity
Sets the simulated quadrature velocity of the CANdi.- Parameters:
rps
- The new velocity in rotations per second- Returns:
- Status code
-
setQuadratureVelocity
Sets the simulated pulse width velocity of the CANdi.- Parameters:
velocity
- The new velocity- Returns:
- Status code
-
setS1State
Sets the state of the S1 pin- Parameters:
state
- The state to set the S1 pin to- Returns:
- Status code
-
setS2State
Sets the state of the S2 pin- Parameters:
state
- The state to set the S2 pin to- Returns:
- Status code
-