Class SparkAnalogSensorSim
java.lang.Object
com.revrobotics.sim.SparkAnalogSensorSim
-
Constructor Summary
ConstructorsConstructorDescriptionSparkAnalogSensorSim(SparkFlex motor) Create a Spark Absolute Encoder simulation object for a Spark Flex.SparkAnalogSensorSim(SparkMax motor) Create a Spark Analog Sensor simulation object for a Spark MAX. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the inversion state of the sensordoubleGet the position of the sensordoubleGet the velocity of the sensordoubleGet the voltage of the sensorvoiditerate(double velocity, double dt) Move the sensor at the input velocityvoidsetInverted(boolean inverted) Set the inversion state of the sensorvoidsetPosition(double position) Set the position of the sensorvoidsetVelocity(double velocity) Set the velocity of the sensorvoidsetVoltage(double voltage) Set the voltage of the sensor
-
Constructor Details
-
SparkAnalogSensorSim
Create a Spark Analog Sensor simulation object for a Spark MAX. This will allow you to read/write data from the simulated sensor and view it in the Sim GUI.- Parameters:
motor- The CANSparkMax associated with the sensor
-
SparkAnalogSensorSim
Create a Spark Absolute Encoder simulation object for a Spark Flex. This will allow you to read/write data from the simulated sensor and view it in the Sim GUI.- Parameters:
motor- The CANSparkFlex associated with the sensor
-
-
Method Details
-
setVoltage
public void setVoltage(double voltage) Set the voltage of the sensor- Parameters:
voltage- the voltage to set
-
getVoltage
public double getVoltage()Get the voltage of the sensor- Returns:
- the voltage of the sensor
-
setPosition
public void setPosition(double position) Set the position of the sensor- Parameters:
position- the position to set
-
getPosition
public double getPosition()Get the position of the sensor- Returns:
- the position of the sensor
-
setVelocity
public void setVelocity(double velocity) Set the velocity of the sensor- Parameters:
velocity- the velocity to set
-
getVelocity
public double getVelocity()Get the velocity of the sensor- Returns:
- the velocity of the sensor
-
setInverted
public void setInverted(boolean inverted) Set the inversion state of the sensor- Parameters:
inverted- if the sensor is inverted or not
-
getInverted
public boolean getInverted()Get the inversion state of the sensor- Returns:
- if the sensor is inverted or not
-
iterate
public void iterate(double velocity, double dt) Move the sensor at the input velocity- Parameters:
velocity- the velocity of the sensordt- the time interval of the calculation
-