mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] DCMotorSim cleanup/enhancement (#7021)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5acb4109ff
commit
5d9a553104
@@ -12,11 +12,13 @@
|
||||
#include "frc/simulation/DCMotorSim.h"
|
||||
#include "frc/simulation/EncoderSim.h"
|
||||
#include "frc/simulation/RoboRioSim.h"
|
||||
#include "frc/system/plant/LinearSystemId.h"
|
||||
|
||||
TEST(DCMotorSimTest, VoltageSteadyState) {
|
||||
frc::DCMotor gearbox = frc::DCMotor::NEO(1);
|
||||
frc::sim::DCMotorSim sim{gearbox, 1.0,
|
||||
units::kilogram_square_meter_t{0.0005}};
|
||||
auto plant = frc::LinearSystemId::DCMotorSystem(
|
||||
frc::DCMotor::NEO(1), units::kilogram_square_meter_t{0.0005}, 1.0);
|
||||
frc::sim::DCMotorSim sim{plant, gearbox};
|
||||
|
||||
frc::Encoder encoder{0, 1};
|
||||
frc::sim::EncoderSim encoderSim{encoder};
|
||||
@@ -60,8 +62,9 @@ TEST(DCMotorSimTest, VoltageSteadyState) {
|
||||
|
||||
TEST(DCMotorSimTest, PositionFeedbackControl) {
|
||||
frc::DCMotor gearbox = frc::DCMotor::NEO(1);
|
||||
frc::sim::DCMotorSim sim{gearbox, 1.0,
|
||||
units::kilogram_square_meter_t{0.0005}};
|
||||
auto plant = frc::LinearSystemId::DCMotorSystem(
|
||||
frc::DCMotor::NEO(1), units::kilogram_square_meter_t{0.0005}, 1.0);
|
||||
frc::sim::DCMotorSim sim{plant, gearbox};
|
||||
|
||||
frc::PIDController controller{0.04, 0.0, 0.001};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user