40 const DCMotor& gearbox,
double gearing,
41 units::meter_t armLength, units::radian_t minAngle,
42 units::radian_t maxAngle,
bool simulateGravity,
43 units::radian_t startingAngle,
44 const std::array<double, 1>& measurementStdDevs = {0.0});
61 units::kilogram_square_meter_t moi,
62 units::meter_t armLength, units::radian_t minAngle,
63 units::radian_t maxAngle,
bool simulateGravity,
64 units::radian_t startingAngle,
65 const std::array<double, 1>& measurementStdDevs = {0.0});
76 void SetState(units::radian_t angle, units::radians_per_second_t velocity);
146 units::meter_t length, units::kilogram_t mass) {
147 return 1.0 / 3.0 * mass * length * length;
159 units::second_t dt)
override;
162 units::meter_t m_armLen;
163 units::radian_t m_minAngle;
164 units::radian_t m_maxAngle;
167 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
void SetState(const Vectord< States > &state)
Sets the system state.
Definition: LinearSystemSim.h:107
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.
void SetState(units::radian_t angle, units::radians_per_second_t velocity)
Sets the arm's state.
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, units::radian_t startingAngle, const std::array< double, 1 > &measurementStdDevs={0.0})
Creates a simulated arm mechanism.
units::radians_per_second_t GetVelocity() const
Returns the current arm velocity.
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, units::radian_t startingAngle, const std::array< double, 1 > &measurementStdDevs={0.0})
Creates a simulated arm mechanism.
units::radian_t GetAngle() const
Returns the current arm angle.
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:145
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.
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: XboxControllerSim.h:13
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12