37 const DCMotor& gearbox,
double gearing,
38 units::meter_t armLength, units::radian_t minAngle,
39 units::radian_t maxAngle,
bool simulateGravity,
40 const std::array<double, 1>& measurementStdDevs = {0.0});
56 units::kilogram_square_meter_t moi,
57 units::meter_t armLength, units::radian_t minAngle,
58 units::radian_t maxAngle,
bool simulateGravity,
59 const std::array<double, 1>& measurementStdDevs = {0.0});
129 units::meter_t length, units::kilogram_t mass) {
130 return 1.0 / 3.0 * mass * length * length;
142 units::second_t dt)
override;
145 units::meter_t m_armLen;
146 units::radian_t m_minAngle;
147 units::radian_t m_maxAngle;
150 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
This class helps simulate linear systems.
Definition: LinearSystemSim.h:31
Represents a simulated arm mechanism.
Definition: SingleJointedArmSim.h:21
bool WouldHitLowerLimit(units::radian_t armAngle) const
Returns whether the arm would hit the lower limit.
units::radians_per_second_t GetVelocity() const
Returns the current arm velocity.
units::radian_t GetAngle() const
Returns the current arm angle.
SingleJointedArmSim(const DCMotor &gearbox, double gearing, units::kilogram_square_meter_t moi, units::meter_t armLength, units::radian_t minAngle, units::radian_t maxAngle, bool simulateGravity, const std::array< double, 1 > &measurementStdDevs={0.0})
Creates a simulated arm mechanism.
units::ampere_t GetCurrentDraw() const override
Returns the arm current draw.
static constexpr units::kilogram_square_meter_t EstimateMOI(units::meter_t length, units::kilogram_t mass)
Calculates a rough estimate of the moment of inertia of an arm given its length and mass.
Definition: SingleJointedArmSim.h:128
bool HasHitUpperLimit() const
Returns whether the arm has hit the upper limit.
bool WouldHitUpperLimit(units::radian_t armAngle) const
Returns whether the arm would hit the upper limit.
SingleJointedArmSim(const LinearSystem< 2, 1, 1 > &system, const DCMotor &gearbox, double gearing, units::meter_t armLength, units::radian_t minAngle, units::radian_t maxAngle, bool simulateGravity, const std::array< double, 1 > &measurementStdDevs={0.0})
Creates a simulated arm mechanism.
bool HasHitLowerLimit() const
Returns whether the arm has hit the lower limit.
void SetInputVoltage(units::volt_t voltage)
Sets the input voltage for the arm.
Vectord< 2 > UpdateX(const Vectord< 2 > ¤tXhat, const Vectord< 1 > &u, units::second_t dt) override
Updates the state estimate of the arm.
Definition: BatterySim.h:14
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12