fwt_software/include/fgc/IImuSource.h

27 lines
663 B
C++

#pragma once
#include "fgc/MtiProtocol.h" // ImuSample
#include <optional>
namespace fgc {
// Abstraction over the orientation/inertial sensor (Xsens MTi). Implemented by
// MtiImuSource (RS-232/UART binary stream) and MockImuSource (synthetic). Runs
// on its own thread; start() must not block the control loop.
class IImuSource {
public:
virtual ~IImuSource() = default;
virtual void start() = 0;
virtual void stop() = 0;
// Whether a valid, recent reading is available.
virtual bool connected() const = 0;
// Latest reading, or nullopt if none/stale.
virtual std::optional<ImuSample> sample() = 0;
};
} // namespace fgc