blob: fc08df184cad7edf6dd296b47a9d36e69a1fea29 [file] [log] [blame]
James Kuszmaul630ab1d2024-01-09 16:38:57 -08001#include "aos/util/file.h"
2#include "y2023/constants.h"
3
4using namespace y2023::constants;
5
6// This file generates some JSON constants information that is currently
7// dependent on values that are located in C++ headers and would be
8// obnoxious/inappropriate to pull out.
9int main(int argc, char *argv[]) {
10 CHECK_EQ(argc, 2) << "Must supply file name to output to.";
11 std::string output_file = argv[1];
12
13 std::stringstream output;
14
15 output << "\"average_filter_size\": " << Values::kZeroingSampleSize << ",\n";
16 output << "\"one_revolution_distance\": "
17 << M_PI * 2.0 * Values::kCompWristEncoderRatio() << ",\n";
18 output << "\"zeroing_threshold\": 0.0005,\n";
19 output << "\"moving_buffer_size\": 20,\n";
20 output << "\"allowable_encoder_error\": 0.9,\n";
21 output << "\"middle_position\": " << Values::kCompWristRange().middle()
22 << "\n";
23 aos::util::WriteStringToFileOrDie(output_file, output.str());
24 return 0;
25}