#pragma once #include class RobotIMU { public: bool begin(); // returns false if the IMU didn't respond void update(float dt); // no-op if the IMU never came up float rollDeg() const { return roll_deg_; } float pitchDeg() const { return pitch_deg_; } bool ok() const { return ok_; } // Robot-gyro toggle from CmdPacket. The attitude is estimated either way // (the remote shows it); robot.ino only levels the body while it's set. bool enabled = true; private: float roll_deg_ = 0, pitch_deg_ = 0; bool ok_ = false; bool readRaw(float& ax, float& ay, float& az, float& gx, float& gy, float& gz); };