update the information about enabled vs not
With the roboRIO, we get different information about whether motors are
enabled (and some about sensors too), so the system for propagating it
around to everything needs to change.
Change-Id: I7e5f9591eeac1fdfe57b271333c3827431fbef01
diff --git a/aos/common/messages/robot_state.q b/aos/common/messages/robot_state.q
index bd66e1d..74fe5d0 100644
--- a/aos/common/messages/robot_state.q
+++ b/aos/common/messages/robot_state.q
@@ -8,7 +8,7 @@
double[4] axis;
};
-message RobotState {
+message JoystickState {
Joystick[4] joysticks;
bool test_mode;
@@ -16,17 +16,49 @@
bool enabled;
bool autonomous;
uint16_t team_id;
+
// If this is true, then this message isn't actually from the control
// system and so should not be trusted as evidence that the button inputs
// etc are actually real and should be acted on.
// However, most things should ignore this so that sending fake messages is
- // useful for testing.
+ // useful for testing. The only difference in behavior should be motors not
+ // actually turning on.
bool fake;
};
-// The robot_state Queue is checked by all control loops to make sure that the
+// This queue is checked by all control loops to make sure that the
// joystick code hasn't died.
-// It also provides information about whether or not the robot is in autonomous
-// mode and what the team_id is.
+queue JoystickState joystick_state;
+message RobotState {
+ // The PID of the process reading sensors.
+ // This is here so control loops can tell when it changes.
+ int32_t reader_pid;
+
+ // True when outputs are enabled.
+ // Motor controllers keep going for a bit after this goes to false.
+ bool outputs_enabled;
+ // Indicates whether something is browned out (I think motor controller
+ // outputs). IMPORTANT: This is NOT !outputs_enabled. outputs_enabled goes to
+ // false for other reasons too (disabled, e-stopped, maybe more).
+ bool browned_out;
+
+ // Whether the two sensor rails are currently working.
+ bool is_3v3_active;
+ bool is_5v_active;
+ // The current voltages measured on the two sensor rails.
+ double voltage_3v3;
+ double voltage_5v;
+
+ // The input voltage to the roboRIO.
+ double voltage_roborio_in;
+
+ // From the DriverStation object, aka what FMS sees and what shows up on the
+ // actual driver's station.
+ double voltage_battery;
+};
+
+// Messages are sent out on this queue along with reading sensors. It contains
+// global robot state and information about whether the process reading sensors
+// has been restarted, along with all counters etc it keeps track of.
queue RobotState robot_state;