blob: a8021fd47a57a348d491135b76a17ac4029a3e81 [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
Stephan Pleinesf63bde82024-01-13 15:59:33 -080016namespace y2014::control_loops {
Comran Morshed5323ecb2015-12-26 20:50:55 +000017
Austin Schuhbcce26a2018-03-26 23:41:24 -070018const DrivetrainConfig<double> &GetDrivetrainConfig() {
Brian Silverman3853f552016-05-15 14:11:58 -070019 // TODO(austin): Switch over to using the profile.
Austin Schuhbcce26a2018-03-26 23:41:24 -070020 static DrivetrainConfig<double> kDrivetrainConfig{
James Kuszmaul68025332024-01-20 17:06:02 -080021 ::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 Morshed5323ecb2015-12-26 20:50:55 +000025
Austin Schuha062edb2019-01-03 13:17:13 -080026 drivetrain::MakeDrivetrainLoop,
27 drivetrain::MakeVelocityDrivetrainLoop,
28 drivetrain::MakeKFDrivetrainLoop,
29 drivetrain::MakeHybridVelocityDrivetrainLoop,
Comran Morshed5323ecb2015-12-26 20:50:55 +000030
Austin Schuhbb735b72019-01-03 12:58:41 -080031 chrono::duration_cast<chrono::nanoseconds>(
32 chrono::duration<double>(drivetrain::kDt)),
Comran Morshed3708f092016-02-20 16:23:51 +000033 drivetrain::kRobotRadius,
34 drivetrain::kWheelRadius,
35 drivetrain::kV,
Comran Morshed5323ecb2015-12-26 20:50:55 +000036
Austin Schuh3130b372016-02-17 00:34:51 -080037 constants::GetValues().high_gear_ratio,
Comran Morshed5323ecb2015-12-26 20:50:55 +000038 constants::GetValues().low_gear_ratio,
Austin Schuhe6a9fdf2019-01-12 16:05:43 -080039 drivetrain::kJ,
40 drivetrain::kMass,
James Kuszmaul68025332024-01-20 17:06:02 -080041 constants::GetValues().left_drive.shifter_hall_effect(),
42 constants::GetValues().right_drive.shifter_hall_effect(),
Austin Schuhe8a54c02018-03-05 00:25:58 -080043 true /* default_high_gear */,
Adam Snaider94a52372016-10-19 20:06:01 -070044 0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080045 0.25 /* wheel_non_linearity */,
46 1.0 /* quickturn_wheel_multiplier */,
47 1.0 /* wheel_multiplier */,
48 };
Comran Morshed5323ecb2015-12-26 20:50:55 +000049
50 return kDrivetrainConfig;
51};
52
Stephan Pleinesf63bde82024-01-13 15:59:33 -080053} // namespace y2014::control_loops