Merge all queues into one superstructure queue
Change-Id: I41c6b67160a53a7c0412e5a4cd3517b7c17dd44d
diff --git a/y2017/control_loops/intake/intake.q b/y2017/control_loops/intake/intake.q
deleted file mode 100644
index a8900b9..0000000
--- a/y2017/control_loops/intake/intake.q
+++ /dev/null
@@ -1,81 +0,0 @@
-package y2017.control_loops;
-
-import "aos/common/controls/control_loops.q";
-import "frc971/control_loops/control_loops.q";
-
-struct JointState {
- // Distance of the joint, in m, from absolute zero.
- float distance;
- // Linear velocity of the joint in meters/second.
- float linear_velocity;
- // Profiled goal distance of the joint in meters.
- float goal_distance;
- // Profiled goal linear velocity of the joint in meters/second.
- float goal_linear_velocity;
- // Unprofiled goal distance from absoulte zero of the joint in meters.
- float unprofiled_goal_distance;
- // Unprofiled goal linear velocity of the joint in meters/second.
- float unprofiled_goal_linear_velocity;
-
- // The estimated voltage error.
- float voltage_error;
-
- // The calculated velocity with delta x/delta t
- float calculated_velocity;
-
- // Components of the control loop output
- float position_power;
- float velocity_power;
- float feedforwards_power;
-
- // State of the estimator.
- .frc971.EstimatorState estimator_state;
-};
-
-queue_group IntakeQueue {
- implements aos.control_loops.ControlLoop;
-
- message Goal {
- // Zero on the intake is when the intake is retracted inside the robot,
- // unable to intake. Positive is out.
-
- // Goal distance of the intake.
- double distance_intake;
-
- // Caps on velocity/acceleration for profiling. 0 for the default.
- .frc971.ProfileParameters profile_params_intake;
-
- // Voltage to send to the rollers. Positive is sucking in.
- float voltage_rollers;
- };
-
- message Status {
- // Is the intake zeroed?
- bool zeroed;
-
- // If true, we have aborted.
- bool estopped;
-
- // Estimate angles and angular velocities.
- JointState intake;
- };
-
- message Position {
- // Position of the intake, zero when the intake is in, positive when it is
- // out.
- .frc971.PotAndAbsolutePosition intake;
- };
-
- message Output {
- float voltage_intake;
-
- float voltage_rollers;
- };
-
- queue Goal goal;
- queue Position position;
- queue Output output;
- queue Status status;
-};
-
-queue_group IntakeQueue intake_queue;
diff --git a/y2017/control_loops/serializer/BUILD b/y2017/control_loops/serializer/BUILD
deleted file mode 100644
index 5960fdd..0000000
--- a/y2017/control_loops/serializer/BUILD
+++ /dev/null
@@ -1,13 +0,0 @@
-load('/aos/build/queues', 'queue_library')
-
-queue_library(
- name = 'serializer_queue',
- srcs = [
- 'serializer.q',
- ],
- deps = [
- '//aos/common/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
- visibility = ['//visibility:public'],
-)
diff --git a/y2017/control_loops/serializer/serializer.q b/y2017/control_loops/serializer/serializer.q
deleted file mode 100644
index 7e3620a..0000000
--- a/y2017/control_loops/serializer/serializer.q
+++ /dev/null
@@ -1,46 +0,0 @@
-package y2017.control_loops.serializer;
-
-import "aos/common/controls/control_loops.q";
-import "frc971/control_loops/control_loops.q";
-
-queue_group SerializerQueue {
- implements aos.control_loops.ControlLoop;
-
- // All angles are in radians, and angular velocities are in radians/second.
- // For all angular velocities, positive is moving balls up towards the
- // shooter.
-
- message Goal {
- // Angular velocity goals in radians/second.
- double angular_velocity;
- };
-
- message Position {
- // Serializer angle in radians.
- double theta;
- };
-
- message Status {
- // The current average velocity in radians/second.
- double avg_angular_velocity;
-
- // The current instantaneous filtered velocity in radians/second.
- double angular_velocity;
-
- // True if the shooter is ready. It is better to compare the velocities
- // directly so there isn't confusion on if the goal is up to date.
- bool ready;
- };
-
- message Output {
- // Voltage in volts of the shooter motor.
- double voltage;
- };
-
- queue Goal goal;
- queue Position position;
- queue Output output;
- queue Status status;
-};
-
-queue_group SerializerQueue shooter_queue;
diff --git a/y2017/control_loops/shooter/BUILD b/y2017/control_loops/shooter/BUILD
deleted file mode 100644
index a5c853e..0000000
--- a/y2017/control_loops/shooter/BUILD
+++ /dev/null
@@ -1,13 +0,0 @@
-load('/aos/build/queues', 'queue_library')
-
-queue_library(
- name = 'shooter_queue',
- srcs = [
- 'shooter.q',
- ],
- deps = [
- '//aos/common/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
- visibility = ['//visibility:public'],
-)
diff --git a/y2017/control_loops/shooter/shooter.q b/y2017/control_loops/shooter/shooter.q
deleted file mode 100644
index 768541d..0000000
--- a/y2017/control_loops/shooter/shooter.q
+++ /dev/null
@@ -1,45 +0,0 @@
-package y2017.control_loops.shooter;
-
-import "aos/common/controls/control_loops.q";
-import "frc971/control_loops/control_loops.q";
-
-queue_group ShooterQueue {
- implements aos.control_loops.ControlLoop;
-
- // All angles are in radians, and angular velocities are in radians/second.
- // For all angular velocities, positive is shooting the ball out of the robot.
-
- message Goal {
- // Angular velocity goals in radians/second.
- double angular_velocity;
- };
-
- message Position {
- // Wheel angle in radians.
- double theta;
- };
-
- message Status {
- // The current average velocity in radians/second.
- double avg_angular_velocity;
-
- // The current instantaneous filtered velocity in radians/second.
- double angular_velocity;
-
- // True if the shooter is ready. It is better to compare the velocities
- // directly so there isn't confusion on if the goal is up to date.
- bool ready;
- };
-
- message Output {
- // Voltage in volts of the shooter motor.
- double voltage;
- };
-
- queue Goal goal;
- queue Position position;
- queue Output output;
- queue Status status;
-};
-
-queue_group ShooterQueue shooter_queue;
diff --git a/y2017/control_loops/intake/BUILD b/y2017/control_loops/superstructure/BUILD
similarity index 80%
rename from y2017/control_loops/intake/BUILD
rename to y2017/control_loops/superstructure/BUILD
index b98cadd..61fb001 100644
--- a/y2017/control_loops/intake/BUILD
+++ b/y2017/control_loops/superstructure/BUILD
@@ -3,9 +3,9 @@
load('/aos/build/queues', 'queue_library')
queue_library(
- name = 'intake_queue',
+ name = 'superstructure_queue',
srcs = [
- 'intake.q',
+ 'superstructure.q',
],
deps = [
'//aos/common/controls:control_loop_queues',
diff --git a/y2017/control_loops/superstructure/superstructure.q b/y2017/control_loops/superstructure/superstructure.q
new file mode 100644
index 0000000..a3b2715
--- /dev/null
+++ b/y2017/control_loops/superstructure/superstructure.q
@@ -0,0 +1,207 @@
+package y2017.control_loops;
+
+import "aos/common/controls/control_loops.q";
+import "frc971/control_loops/control_loops.q";
+
+struct JointState {
+ // Position of the joint.
+ float position;
+ // Velocity of the joint in units/second.
+ float velocity;
+ // Profiled goal position of the joint.
+ float goal_position;
+ // Profiled goal velocity of the joint in units/second.
+ float goal_velocity;
+ // Unprofiled goal position from absoulte zero of the joint.
+ float unprofiled_goal_position;
+ // Unprofiled goal velocity of the joint in units/second.
+ float unprofiled_goal_velocity;
+
+ // The estimated voltage error.
+ float voltage_error;
+
+ // The calculated velocity with delta x/delta t
+ float calculated_velocity;
+
+ // Components of the control loop output
+ float position_power;
+ float velocity_power;
+ float feedforwards_power;
+
+ // State of the estimator.
+ .frc971.EstimatorState estimator_state;
+};
+
+struct IntakeGoal {
+ // Zero on the intake is when the intake is retracted inside the robot,
+ // unable to intake. Positive is out.
+
+ // Goal distance of the intake.
+ double distance;
+
+ // Caps on velocity/acceleration for profiling. 0 for the default.
+ .frc971.ProfileParameters profile_params;
+
+ // Voltage to send to the rollers. Positive is sucking in.
+ float voltage_rollers;
+};
+
+struct SerializerGoal {
+ // Serializer angular velocity goals in radians/second.
+ double angular_velocity;
+};
+
+struct TurretGoal {
+ // An azimuth angle of zero means the turrent faces toward the front of the
+ // robot where the intake is located. The angle increases when the turret
+ // turns clockwise, and decreases when the turrent turns counter-clockwise.
+ // These are from a top view above the robot.
+ double angle_azimuth;
+
+ // Caps on velocity/acceleration for profiling. 0 for the default.
+ .frc971.ProfileParameters profile_params;
+};
+
+struct HoodGoal {
+ // Angle the hood is currently at
+ double angle_hood;
+
+ // Caps on velocity/acceleration for profiling. 0 for the default.
+ .frc971.ProfileParameters profile_params;
+};
+
+struct ShooterGoal {
+ // Angular velocity goals in radians/second.
+ double angular_velocity;
+};
+
+struct IntakeStatus {
+ // Is it zeroed?
+ bool zeroed;
+
+ // Estimated position and velocities.
+ JointState joint_state;
+
+ // If true, we have aborted.
+ bool estopped;
+};
+
+struct SerializerStatus {
+ // The current average velocity in radians/second.
+ double avg_angular_velocity;
+
+ // The current instantaneous filtered velocity in radians/second.
+ double angular_velocity;
+
+ // True if the serializer is ready. It is better to compare the velocities
+ // directly so there isn't confusion on if the goal is up to date.
+ bool ready;
+
+ // If true, we have aborted.
+ bool estopped;
+};
+
+struct TurretStatus {
+ // Is the turret zeroed?
+ bool zeroed;
+
+ // If true, we have aborted.
+ bool estopped;
+
+ // Estimate angles and angular velocities.
+ JointState azimuth;
+};
+
+struct HoodStatus {
+ // Is the turret zeroed?
+ bool zeroed;
+
+ // If true, we have aborted.
+ bool estopped;
+
+ // Estimate angles and angular velocities.
+ JointState hood;
+};
+
+struct ShooterStatus {
+ // The current average velocity in radians/second.
+ double avg_angular_velocity;
+
+ // The current instantaneous filtered velocity in radians/second.
+ double angular_velocity;
+
+ // True if the shooter is ready. It is better to compare the velocities
+ // directly so there isn't confusion on if the goal is up to date.
+ bool ready;
+
+ // If true, we have aborted.
+ bool estopped;
+};
+
+queue_group SuperstructureQueue {
+ implements aos.control_loops.ControlLoop;
+
+ message Goal {
+ IntakeGoal intake;
+ SerializerGoal serializer;
+ TurretGoal turret;
+ HoodGoal hood;
+ ShooterGoal shooter;
+ };
+
+ message Status {
+ // Are all the subsystems zeroed?
+ bool zeroed;
+
+ // If true, we have aborted. This is the or of all subsystem estops.
+ bool estopped;
+
+ // Each subsystems status.
+ IntakeStatus intake;
+ SerializerStatus serializer;
+ TurretStatus turret;
+ HoodStatus hood;
+ ShooterStatus shooter;
+ };
+
+ message Position {
+ // Position of the intake, zero when the intake is in, positive when it is
+ // out.
+ .frc971.PotAndAbsolutePosition intake;
+
+ // Serializer angle in radians.
+ double theta_serializer;
+
+ // The sensor readings for the azimuth. The units and sign are defined the
+ // same as what's in the Goal message.
+ .frc971.PotAndAbsolutePosition azimuth_turret;
+
+ // Position of the hood in radians
+ double theta_hood;
+
+ // Shooter wheel angle in radians.
+ double theta_shooter;
+ };
+
+ message Output {
+ // Voltages for some of the subsystems.
+ float voltage_intake;
+ float voltage_serializer;
+ float voltage_shooter;
+
+ // Rollers on the intake.
+ float voltage_intake_rollers;
+ // Roller on the serializer
+ float voltage_serializer_rollers;
+
+ float voltage_azimuth_turret;
+ float voltage_hood;
+ };
+
+ queue Goal goal;
+ queue Position position;
+ queue Output output;
+ queue Status status;
+};
+
+queue_group SuperstructureQueue superstructure_queue;
diff --git a/y2017/control_loops/turret/BUILD b/y2017/control_loops/turret/BUILD
deleted file mode 100644
index 9f36909..0000000
--- a/y2017/control_loops/turret/BUILD
+++ /dev/null
@@ -1,13 +0,0 @@
-load('/aos/build/queues', 'queue_library')
-
-queue_library(
- name = 'turret_queue',
- srcs = [
- 'turret.q',
- ],
- deps = [
- '//aos/common/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
- visibility = ['//visibility:public'],
-)
diff --git a/y2017/control_loops/turret/turret.q b/y2017/control_loops/turret/turret.q
deleted file mode 100644
index 0de50c6..0000000
--- a/y2017/control_loops/turret/turret.q
+++ /dev/null
@@ -1,85 +0,0 @@
-package y2017.control_loops;
-
-import "aos/common/controls/control_loops.q";
-import "frc971/control_loops/control_loops.q";
-
-struct JointState {
- // Angle of the joint in radians.
- float angle;
- // Angular velocity of the joint in radians/second.
- float angular_velocity;
- // Profiled goal angle of the joint in radians.
- float goal_angle;
- // Profiled goal angular velocity of the joint in radians/second.
- float goal_angular_velocity;
- // Unprofiled goal angle of the joint in radians.
- float unprofiled_goal_angle;
- // Unprofiled goal angular velocity of the joint in radians/second.
- float unprofiled_goal_angular_velocity;
-
- // The estimated voltage error.
- float voltage_error;
-
- // The calculated velocity with delta x/delta t
- float calculated_velocity;
-
- // Components of the control loop output
- float position_power;
- float velocity_power;
- float feedforwards_power;
-
- // State of the estimator.
- .frc971.EstimatorState estimator_state;
-};
-
-queue_group TurretQueue {
- implements aos.control_loops.ControlLoop;
-
- message Goal {
- // An azimuth angle of zero means the turrent faces toward the front of the
- // robot where the intake is located. The angle increases when the turret
- // turns clockwise, and decreases when the turrent turns counter-clockwise.
- // These are from a top view above the robot.
- double angle_azimuth;
-
- // TODO(phil): Define how we control the vertical angle of the turret: is
- // it a distance or an angle, etc.
- double angle_altitude;
-
- // Caps on velocity/acceleration for profiling. 0 for the default.
- .frc971.ProfileParameters profile_params_turret;
- };
-
- message Status {
- // Is the turret zeroed?
- bool zeroed;
-
- // If true, we have aborted.
- bool estopped;
-
- // Estimate angles and angular velocities.
- JointState azimuth;
- JointState altitude;
- };
-
- message Position {
- // The sensor readings for the azimuth. The units and sign are defined the
- // same as what's in the Goal message.
- .frc971.PotAndAbsolutePosition azimuth;
-
- // TODO(phil): How are we measuring that other aspect of the turret (i.e.
- // the "altitude") ?
- };
-
- message Output {
- float voltage_azimuth;
- float voltage_altitude;
- };
-
- queue Goal goal;
- queue Position position;
- queue Output output;
- queue Status status;
-};
-
-queue_group TurretQueue turret_queue;