converted sensor_receiver to using structs to log
diff --git a/frc971/input/input.gyp b/frc971/input/input.gyp
index 0fef215..e87063b 100644
--- a/frc971/input/input.gyp
+++ b/frc971/input/input.gyp
@@ -31,6 +31,7 @@
'<(DEPTH)/frc971/frc971.gyp:constants',
'<(DEPTH)/bbb_cape/src/bbb/bbb.gyp:sensor_reader',
'<(AOS)/common/common.gyp:time',
+ '<(AOS)/common/logging/logging.gyp:queue_logging',
],
},
],
diff --git a/frc971/input/sensor_receiver.cc b/frc971/input/sensor_receiver.cc
index 80c1c9f..2d7af87 100644
--- a/frc971/input/sensor_receiver.cc
+++ b/frc971/input/sensor_receiver.cc
@@ -4,12 +4,14 @@
#include "aos/common/logging/logging.h"
#include "aos/common/util/wrapping_counter.h"
#include "aos/common/time.h"
+#include "aos/common/logging/queue_logging.h"
#include "bbb/sensor_reader.h"
#include "frc971/control_loops/drivetrain/drivetrain.q.h"
#include "frc971/queues/gyro_angle.q.h"
#include "frc971/constants.h"
+#include "frc971/queues/to_log.q.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -55,8 +57,9 @@
void PacketReceived(const ::bbb::DataStruct *data,
const ::aos::time::Time &cape_timestamp) {
- LOG(DEBUG, "cape timestamp %010" PRId32 ".%09" PRId32 "s\n",
- cape_timestamp.sec(), cape_timestamp.nsec());
+ ::frc971::logging_structs::CapeReading reading_to_log(cape_timestamp.sec(),
+ cape_timestamp.nsec());
+ LOG_STRUCT(DEBUG, "cape reading", reading_to_log);
bool bad_gyro;
if (data->uninitialized_gyro) {
LOG(DEBUG, "uninitialized gyro\n");
diff --git a/frc971/queues/queues.gyp b/frc971/queues/queues.gyp
index 277c91c..13393a6 100644
--- a/frc971/queues/queues.gyp
+++ b/frc971/queues/queues.gyp
@@ -4,6 +4,7 @@
'gyro_angle.q',
'photo_sensor.q',
'piston.q',
+ 'to_log.q',
]
},
'targets': [
diff --git a/frc971/queues/to_log.q b/frc971/queues/to_log.q
new file mode 100644
index 0000000..c3cc076
--- /dev/null
+++ b/frc971/queues/to_log.q
@@ -0,0 +1,6 @@
+package frc971.logging_structs;
+
+struct CapeReading {
+ uint32_t sec;
+ uint32_t nsec;
+};