Robot-side firmware (Teensy 4.0) imported unchanged as extracted. platformio.ini defines [env:robot] (teensy40) and [env:remote] (teensy41); scripts/select_src_dir.py points each env at its own sketch folder so robot/ and remote/ stay Arduino-style sketches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
521 B
C++
19 lines
521 B
C++
#pragma once
|
|
#include <Arduino.h>
|
|
|
|
class RobotIMU {
|
|
public:
|
|
bool begin(); // returns false if the IMU didn't respond
|
|
void update(float dt); // no-op if disabled or the IMU never came up
|
|
float rollDeg() const { return roll_deg_; }
|
|
float pitchDeg() const { return pitch_deg_; }
|
|
|
|
bool enabled = true; // robot-gyro toggle from CmdPacket sets this
|
|
|
|
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);
|
|
};
|