blob: 44136a9c3eb576c81c7aeb125190a05a2c5d2524 [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 Morshed6c6a0a92016-01-17 12:45:16 +00006#include "frc971/control_loops/state_feedback_loop.h"
Austin Schuh2fc10fa2016-02-08 00:44:34 -08007#include "frc971/shifter_hall_effect.h"
8#include "frc971/constants.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +00009
Comran Morshed6c6a0a92016-01-17 12:45:16 +000010namespace y2016 {
Comran Morshed9a9948c2016-01-16 15:58:04 +000011namespace constants {
12
13using ::frc971::constants::ShifterHallEffect;
Austin Schuh2fc10fa2016-02-08 00:44:34 -080014using ::frc971::constants::ZeroingConstants;
Comran Morshed9a9948c2016-01-16 15:58:04 +000015
16// Has all of the numbers that change for both robots and makes it easy to
17// retrieve the values for the current one.
18
19// Everything is in SI units (volts, radians, meters, seconds, etc).
20// Some of these values are related to the conversion between raw values
21// (encoder counts, voltage, etc) to scaled units (radians, meters, etc).
22
23// This structure contains current values for all of the things that change.
24struct Values {
Comran Morshed9a9948c2016-01-16 15:58:04 +000025 // The ratio from the encoder shaft to the drivetrain wheels.
26 double drivetrain_encoder_ratio;
27
28 // The gear ratios from motor shafts to the drivetrain wheels for high and low
29 // gear.
30 double low_gear_ratio;
31 double high_gear_ratio;
32 ShifterHallEffect left_drive, right_drive;
Comran Morshed9a9948c2016-01-16 15:58:04 +000033
34 double turn_width;
35
36 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
37 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
38
39 double drivetrain_max_speed;
Austin Schuh2fc10fa2016-02-08 00:44:34 -080040
41 // Defines a range of motion for a subsystem.
42 // These are all absolute positions in scaled units.
43 struct Range {
44 double lower_hard;
45 double upper_hard;
46 double lower;
47 double upper;
48 };
49
50 struct Intake {
51 Range limits;
52 ZeroingConstants zeroing;
53 };
54 Intake intake;
55
56 struct Shoulder {
57 Range limits;
58 ZeroingConstants zeroing;
59 };
60 Shoulder shoulder;
61
62 struct Wrist {
63 Range limits;
64 ZeroingConstants zeroing;
65 };
66 Wrist wrist;
Comran Morshed9a9948c2016-01-16 15:58:04 +000067};
68
69// Creates (once) a Values instance for ::aos::network::GetTeamNumber() and
70// returns a reference to it.
71const Values &GetValues();
72
73// Creates Values instances for each team number it is called with and returns
74// them.
75const Values &GetValuesForTeam(uint16_t team_number);
76
77} // namespace constants
Comran Morshed6c6a0a92016-01-17 12:45:16 +000078} // namespace y2016
Comran Morshed9a9948c2016-01-16 15:58:04 +000079
Comran Morshed6c6a0a92016-01-17 12:45:16 +000080#endif // Y2016_CONSTANTS_H_