blob: b6b0bdce0d5683810a6a1af4af461d31a14a7f34 [file] [log] [blame]
Adam Snaider18f44172016-10-22 15:30:21 -07001package y2016_bot3.control_loops;
2
3import "aos/common/controls/control_loops.q";
4import "frc971/control_loops/control_loops.q";
5
6struct JointState {
7 // Angle of the joint in radians.
8 float angle;
9 // Angular velocity of the joint in radians/second.
10 float angular_velocity;
11 // Profiled goal angle of the joint in radians.
12 float goal_angle;
13 // Profiled goal angular velocity of the joint in radians/second.
14 float goal_angular_velocity;
15 // Unprofiled goal angle of the joint in radians.
16 float unprofiled_goal_angle;
17 // Unprofiled goal angular velocity of the joint in radians/second.
18 float unprofiled_goal_angular_velocity;
19
20 // The estimated voltage error.
21 float voltage_error;
22
23 // The calculated velocity with delta x/delta t
24 float calculated_velocity;
25
26 // Components of the control loop output
27 float position_power;
28 float velocity_power;
29 float feedforwards_power;
30
31 // State of the estimator.
32 .frc971.EstimatorState estimator_state;
33};
34
35queue_group IntakeQueue {
36 implements aos.control_loops.ControlLoop;
37
38 message Goal {
39 // Zero on the intake is when the horizontal tube stock members are level
40 // with the ground. This will be essentially when we are in the intaking
41 // position. Positive is up. The angle is measured relative to the top
42 // of the robot frame.
43 // Zero on the shoulder is horizontal. Positive is up. The angle is
44 // measured relative to the top of the robot frame.
45 // Zero on the wrist is horizontal and landed in the bellypan. Positive is
46 // the same direction as the shoulder. The angle is measured relative to
47 // the top of the robot frame.
48
49 // Goal angles and angular velocities of the intake.
50 double angle_intake;
51
52 // Caps on velocity/acceleration for profiling. 0 for the default.
53 float max_angular_velocity_intake;
54
55 float max_angular_acceleration_intake;
56
57 // Voltage to send to the rollers. Positive is sucking in.
58 float voltage_top_rollers;
59 float voltage_bottom_rollers;
60
61 bool force_intake;
62
63 // If true, release the latch which holds the traverse mechanism in the
64 // middle.
65 bool traverse_unlatched;
66 // If true, fire the traverse mechanism down.
67 bool traverse_down;
68 };
69
70 message Status {
71 // Is the intake zeroed?
72 bool zeroed;
73
74 // If true, we have aborted.
75 bool estopped;
76
77 // The internal state of the state machine.
78 int32_t state;
79
80
81 // Estimated angle and angular velocitie of the intake.
82 JointState intake;
Adam Snaider18f44172016-10-22 15:30:21 -070083 };
84
85 message Position {
86 // Zero for the intake potentiometer value is horizontal, and positive is
87 // up.
88 .frc971.PotAndIndexPosition intake;
89 };
90
91 message Output {
92 float voltage_intake;
93
94 float voltage_top_rollers;
95 float voltage_bottom_rollers;
96
97 // If true, release the latch to hold the traverse mechanism in the middle.
98 bool traverse_unlatched;
99 // If true, fire the traverse mechanism down.
100 bool traverse_down;
101 };
102
103 queue Goal goal;
104 queue Position position;
105 queue Output output;
106 queue Status status;
107};
108
109queue_group IntakeQueue intake_queue;