blob: 5f55938f66788c16f94f7fcdab9a81a550d9cfe8 [file] [log] [blame]
Comran Morshed6c6a0a92016-01-17 12:45:16 +00001#ifndef Y2016_CONSTANTS_H_
2#define Y2016_CONSTANTS_H_
Comran Morshed9a9948c2016-01-16 15:58:04 +00003
4#include <stdint.h>
5
Comran Morshed9a9948c2016-01-16 15:58:04 +00006#include "frc971/shifter_hall_effect.h"
Comran Morshed6c6a0a92016-01-17 12:45:16 +00007#include "frc971/control_loops/state_feedback_loop.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +00008
Comran Morshed6c6a0a92016-01-17 12:45:16 +00009namespace y2016 {
Comran Morshed9a9948c2016-01-16 15:58:04 +000010namespace constants {
11
12using ::frc971::constants::ShifterHallEffect;
13
14// Has all of the numbers that change for both robots and makes it easy to
15// retrieve the values for the current one.
16
17// Everything is in SI units (volts, radians, meters, seconds, etc).
18// Some of these values are related to the conversion between raw values
19// (encoder counts, voltage, etc) to scaled units (radians, meters, etc).
20
21// This structure contains current values for all of the things that change.
22struct Values {
Comran Morshed9a9948c2016-01-16 15:58:04 +000023 // The ratio from the encoder shaft to the drivetrain wheels.
24 double drivetrain_encoder_ratio;
25
26 // The gear ratios from motor shafts to the drivetrain wheels for high and low
27 // gear.
28 double low_gear_ratio;
29 double high_gear_ratio;
30 ShifterHallEffect left_drive, right_drive;
Comran Morshed9a9948c2016-01-16 15:58:04 +000031
32 double turn_width;
33
34 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
35 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
36
37 double drivetrain_max_speed;
Comran Morshed9a9948c2016-01-16 15:58:04 +000038};
39
40// Creates (once) a Values instance for ::aos::network::GetTeamNumber() and
41// returns a reference to it.
42const Values &GetValues();
43
44// Creates Values instances for each team number it is called with and returns
45// them.
46const Values &GetValuesForTeam(uint16_t team_number);
47
48} // namespace constants
Comran Morshed6c6a0a92016-01-17 12:45:16 +000049} // namespace y2016
Comran Morshed9a9948c2016-01-16 15:58:04 +000050
Comran Morshed6c6a0a92016-01-17 12:45:16 +000051#endif // Y2016_CONSTANTS_H_