blob: 978680c5dff856412575ed680fcb8c74409c5705 [file] [log] [blame]
Comran Morshed6c6a0a92016-01-17 12:45:16 +00001#include "y2016/control_loops/drivetrain/drivetrain_base.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +00002
Austin Schuhbb735b72019-01-03 12:58:41 -08003#include <chrono>
Comran Morshed9a9948c2016-01-16 15:58:04 +00004
Austin Schuhbb735b72019-01-03 12:58:41 -08005#include "frc971/control_loops/drivetrain/drivetrain_config.h"
Comran Morshed225f0b92016-02-10 20:34:27 +00006#include "frc971/control_loops/state_feedback_loop.h"
Comran Morshed6c6a0a92016-01-17 12:45:16 +00007#include "y2016/constants.h"
Austin Schuhbb735b72019-01-03 12:58:41 -08008#include "y2016/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
Austin Schuha062edb2019-01-03 13:17:13 -08009#include "y2016/control_loops/drivetrain/hybrid_velocity_drivetrain.h"
Austin Schuhbb735b72019-01-03 12:58:41 -080010#include "y2016/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
11#include "y2016/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +000012
13using ::frc971::control_loops::drivetrain::DrivetrainConfig;
14
Austin Schuhbb735b72019-01-03 12:58:41 -080015namespace chrono = ::std::chrono;
16
Stephan Pleinesf63bde82024-01-13 15:59:33 -080017namespace y2016::control_loops::drivetrain {
Comran Morshed9a9948c2016-01-16 15:58:04 +000018
Comran Morshed225f0b92016-02-10 20:34:27 +000019using ::frc971::constants::ShifterHallEffect;
20
Sabina Davis415bb6c2017-10-16 23:30:52 -070021const ShifterHallEffect kThreeStateDriveShifter{0.0, 0.0, 0.25, 0.75};
Comran Morshed225f0b92016-02-10 20:34:27 +000022
Austin Schuhbcce26a2018-03-26 23:41:24 -070023const DrivetrainConfig<double> &GetDrivetrainConfig() {
24 static DrivetrainConfig<double> kDrivetrainConfig{
James Kuszmaul68025332024-01-20 17:06:02 -080025 ::frc971::control_loops::drivetrain::ShifterType::kHallEffectShifter,
26 ::frc971::control_loops::drivetrain::LoopType::kClosedLoop,
27 ::frc971::control_loops::drivetrain::GyroType::kSpartanGyro,
28 ::frc971::control_loops::drivetrain::ImuType::kImuX,
Comran Morshed9a9948c2016-01-16 15:58:04 +000029
Austin Schuha062edb2019-01-03 13:17:13 -080030 drivetrain::MakeDrivetrainLoop,
31 drivetrain::MakeVelocityDrivetrainLoop,
32 drivetrain::MakeKFDrivetrainLoop,
33 drivetrain::MakeHybridVelocityDrivetrainLoop,
Comran Morshed9a9948c2016-01-16 15:58:04 +000034
Austin Schuhbb735b72019-01-03 12:58:41 -080035 chrono::duration_cast<chrono::nanoseconds>(
36 chrono::duration<double>(drivetrain::kDt)),
Comran Morshed6c6a0a92016-01-17 12:45:16 +000037 drivetrain::kRobotRadius,
38 drivetrain::kWheelRadius,
Comran Morshed6c6a0a92016-01-17 12:45:16 +000039 drivetrain::kV,
Comran Morshed3708f092016-02-20 16:23:51 +000040
Austin Schuh33bc6842016-02-17 00:38:51 -080041 drivetrain::kHighGearRatio,
42 drivetrain::kLowGearRatio,
Austin Schuhe6a9fdf2019-01-12 16:05:43 -080043 drivetrain::kJ,
44 drivetrain::kMass,
Comran Morshed225f0b92016-02-10 20:34:27 +000045 kThreeStateDriveShifter,
Adam Snaiderbc918b62016-02-27 21:03:39 -080046 kThreeStateDriveShifter,
Austin Schuhe8a54c02018-03-05 00:25:58 -080047 true /* default_high_gear */,
Adam Snaider94a52372016-10-19 20:06:01 -070048 constants::GetValues().down_error,
Austin Schuhe8a54c02018-03-05 00:25:58 -080049 0.25 /* wheel_non_linearity */,
50 1.0 /* quickturn_wheel_multiplier */,
51 1.0 /* wheel_multiplier */,
52 };
Comran Morshed9a9948c2016-01-16 15:58:04 +000053
54 return kDrivetrainConfig;
55};
56
Stephan Pleinesf63bde82024-01-13 15:59:33 -080057} // namespace y2016::control_loops::drivetrain