IMU Interface library to use MecanumController library

Files at this revision

API Documentation at this revision

Comitter:
sgrsn
Date:
Mon Aug 23 17:01:48 2021 +0000
Commit message:
one

Changed in this revision

imu_interface.hpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imu_interface.hpp	Mon Aug 23 17:01:48 2021 +0000
@@ -0,0 +1,32 @@
+#ifndef IMU_INTERFACE_HPP
+#define IMU_INTERFACE_HPP
+
+#include "PMSU_100.hpp"
+
+class IMUInterface
+{
+    public:
+    IMUInterface()
+    {
+    }
+    virtual double GetYawRadians();
+};
+
+class PMSUInterface : public IMUInterface
+{
+    public:
+    PMSUInterface(PinName tx, PinName rx) : IMUInterface(), device_(tx, rx)
+    {
+    }
+    double GetYawRadians()
+    {
+        device_.update();
+        return device_.yaw_rad;
+    }
+    
+    private:
+    PMSUSerial device_;
+};
+
+
+#endif
\ No newline at end of file