blob: 04cfa6c1328db5900a773041a820efc56ade8b5d [file] [log] [blame]
Comran Morshed5323ecb2015-12-26 20:50:55 +00001#ifndef FRC971_CONTROL_LOOPS_DRIVETRAIN_CONSTANTS_H_
2#define FRC971_CONTROL_LOOPS_DRIVETRAIN_CONSTANTS_H_
3
4#include <functional>
5
6#include "frc971/shifter_hall_effect.h"
7#include "frc971/control_loops/state_feedback_loop.h"
8
9namespace frc971 {
10namespace control_loops {
11namespace drivetrain {
12
13enum class ShifterType : int32_t {
14 HALL_EFFECT_SHIFTER = 0, // Detect when inbetween gears.
15 SIMPLE_SHIFTER = 1, // Switch gears without speedmatch logic.
16};
17
18struct DrivetrainConfig {
19 // Shifting method we are using.
20 ShifterType shifter_type;
21
22 // Polydrivetrain functions returning various controller loops with plants.
23 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
24 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
25 ::std::function<StateFeedbackLoop<7, 2, 3>()> make_kf_drivetrain_loop;
26
27 double dt; // Control loop time step.
Comran Morshed5323ecb2015-12-26 20:50:55 +000028 double robot_radius; // Robot radius, in meters.
29 double wheel_radius; // Wheel radius, in meters.
Comran Morshed5323ecb2015-12-26 20:50:55 +000030 double v; // Motor velocity constant.
Comran Morshed5323ecb2015-12-26 20:50:55 +000031
Austin Schuh09fa9bb2016-02-16 11:47:40 -080032 // Gear ratios, from wheel to motor shaft.
Comran Morshed5323ecb2015-12-26 20:50:55 +000033 double high_gear_ratio;
34 double low_gear_ratio;
35
36 // Hall effect constants. Unused if not applicable to shifter type.
37 constants::ShifterHallEffect left_drive;
38 constants::ShifterHallEffect right_drive;
39};
40
41} // namespace drivetrain
42} // namespace control_loops
43} // namespace frc971
44
45#endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_CONSTANTS_H_