blob: 089bdf0b9a0ee665b69fdad339d31c7ee2c07887 [file] [log] [blame]
Austin Schuh378483c2019-01-20 16:36:40 -08001#include "y2019/control_loops/drivetrain/drivetrain_base.h"
2
3#include <chrono>
4
5#include "frc971/control_loops/drivetrain/drivetrain_config.h"
6#include "frc971/control_loops/state_feedback_loop.h"
7#include "y2019/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
8#include "y2019/control_loops/drivetrain/hybrid_velocity_drivetrain.h"
9#include "y2019/control_loops/drivetrain/kalman_drivetrain_motor_plant.h"
10#include "y2019/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
11
12using ::frc971::control_loops::drivetrain::DrivetrainConfig;
13
14namespace chrono = ::std::chrono;
15
16namespace y2019 {
17namespace control_loops {
18namespace drivetrain {
19
20using ::frc971::constants::ShifterHallEffect;
21
22const ShifterHallEffect kThreeStateDriveShifter{0.0, 0.0, 0.25, 0.75};
23
24const DrivetrainConfig<double> &GetDrivetrainConfig() {
25 static DrivetrainConfig<double> kDrivetrainConfig{
26 ::frc971::control_loops::drivetrain::ShifterType::SIMPLE_SHIFTER,
Austin Schuh834302a2019-02-16 15:47:25 -080027 ::frc971::control_loops::drivetrain::LoopType::CLOSED_LOOP,
Austin Schuh378483c2019-01-20 16:36:40 -080028 ::frc971::control_loops::drivetrain::GyroType::IMU_Z_GYRO,
Austin Schuhe7f6ddf2019-03-22 20:29:49 -070029 ::frc971::control_loops::drivetrain::IMUType::IMU_FLIPPED_X,
Austin Schuh378483c2019-01-20 16:36:40 -080030
James Kuszmaul8bad2412019-03-10 10:47:56 -070031 drivetrain::MakeDrivetrainLoop,
32 drivetrain::MakeVelocityDrivetrainLoop,
Austin Schuh378483c2019-01-20 16:36:40 -080033 drivetrain::MakeKFDrivetrainLoop,
34 drivetrain::MakeHybridVelocityDrivetrainLoop,
35
36 chrono::duration_cast<chrono::nanoseconds>(
37 chrono::duration<double>(drivetrain::kDt)),
James Kuszmaul8bad2412019-03-10 10:47:56 -070038 drivetrain::kRobotRadius,
39 drivetrain::kWheelRadius,
40 drivetrain::kV,
Austin Schuh378483c2019-01-20 16:36:40 -080041
James Kuszmaul8bad2412019-03-10 10:47:56 -070042 drivetrain::kHighGearRatio,
43 drivetrain::kLowGearRatio,
44 drivetrain::kJ,
45 drivetrain::kMass,
46 kThreeStateDriveShifter,
47 kThreeStateDriveShifter,
48 true /* default_high_gear */,
49 0 /* down_offset if using constants use
50 constants::GetValues().down_error */
51 ,
52 0.7 /* wheel_non_linearity */,
53 1.2 /* quickturn_wheel_multiplier */,
Austin Schuhf11ef5c2019-02-17 14:16:13 -080054 1.2 /* wheel_multiplier */,
James Kuszmaul8bad2412019-03-10 10:47:56 -070055 true /*pistol_grip_shift_enables_line_follow*/,
Austin Schuh378483c2019-01-20 16:36:40 -080056 };
57
58 return kDrivetrainConfig;
59};
60
61} // namespace drivetrain
62} // namespace control_loops
63} // namespace y2019