blob: da3edbb37164375741c7e9fdd78cfe819c4377dd [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;
83
84 // Is the intake collided?
85 bool is_collided;
86 };
87
88 message Position {
89 // Zero for the intake potentiometer value is horizontal, and positive is
90 // up.
91 .frc971.PotAndIndexPosition intake;
92 };
93
94 message Output {
95 float voltage_intake;
96
97 float voltage_top_rollers;
98 float voltage_bottom_rollers;
99
100 // If true, release the latch to hold the traverse mechanism in the middle.
101 bool traverse_unlatched;
102 // If true, fire the traverse mechanism down.
103 bool traverse_down;
104 };
105
106 queue Goal goal;
107 queue Position position;
108 queue Output output;
109 queue Status status;
110};
111
112queue_group IntakeQueue intake_queue;