Files
hexapod-robot/2026-current/sim/robot_ino.cpp
T

22 lines
1.2 KiB
C++
Raw Normal View History

// Compiles robot/robot.ino unchanged as part of the simulation, then exposes
// read-only views of its globals so the simulation can report robot state
// without the robot code having to know it's being simulated.
#include "../robot/robot.ino"
#include "SimRobotAccess.h"
namespace simrobot {
void setupOnce() { setup(); }
void loopOnce() { loop(); }
int state() { return (int)state_machine.state(); }
float sitStandBlend() { return state_machine.sitStandBlend(); }
bool linkOk() { return comms.linkOk(); }
float headingDeg() { return current_heading_deg; }
float imuRollDeg() { return imu.rollDeg(); }
float imuPitchDeg() { return imu.pitchDeg(); }
bool imuEnabled() { return imu.enabled; }
uint32_t lastLoopMicros() { return last_loop_us; }
bool legInStance(int leg) { return gait.legInStance(leg); }
float poseReachScale() { return pose.reachScale(); }
float twistScale() { return gait.twistScale(); }
float stanceHeightMm() { return Kinematics::stanceHeight(); }
} // namespace simrobot