58 [[noreturn]]
void runLoop();
61 std::unique_ptr<MotorService> motor_service_;
62 std::unique_ptr<NetworkService> network_service_;
63 std::unique_ptr<PowerService> power_service_;
66 std::unique_ptr<RedisClient> redis_client_;
76 void timespecNorm(
struct timespec &ts);
83 double getCpuTemperature();
89 double getMilliseconds(timespec time);
95 double getNanoseconds(timespec time);
100 void updateErrorCodes();
109 TbotsProto::MotorStatus pollMotorService(
110 struct timespec &poll_time,
const TbotsProto::MotorControl &motor_control,
111 const struct timespec &time_since_prev_iteration);
120 TbotsProto::PowerStatus pollPowerService(
struct timespec &poll_time);
125 void waitForNetworkUp();
129 TbotsProto::World world_;
130 TbotsProto::Primitive primitive_;
131 TbotsProto::DirectControlPrimitive direct_control_;
134 TbotsProto::RobotStatus robot_status_;
135 TbotsProto::JetsonStatus jetson_status_;
136 TbotsProto::NetworkStatus network_status_;
137 TbotsProto::PowerStatus power_status_;
138 std::optional<TbotsProto::MotorStatus> motor_status_;
139 TbotsProto::ThunderloopStatus thunderloop_status_;
140 TbotsProto::ChipperKickerStatus chipper_kicker_status_;
141 TbotsProto::PrimitiveExecutorStatus primitive_executor_status_;
142 TbotsProto::Timestamp time_sent_;
146 Angle current_orientation_;
149 std::string network_interface_;
155 int chip_pulse_width_;
161 const double PACKET_TIMEOUT_NS = 500.0 * NANOSECONDS_PER_MILLISECOND;
164 const int PING_RETRY_DELAY_S = 1;
166 const std::string PATH_TO_RINGBUFFER_LOG =
"/var/log/dmesg";
168 std::ifstream log_file = std::ifstream(PATH_TO_RINGBUFFER_LOG);