#pragma once #include "fgc/IMotorController.h" #include "fgc/Logger.h" #include #include namespace fgc { // Simulated motor controller for development without hardware. Pretends the // gimbal is continuously sweeping: heading advances on each telemetry read and // is_moving stays 1 so the capture cycle fires. "kd" sets the target. class MockMotorController : public IMotorController { public: void start() override { LOG_INFO << "[mock] motor controller started"; } void stop() override { LOG_INFO << "[mock] motor controller stopped"; } void sendCommand(const std::string& cmd) override { LOG_DEBUG << "[mock] motor cmd: " << cmd; std::lock_guard lock(mutex_); if (cmd.rfind("kd", 0) == 0) { try { tel_.heading = std::stof(cmd.substr(2)); } catch (const std::exception&) {} } } MotorTelemetry telemetry() override { std::lock_guard lock(mutex_); tel_.heading += 6.0f; // simulate a sweep step if (tel_.heading >= 360.f) tel_.heading -= 360.f; tel_.is_moving = 1; tel_.temperature = 20; tel_.humidity = 50; tel_.fan_pwm = 0; return tel_; } bool connected() const override { return true; } private: std::mutex mutex_; MotorTelemetry tel_; }; } // namespace fgc