22 template <
typename Distance>
26 template <
typename Distance>
46 units::meter_t minHeight, units::meter_t maxHeight,
47 bool simulateGravity, units::meter_t startingHeight,
48 const std::array<double, 1>& measurementStdDevs = {0.0});
67 units::kilogram_t carriageMass, units::meter_t drumRadius,
68 units::meter_t minHeight, units::meter_t maxHeight,
69 bool simulateGravity, units::meter_t startingHeight,
70 const std::array<double, 1>& measurementStdDevs = {0.0});
85 template <
typename Distance>
86 requires std::same_as<units::meter, Distance> ||
87 std::same_as<units::radian, Distance>
90 const DCMotor& gearbox, units::meter_t minHeight,
91 units::meter_t maxHeight,
bool simulateGravity,
92 units::meter_t startingHeight,
93 const std::array<double, 1>& measurementStdDevs = {0.0});
102 void SetState(units::meter_t position, units::meters_per_second_t velocity);
171 units::second_t dt)
override;
175 units::meter_t m_minHeight;
176 units::meter_t m_maxHeight;
177 bool m_simulateGravity;
Holds the constants for a DC motor.
Definition: DCMotor.h:20
A plant defined using state-space notation.
Definition: LinearSystem.h:31
Represents a simulated elevator mechanism.
Definition: ElevatorSim.h:20
ElevatorSim(decltype(1_V/Velocity_t< Distance >(1)) kV, decltype(1_V/Acceleration_t< Distance >(1)) kA, const DCMotor &gearbox, units::meter_t minHeight, units::meter_t maxHeight, bool simulateGravity, units::meter_t startingHeight, const std::array< double, 1 > &measurementStdDevs={0.0})
Constructs a simulated elevator mechanism.
bool HasHitUpperLimit() const
Returns whether the elevator has hit the upper limit.
units::meters_per_second_t GetVelocity() const
Returns the velocity of the elevator.
void SetInputVoltage(units::volt_t voltage)
Sets the input voltage for the elevator.
ElevatorSim(const LinearSystem< 2, 1, 1 > &plant, const DCMotor &gearbox, units::meter_t minHeight, units::meter_t maxHeight, bool simulateGravity, units::meter_t startingHeight, const std::array< double, 1 > &measurementStdDevs={0.0})
Constructs a simulated elevator mechanism.
units::ampere_t GetCurrentDraw() const override
Returns the elevator current draw.
bool WouldHitUpperLimit(units::meter_t elevatorHeight) const
Returns whether the elevator would hit the upper limit.
ElevatorSim(const DCMotor &gearbox, double gearing, units::kilogram_t carriageMass, units::meter_t drumRadius, units::meter_t minHeight, units::meter_t maxHeight, bool simulateGravity, units::meter_t startingHeight, const std::array< double, 1 > &measurementStdDevs={0.0})
Constructs a simulated elevator mechanism.
bool HasHitLowerLimit() const
Returns whether the elevator has hit the lower limit.
Vectord< 2 > UpdateX(const Vectord< 2 > ¤tXhat, const Vectord< 1 > &u, units::second_t dt) override
Updates the state estimate of the elevator.
units::meter_t GetPosition() const
Returns the position of the elevator.
bool WouldHitLowerLimit(units::meter_t elevatorHeight) const
Returns whether the elevator would hit the lower limit.
void SetState(units::meter_t position, units::meters_per_second_t velocity)
Sets the elevator's state.
This class helps simulate linear systems.
Definition: LinearSystemSim.h:31
void SetState(const Vectord< States > &state)
Sets the system state.
Definition: LinearSystemSim.h:107
Container for values which represent quantities of a given unit.
Definition: base.h:1926
typename units::detail::inverse_impl< U >::type inverse
represents the inverse unit type of class U.
Definition: base.h:1134
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1434
Definition: XboxControllerSim.h:13
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12