blob: 2f63c9eef6fcdf3f98070dc72d7c384c486c2cf5 [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001#include "aos/controls/replay_control_loop.h"
John Park398c74a2018-10-20 21:17:39 -07002#include "aos/init.h"
Brian Silverman17f503e2015-08-02 18:17:18 -07003
Comran Morshed5323ecb2015-12-26 20:50:55 +00004#include "frc971/control_loops/drivetrain/drivetrain.q.h"
Austin Schuhd0e02df2015-11-26 12:48:51 -08005#include "frc971/queues/gyro.q.h"
Brian Silverman17f503e2015-08-02 18:17:18 -07006
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
Austin Schuhbd0a40f2019-06-30 14:56:31 -070018 ::frc971::control_loops::DrivetrainQueue drivetrain_queue(
19 ".frc971.control_loops.drivetrain_queue",
20 ".frc971.control_loops.drivetrain_queue.goal",
21 ".frc971.control_loops.drivetrain_queue.position",
22 ".frc971.control_loops.drivetrain_queue.output",
23 ".frc971.control_loops.drivetrain_queue.status");
24
Austin Schuh478dd4b2015-12-27 14:09:12 -080025 {
26 ::aos::controls::ControlLoopReplayer<
Comran Morshed5323ecb2015-12-26 20:50:55 +000027 ::frc971::control_loops::DrivetrainQueue>
Austin Schuhbd0a40f2019-06-30 14:56:31 -070028 replayer(&drivetrain_queue, "drivetrain");
Austin Schuhd0e02df2015-11-26 12:48:51 -080029
Austin Schuhdf6cbb12019-02-02 13:46:52 -080030 replayer.AddDirectQueueSender<::frc971::sensors::GyroReading>(
31 "wpilib_interface.Gyro", "sending", ".frc971.sensors.gyro_reading");
Austin Schuh478dd4b2015-12-27 14:09:12 -080032 for (int i = 1; i < argc; ++i) {
33 replayer.ProcessFile(argv[i]);
34 }
Brian Silverman17f503e2015-08-02 18:17:18 -070035 }
Brian Silverman17f503e2015-08-02 18:17:18 -070036
37 ::aos::Cleanup();
38}