blob: 0de50c6118972e073817d6a066fa4334e4385bdf [file] [log] [blame]
Philipp Schraderbb7d58e2017-01-29 01:43:19 +00001package y2017.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 TurretQueue {
36 implements aos.control_loops.ControlLoop;
37
38 message Goal {
39 // An azimuth angle of zero means the turrent faces toward the front of the
40 // robot where the intake is located. The angle increases when the turret
41 // turns clockwise, and decreases when the turrent turns counter-clockwise.
42 // These are from a top view above the robot.
43 double angle_azimuth;
44
45 // TODO(phil): Define how we control the vertical angle of the turret: is
46 // it a distance or an angle, etc.
47 double angle_altitude;
48
49 // Caps on velocity/acceleration for profiling. 0 for the default.
50 .frc971.ProfileParameters profile_params_turret;
51 };
52
53 message Status {
54 // Is the turret zeroed?
55 bool zeroed;
56
57 // If true, we have aborted.
58 bool estopped;
59
60 // Estimate angles and angular velocities.
61 JointState azimuth;
62 JointState altitude;
63 };
64
65 message Position {
66 // The sensor readings for the azimuth. The units and sign are defined the
67 // same as what's in the Goal message.
68 .frc971.PotAndAbsolutePosition azimuth;
69
70 // TODO(phil): How are we measuring that other aspect of the turret (i.e.
71 // the "altitude") ?
72 };
73
74 message Output {
75 float voltage_azimuth;
76 float voltage_altitude;
77 };
78
79 queue Goal goal;
80 queue Position position;
81 queue Output output;
82 queue Status status;
83};
84
85queue_group TurretQueue turret_queue;