blob: db03741e4aa8782ff24ef7af14f961765af0812f [file] [log] [blame]
Brian Silvermanc71537c2016-01-01 13:43:14 -08001#include "aos/common/controls/replay_control_loop.h"
2#include "aos/linux_code/init.h"
3
4#include "y2012/control_loops/drivetrain/drivetrain.q.h"
5#include "frc971/queues/gyro.q.h"
6
7// Reads one or more log files and sends out all the queue messages (in the
8// correct order and at the correct time) to feed a "live" drivetrain process.
9
10int main(int argc, char **argv) {
11 if (argc <= 1) {
12 fprintf(stderr, "Need at least one file to replay!\n");
13 return EXIT_FAILURE;
14 }
15
16 ::aos::InitNRT();
17
18 {
19 ::aos::controls::ControlLoopReplayer<
20 ::y2012::control_loops::DrivetrainQueue>
21 replayer(&::y2012::control_loops::drivetrain_queue, "drivetrain");
22
23 replayer.AddDirectQueueSender("wpilib_interface.Gyro", "sending",
24 ::frc971::sensors::gyro_reading);
25 for (int i = 1; i < argc; ++i) {
26 replayer.ProcessFile(argv[i]);
27 }
28 }
29 ::frc971::sensors::gyro_reading.Clear();
30 ::y2012::control_loops::drivetrain_queue.goal.Clear();
31 ::y2012::control_loops::drivetrain_queue.status.Clear();
32 ::y2012::control_loops::drivetrain_queue.position.Clear();
33 ::y2012::control_loops::drivetrain_queue.output.Clear();
34
35 ::aos::Cleanup();
36}