Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 1 | #include "y2014/control_loops/drivetrain/drivetrain_base.h" |
| 2 | |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 3 | #include <chrono> |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 4 | |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 5 | #include "frc971/control_loops/drivetrain/drivetrain_config.h" |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 6 | #include "y2014/constants.h" |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 7 | #include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h" |
Austin Schuh | a062edb | 2019-01-03 13:17:13 -0800 | [diff] [blame] | 8 | #include "y2014/control_loops/drivetrain/hybrid_velocity_drivetrain.h" |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 9 | #include "y2014/control_loops/drivetrain/kalman_drivetrain_motor_plant.h" |
| 10 | #include "y2014/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h" |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 11 | |
| 12 | using ::frc971::control_loops::drivetrain::DrivetrainConfig; |
| 13 | |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 14 | namespace chrono = ::std::chrono; |
| 15 | |
Stephan Pleines | f63bde8 | 2024-01-13 15:59:33 -0800 | [diff] [blame] | 16 | namespace y2014::control_loops { |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 17 | |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 18 | const DrivetrainConfig<double> &GetDrivetrainConfig() { |
Brian Silverman | 3853f55 | 2016-05-15 14:11:58 -0700 | [diff] [blame] | 19 | // TODO(austin): Switch over to using the profile. |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 20 | static DrivetrainConfig<double> kDrivetrainConfig{ |
James Kuszmaul | 6802533 | 2024-01-20 17:06:02 -0800 | [diff] [blame] | 21 | ::frc971::control_loops::drivetrain::ShifterType::kHallEffectShifter, |
| 22 | ::frc971::control_loops::drivetrain::LoopType::kClosedLoop, |
| 23 | ::frc971::control_loops::drivetrain::GyroType::kSpartanGyro, |
| 24 | ::frc971::control_loops::drivetrain::ImuType::kImuX, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 25 | |
Austin Schuh | a062edb | 2019-01-03 13:17:13 -0800 | [diff] [blame] | 26 | drivetrain::MakeDrivetrainLoop, |
| 27 | drivetrain::MakeVelocityDrivetrainLoop, |
| 28 | drivetrain::MakeKFDrivetrainLoop, |
| 29 | drivetrain::MakeHybridVelocityDrivetrainLoop, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 30 | |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 31 | chrono::duration_cast<chrono::nanoseconds>( |
| 32 | chrono::duration<double>(drivetrain::kDt)), |
Comran Morshed | 3708f09 | 2016-02-20 16:23:51 +0000 | [diff] [blame] | 33 | drivetrain::kRobotRadius, |
| 34 | drivetrain::kWheelRadius, |
| 35 | drivetrain::kV, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 36 | |
Austin Schuh | 3130b37 | 2016-02-17 00:34:51 -0800 | [diff] [blame] | 37 | constants::GetValues().high_gear_ratio, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 38 | constants::GetValues().low_gear_ratio, |
Austin Schuh | e6a9fdf | 2019-01-12 16:05:43 -0800 | [diff] [blame] | 39 | drivetrain::kJ, |
| 40 | drivetrain::kMass, |
James Kuszmaul | 6802533 | 2024-01-20 17:06:02 -0800 | [diff] [blame] | 41 | constants::GetValues().left_drive.shifter_hall_effect(), |
| 42 | constants::GetValues().right_drive.shifter_hall_effect(), |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 43 | true /* default_high_gear */, |
Adam Snaider | 94a5237 | 2016-10-19 20:06:01 -0700 | [diff] [blame] | 44 | 0, |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 45 | 0.25 /* wheel_non_linearity */, |
| 46 | 1.0 /* quickturn_wheel_multiplier */, |
| 47 | 1.0 /* wheel_multiplier */, |
| 48 | }; |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 49 | |
| 50 | return kDrivetrainConfig; |
| 51 | }; |
| 52 | |
Stephan Pleines | f63bde8 | 2024-01-13 15:59:33 -0800 | [diff] [blame] | 53 | } // namespace y2014::control_loops |