28 template <
typename Distance>
32 template <
typename Distance>
48 units::kilogram_t mass,
49 units::meter_t radius,
63 DCMotor motor, units::kilogram_square_meter_t J,
double gearing);
86 template <
typename Distance>
87 requires std::same_as<units::meter, Distance> ||
88 std::same_as<units::radian, Distance>
92 if (kV <
decltype(kV){0}) {
93 throw std::domain_error(
"Kv must be greater than or equal to zero.");
95 if (kA <=
decltype(kA){0}) {
96 throw std::domain_error(
"Ka must be greater than zero.");
129 template <
typename Distance>
130 requires std::same_as<units::meter, Distance> ||
131 std::same_as<units::radian, Distance>
135 if (kV <
decltype(kV){0}) {
136 throw std::domain_error(
"Kv must be greater than or equal to zero.");
138 if (kA <=
decltype(kA){0}) {
139 throw std::domain_error(
"Ka must be greater than zero.");
142 Matrixd<2, 2> A{{0.0, 1.0}, {0.0, -kV.value() / kA.value()}};
173 decltype(1_V / 1_mps) kVLinear,
decltype(1_V / 1_mps_sq) kALinear,
174 decltype(1_V / 1_mps) kVAngular,
decltype(1_V / 1_mps_sq) kAAngular);
202 decltype(1_V / 1_mps) kVLinear,
decltype(1_V / 1_mps_sq) kALinear,
203 decltype(1_V / 1_rad_per_s) kVAngular,
204 decltype(1_V / 1_rad_per_s_sq) kAAngular, units::meter_t trackwidth);
217 units::kilogram_square_meter_t J,
233 units::kilogram_square_meter_t J,
256 template <
typename Distance>
257 requires std::same_as<units::meter, Distance> ||
258 std::same_as<units::radian, Distance>
262 if (kV <
decltype(kV){0}) {
263 throw std::domain_error(
"Kv must be greater than or equal to zero.");
265 if (kA <=
decltype(kA){0}) {
266 throw std::domain_error(
"Ka must be greater than zero.");
269 Matrixd<2, 2> A{{0.0, 1.0}, {0.0, -kV.value() / kA.value()}};
293 const DCMotor& motor, units::kilogram_t mass, units::meter_t r,
294 units::meter_t rb, units::kilogram_square_meter_t J,
double gearing);
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Holds the constants for a DC motor.
Definition: DCMotor.h:20
A plant defined using state-space notation.
Definition: LinearSystem.h:31
Linear system ID utility functions.
Definition: LinearSystemId.h:26
static LinearSystem< 2, 1, 2 > DCMotorSystem(DCMotor motor, units::kilogram_square_meter_t J, double gearing)
Create a state-space model of a DC motor system.
static LinearSystem< 2, 2, 2 > DrivetrainVelocitySystem(const DCMotor &motor, units::kilogram_t mass, units::meter_t r, units::meter_t rb, units::kilogram_square_meter_t J, double gearing)
Create a state-space model of differential drive drivetrain.
static LinearSystem< 1, 1, 1 > FlywheelSystem(DCMotor motor, units::kilogram_square_meter_t J, double gearing)
Create a state-space model of a flywheel system, the states of the system are [angular velocity],...
static LinearSystem< 2, 1, 1 > IdentifyPositionSystem(decltype(1_V/Velocity_t< Distance >(1)) kV, decltype(1_V/Acceleration_t< Distance >(1)) kA)
Create a state-space model for a 1 DOF position system from its kV (volts/(unit/sec)) and kA (volts/(...
Definition: LinearSystemId.h:132
static LinearSystem< 2, 1, 2 > DCMotorSystem(decltype(1_V/Velocity_t< Distance >(1)) kV, decltype(1_V/Acceleration_t< Distance >(1)) kA)
Create a state-space model of a DC motor system from its kV (volts/(unit/sec)) and kA (volts/(unit/se...
Definition: LinearSystemId.h:259
static LinearSystem< 1, 1, 1 > IdentifyVelocitySystem(decltype(1_V/Velocity_t< Distance >(1)) kV, decltype(1_V/Acceleration_t< Distance >(1)) kA)
Create a state-space model for a 1 DOF velocity system from its kV (volts/(unit/sec)) and kA (volts/(...
Definition: LinearSystemId.h:89
static LinearSystem< 2, 1, 1 > ElevatorSystem(DCMotor motor, units::kilogram_t mass, units::meter_t radius, double gearing)
Create a state-space model of the elevator system.
static LinearSystem< 2, 2, 2 > IdentifyDrivetrainSystem(decltype(1_V/1_mps) kVLinear, decltype(1_V/1_mps_sq) kALinear, decltype(1_V/1_rad_per_s) kVAngular, decltype(1_V/1_rad_per_s_sq) kAAngular, units::meter_t trackwidth)
Identify a differential drive drivetrain given the drivetrain's kV and kA in both linear {(volts/(met...
static LinearSystem< 2, 1, 1 > SingleJointedArmSystem(DCMotor motor, units::kilogram_square_meter_t J, double gearing)
Create a state-space model of a single-jointed arm system.The states of the system are [angle,...
static LinearSystem< 2, 2, 2 > IdentifyDrivetrainSystem(decltype(1_V/1_mps) kVLinear, decltype(1_V/1_mps_sq) kALinear, decltype(1_V/1_mps) kVAngular, decltype(1_V/1_mps_sq) kAAngular)
Identify a differential drive drivetrain given the drivetrain's kV and kA in both linear {(volts/(met...
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: AprilTagPoseEstimator.h:15
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition: EigenCore.h:21