blob: 55d102d284e6d980b4147ef64b9719ce93a50b81 [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;
Campbell Crowley483d6272016-11-05 14:11:34 -070060 float voltage_intake_rollers;
Adam Snaider18f44172016-10-22 15:30:21 -070061
62 bool force_intake;
63
Adam Snaider18f44172016-10-22 15:30:21 -070064 // If true, fire the traverse mechanism down.
65 bool traverse_down;
66 };
67
68 message Status {
69 // Is the intake zeroed?
70 bool zeroed;
71
72 // If true, we have aborted.
73 bool estopped;
74
75 // The internal state of the state machine.
76 int32_t state;
77
Adam Snaider18f44172016-10-22 15:30:21 -070078 // Estimated angle and angular velocitie of the intake.
79 JointState intake;
Adam Snaider18f44172016-10-22 15:30:21 -070080 };
81
82 message Position {
83 // Zero for the intake potentiometer value is horizontal, and positive is
84 // up.
85 .frc971.PotAndIndexPosition intake;
86 };
87
88 message Output {
89 float voltage_intake;
90
91 float voltage_top_rollers;
92 float voltage_bottom_rollers;
Campbell Crowley483d6272016-11-05 14:11:34 -070093 float voltage_intake_rollers;
Adam Snaider18f44172016-10-22 15:30:21 -070094
Adam Snaider18f44172016-10-22 15:30:21 -070095 // If true, fire the traverse mechanism down.
96 bool traverse_down;
97 };
98
99 queue Goal goal;
100 queue Position position;
101 queue Output output;
102 queue Status status;
103};
104
105queue_group IntakeQueue intake_queue;