blob: 8a3b518cccc2830bb0b2f3469046e058fefe6ee5 [file] [log] [blame]
Comran Morshed25f81a02016-01-23 13:40:10 +00001package y2016.control_loops;
2
3import "aos/common/controls/control_loops.q";
4import "frc971/control_loops/control_loops.q";
5
Austin Schuh2fc10fa2016-02-08 00:44:34 -08006struct JointState {
7 // Angle of the joint in radians.
Austin Schuh39fd6102016-02-13 22:59:48 -08008 float angle;
Austin Schuh2fc10fa2016-02-08 00:44:34 -08009 // Angular velocity of the joint in radians/second.
10 float angular_velocity;
11 // Profiled goal angle of the joint in radians.
Austin Schuh39fd6102016-02-13 22:59:48 -080012 float goal_angle;
Austin Schuh2fc10fa2016-02-08 00:44:34 -080013 // Profiled goal angular velocity of the joint in radians/second.
Austin Schuh39fd6102016-02-13 22:59:48 -080014 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;
Austin Schuh2fc10fa2016-02-08 00:44:34 -080019
20 // State of the estimator.
21 .frc971.EstimatorState estimator_state;
22};
23
Comran Morshed25f81a02016-01-23 13:40:10 +000024queue_group SuperstructureQueue {
25 implements aos.control_loops.ControlLoop;
26
27 message Goal {
Austin Schuh2fc10fa2016-02-08 00:44:34 -080028 // Zero on the intake is when the horizontal tube stock members are level
29 // with the ground. This will be essentially when we are in the intaking
30 // position. Positive is up. The angle is measured relative to the top
31 // of the robot frame.
32 // Zero on the shoulder is horizontal. Positive is up. The angle is
33 // measured relative to the top of the robot frame.
34 // Zero on the wrist is horizontal and landed in the bellypan. Positive is
Austin Schuh5551b072016-02-15 14:06:36 -080035 // the same direction as the shoulder. The angle is measured relative to
36 // the top of the robot frame.
Austin Schuh2fc10fa2016-02-08 00:44:34 -080037
38 // Goal angles and angular velocities of the superstructure subsystems.
39 double angle_intake;
40 double angle_shoulder;
41 // In relation to the ground plane.
42 double angle_wrist;
43
44 // Caps on velocity/acceleration for profiling. 0 for the default.
45 float max_angular_velocity_intake;
46 float max_angular_velocity_shoulder;
47 float max_angular_velocity_wrist;
48
49 float max_angular_acceleration_intake;
50 float max_angular_acceleration_shoulder;
51 float max_angular_acceleration_wrist;
Comran Morshedf4cd7642016-02-15 20:40:49 +000052
53 // Voltage to send to the rollers. Positive is sucking in.
Campbell Crowleyd4fd6552016-02-21 17:53:46 -080054 float voltage_top_rollers;
55 float voltage_bottom_rollers;
Comran Morshed25f81a02016-01-23 13:40:10 +000056 };
57
58 message Status {
Austin Schuh2fc10fa2016-02-08 00:44:34 -080059 // Are the superstructure subsystems zeroed?
60 bool zeroed;
61
62 // If true, we have aborted.
63 bool estopped;
64
65 // The internal state of the state machine.
66 int32_t state;
67
68
69 // Estimated angles and angular velocities of the superstructure subsystems.
70 JointState intake;
71 JointState shoulder;
72 JointState wrist;
Comran Morshed25f81a02016-01-23 13:40:10 +000073 };
74
75 message Position {
Austin Schuh2fc10fa2016-02-08 00:44:34 -080076 // Zero for the intake potentiometer value is horizontal, and positive is
77 // up.
78 // Zero for the shoulder potentiometer value is horizontal, and positive is
79 // up.
80 // Zero for the wrist potentiometer value is parallel to the arm and with
81 // the shooter wheels pointed towards the shoulder joint. This is measured
82 // relative to the arm, not the ground, not like the world we actually
83 // present to users.
84 .frc971.PotAndIndexPosition intake;
85 .frc971.PotAndIndexPosition shoulder;
86 .frc971.PotAndIndexPosition wrist;
87 };
88
89 message Output {
Austin Schuh39fd6102016-02-13 22:59:48 -080090 float voltage_intake;
91 float voltage_shoulder;
92 float voltage_wrist;
Comran Morshedf4cd7642016-02-15 20:40:49 +000093
Campbell Crowleyd4fd6552016-02-21 17:53:46 -080094 float voltage_top_rollers;
95 float voltage_bottom_rollers;
Comran Morshed25f81a02016-01-23 13:40:10 +000096 };
97
98 queue Goal goal;
99 queue Position position;
Austin Schuh2fc10fa2016-02-08 00:44:34 -0800100 queue Output output;
Comran Morshed25f81a02016-01-23 13:40:10 +0000101 queue Status status;
102};
103
104queue_group SuperstructureQueue superstructure_queue;