blob: 4a793ae074d69c0d43399e8efade547059878219 [file] [log] [blame]
Brian Silverman431500a2013-10-28 19:50:15 -07001#ifndef FRC971_CONSTANTS_H_
2#define FRC971_CONSTANTS_H_
brians343bc112013-02-10 01:53:46 +00003#include <stdint.h>
4
Brian Silverman2c590c32013-11-04 18:08:54 -08005#include "frc971/control_loops/state_feedback_loop.h"
Daniel Pettiaece37f2014-10-25 17:13:44 -07006#include "frc971/shifter_hall_effect.h"
Brian Silverman2c590c32013-11-04 18:08:54 -08007
brians343bc112013-02-10 01:53:46 +00008namespace frc971 {
9namespace constants {
10
11// Has all of the numbers that change for both robots and makes it easy to
12// retrieve the values for the current one.
brians343bc112013-02-10 01:53:46 +000013
Brian Silverman431500a2013-10-28 19:50:15 -070014// This structure contains current values for all of the things that change.
15struct Values {
Comran Morshed79bd3db2015-02-07 14:51:13 +000016 // Drivetrain Values /////
Brian Silverman2c793712014-02-16 19:32:32 -080017
Brian Silverman1a6590d2013-11-04 14:46:46 -080018 // The ratio from the encoder shaft to the drivetrain wheels.
19 double drivetrain_encoder_ratio;
20
21 // The gear ratios from motor shafts to the drivetrain wheels for high and low
22 // gear.
23 double low_gear_ratio;
24 double high_gear_ratio;
Brian Silverman6eb51f12013-11-02 14:39:01 -070025 ShifterHallEffect left_drive, right_drive;
Brian Silverman1a6590d2013-11-04 14:46:46 -080026 bool clutch_transmission;
27
Brian Silvermanad9e0002014-04-13 14:55:57 -070028 double turn_width;
29
Brian Silverman2c590c32013-11-04 18:08:54 -080030 ::std::function<StateFeedbackLoop<2, 2, 2>()> make_v_drivetrain_loop;
31 ::std::function<StateFeedbackLoop<4, 2, 2>()> make_drivetrain_loop;
Brian Silvermandfdcd582014-02-16 20:50:09 -080032
Ben Fredrickson890c3fe2014-03-02 00:15:16 +000033 double drivetrain_done_distance;
34 double drivetrain_max_speed;
Comran Morshed79bd3db2015-02-07 14:51:13 +000035
36
37 // Superstructure Values /////
38
39 struct ZeroingConstants {
40 int average_filter_size;
41 double index_difference;
42 // Offset between the physical encoder index and the index we want.
43 double index_offset_at_zero;
44 };
45
46 ZeroingConstants left_arm_zeroing_constants;
47 ZeroingConstants right_arm_zeroing_constants;
48 ZeroingConstants left_elevator_zeroing_constants;
49 ZeroingConstants right_elevator_zeroing_constants;
50 ZeroingConstants claw_zeroing_constants;
51
52 // Defines a range of motion for a subsystem.
53 struct Range {
54 double lower_hard_limit;
55 double upper_hard_limit;
56 double lower_limit;
57 double upper_limit;
58 };
59
60 struct Claw {
61 Range wrist;
62 };
63 Claw claw;
64
65 struct Fridge {
66 Range elevator;
67 Range arm;
68 };
69 Fridge fridge;
Brian Silverman431500a2013-10-28 19:50:15 -070070};
71
Brian Silverman0a151c92014-05-02 15:28:44 -070072// Creates (once) a Values instance for ::aos::network::GetTeamNumber() and
73// returns a reference to it.
Brian Silverman431500a2013-10-28 19:50:15 -070074const Values &GetValues();
Brian Silverman0a151c92014-05-02 15:28:44 -070075
76// Creates Values instances for each team number it is called with and returns
77// them.
Ben Fredricksona9dcfa42014-02-23 02:05:59 +000078const Values &GetValuesForTeam(uint16_t team_number);
brians343bc112013-02-10 01:53:46 +000079
80} // namespace constants
81} // namespace frc971
Brian Silverman431500a2013-10-28 19:50:15 -070082
83#endif // FRC971_CONSTANTS_H_