blob: be4f2380886badcef795e1997465266151e24662 [file] [log] [blame]
Comran Morshed5323ecb2015-12-26 20:50:55 +00001#include "y2014/control_loops/drivetrain/drivetrain_base.h"
2
Austin Schuhbb735b72019-01-03 12:58:41 -08003#include <chrono>
Comran Morshed5323ecb2015-12-26 20:50:55 +00004
Austin Schuhbb735b72019-01-03 12:58:41 -08005#include "frc971/control_loops/drivetrain/drivetrain_config.h"
Comran Morshed5323ecb2015-12-26 20:50:55 +00006#include "y2014/constants.h"
Austin Schuhbb735b72019-01-03 12:58:41 -08007#include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
Austin Schuha062edb2019-01-03 13:17:13 -08008#include "y2014/control_loops/drivetrain/hybrid_velocity_drivetrain.h"
Austin Schuhbb735b72019-01-03 12:58:41 -08009#include "y2014/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
10#include "y2014/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
Comran Morshed5323ecb2015-12-26 20:50:55 +000011
12using ::frc971::control_loops::drivetrain::DrivetrainConfig;
13
Austin Schuhbb735b72019-01-03 12:58:41 -080014namespace chrono = ::std::chrono;
15
Comran Morshed5323ecb2015-12-26 20:50:55 +000016namespace y2014 {
17namespace control_loops {
18
Austin Schuhbcce26a2018-03-26 23:41:24 -070019const DrivetrainConfig<double> &GetDrivetrainConfig() {
Brian Silverman3853f552016-05-15 14:11:58 -070020 // TODO(austin): Switch over to using the profile.
Austin Schuhbcce26a2018-03-26 23:41:24 -070021 static DrivetrainConfig<double> kDrivetrainConfig{
Comran Morshed5323ecb2015-12-26 20:50:55 +000022 ::frc971::control_loops::drivetrain::ShifterType::HALL_EFFECT_SHIFTER,
Comran Morshed76ca8f52016-02-21 17:26:28 +000023 ::frc971::control_loops::drivetrain::LoopType::CLOSED_LOOP,
Campbell Crowley2527ed22017-02-17 21:10:02 -080024 ::frc971::control_loops::drivetrain::GyroType::SPARTAN_GYRO,
Diana Burgessd0180f12018-03-21 21:24:17 -070025 ::frc971::control_loops::drivetrain::IMUType::IMU_X,
Comran Morshed5323ecb2015-12-26 20:50:55 +000026
Austin Schuha062edb2019-01-03 13:17:13 -080027 drivetrain::MakeDrivetrainLoop,
28 drivetrain::MakeVelocityDrivetrainLoop,
29 drivetrain::MakeKFDrivetrainLoop,
30 drivetrain::MakeHybridVelocityDrivetrainLoop,
Comran Morshed5323ecb2015-12-26 20:50:55 +000031
Austin Schuhbb735b72019-01-03 12:58:41 -080032 chrono::duration_cast<chrono::nanoseconds>(
33 chrono::duration<double>(drivetrain::kDt)),
Comran Morshed3708f092016-02-20 16:23:51 +000034 drivetrain::kRobotRadius,
35 drivetrain::kWheelRadius,
36 drivetrain::kV,
Comran Morshed5323ecb2015-12-26 20:50:55 +000037
Austin Schuh3130b372016-02-17 00:34:51 -080038 constants::GetValues().high_gear_ratio,
Comran Morshed5323ecb2015-12-26 20:50:55 +000039 constants::GetValues().low_gear_ratio,
Austin Schuhe6a9fdf2019-01-12 16:05:43 -080040 drivetrain::kJ,
41 drivetrain::kMass,
Sabina Davis415bb6c2017-10-16 23:30:52 -070042 constants::GetValues().left_drive.shifter_hall_effect,
43 constants::GetValues().right_drive.shifter_hall_effect,
Austin Schuhe8a54c02018-03-05 00:25:58 -080044 true /* default_high_gear */,
Adam Snaider94a52372016-10-19 20:06:01 -070045 0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080046 0.25 /* wheel_non_linearity */,
47 1.0 /* quickturn_wheel_multiplier */,
48 1.0 /* wheel_multiplier */,
49 };
Comran Morshed5323ecb2015-12-26 20:50:55 +000050
51 return kDrivetrainConfig;
52};
53
54} // namespace control_loops
55} // namespace y2014