Class MapleMotorSim
DCMotorSim
with a bit of extra spice.
This class extends the functionality of the original DCMotorSim
and
models the following aspects in addition:
- Motor Controller Closed Loops.
- Smart current limiting.
- Friction force on the rotor.
-
Constructor Summary
ConstructorsConstructorDescriptionMapleMotorSim
(SimMotorConfigs configs) Constructs a Brushless Motor Simulation Instance. -
Method Summary
Modifier and TypeMethodDescriptionObtains the final position of the mechanism.Obtains the applied voltage by the motor controller.Obtains the configuration of the motor.Obtains the angular position measured by the relative encoder of the motor.Obtains the angular velocity measured by the relative encoder of the motor.Obtains the stator current.Obtains the supply current.Obtains the final velocity of the mechanism.void
Updates the simulation.<T extends SimulatedMotorController>
TuseMotorController
(T motorController)
-
Constructor Details
-
MapleMotorSim
Constructs a Brushless Motor Simulation Instance.
- Parameters:
configs
- the configuration for this motor
-
-
Method Details
-
update
Updates the simulation.
This is equivalent to
LinearSystemSim.update(double)
. -
useMotorController
-
useSimpleDCMotorController
-
getAngularPosition
Obtains the final position of the mechanism.
This is equivalent to
DCMotorSim.getAngularPosition()
.- Returns:
- the angular position of the mechanism, continuous
-
getEncoderPosition
Obtains the angular position measured by the relative encoder of the motor.
- Returns:
- the angular position measured by the encoder, continuous
-
getVelocity
Obtains the final velocity of the mechanism.
This is equivalent to
DCMotorSim.getAngularVelocity()
.- Returns:
- the final angular velocity of the mechanism
-
getEncoderVelocity
Obtains the angular velocity measured by the relative encoder of the motor.
- Returns:
- the angular velocity measured by the encoder
-
getAppliedVoltage
Obtains the applied voltage by the motor controller.
The applied voltage is calculated by the motor controller in the previous call to
update(Time)
The motor controller specified by
useMotorController(SimulatedMotorController)
is used to calculate the applied voltage.The applied voltage is also restricted for current limit and battery voltage.
- Returns:
- the applied voltage
-
getStatorCurrent
Obtains the stator current.
This is equivalent to
DCMotorSim.getCurrentDrawAmps()
- Returns:
- the stator current of the motor
-
getSupplyCurrent
Obtains the supply current.
The supply current is different from the stator current, as described here.
- Returns:
- the supply current of the motor
-
getConfigs
Obtains the configuration of the motor.
You can modify the configuration of this motor by:
mapleMotorSim.getConfigs() .with...(...) .with...(...);
- Returns:
- the configuration of the motor
-