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 | |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 16 | namespace y2014 { |
| 17 | namespace control_loops { |
| 18 | |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 19 | const DrivetrainConfig<double> &GetDrivetrainConfig() { |
Brian Silverman | 3853f55 | 2016-05-15 14:11:58 -0700 | [diff] [blame] | 20 | // TODO(austin): Switch over to using the profile. |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 21 | static DrivetrainConfig<double> kDrivetrainConfig{ |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 22 | ::frc971::control_loops::drivetrain::ShifterType::HALL_EFFECT_SHIFTER, |
Comran Morshed | 76ca8f5 | 2016-02-21 17:26:28 +0000 | [diff] [blame] | 23 | ::frc971::control_loops::drivetrain::LoopType::CLOSED_LOOP, |
Campbell Crowley | 2527ed2 | 2017-02-17 21:10:02 -0800 | [diff] [blame] | 24 | ::frc971::control_loops::drivetrain::GyroType::SPARTAN_GYRO, |
Diana Burgess | d0180f1 | 2018-03-21 21:24:17 -0700 | [diff] [blame] | 25 | ::frc971::control_loops::drivetrain::IMUType::IMU_X, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 26 | |
Austin Schuh | a062edb | 2019-01-03 13:17:13 -0800 | [diff] [blame] | 27 | drivetrain::MakeDrivetrainLoop, |
| 28 | drivetrain::MakeVelocityDrivetrainLoop, |
| 29 | drivetrain::MakeKFDrivetrainLoop, |
| 30 | drivetrain::MakeHybridVelocityDrivetrainLoop, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 31 | |
Austin Schuh | bb735b7 | 2019-01-03 12:58:41 -0800 | [diff] [blame] | 32 | chrono::duration_cast<chrono::nanoseconds>( |
| 33 | chrono::duration<double>(drivetrain::kDt)), |
Comran Morshed | 3708f09 | 2016-02-20 16:23:51 +0000 | [diff] [blame] | 34 | drivetrain::kRobotRadius, |
| 35 | drivetrain::kWheelRadius, |
| 36 | drivetrain::kV, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 37 | |
Austin Schuh | 3130b37 | 2016-02-17 00:34:51 -0800 | [diff] [blame] | 38 | constants::GetValues().high_gear_ratio, |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 39 | constants::GetValues().low_gear_ratio, |
Sabina Davis | 415bb6c | 2017-10-16 23:30:52 -0700 | [diff] [blame] | 40 | constants::GetValues().left_drive.shifter_hall_effect, |
| 41 | constants::GetValues().right_drive.shifter_hall_effect, |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 42 | true /* default_high_gear */, |
Adam Snaider | 94a5237 | 2016-10-19 20:06:01 -0700 | [diff] [blame] | 43 | 0, |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 44 | 0.25 /* wheel_non_linearity */, |
| 45 | 1.0 /* quickturn_wheel_multiplier */, |
| 46 | 1.0 /* wheel_multiplier */, |
| 47 | }; |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 48 | |
| 49 | return kDrivetrainConfig; |
| 50 | }; |
| 51 | |
| 52 | } // namespace control_loops |
| 53 | } // namespace y2014 |