imu_sensor.h 799 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "../common/comm.h"
  3. #include "../common/notifier.h"
  4. class CMessageQueue;
  5. class SocketCan;
  6. struct ImuData
  7. {
  8. /* FVector3<float> AngVel; // 3 floats, angular velocity vector
  9. FVector3<float> Rotation;
  10. FVector3<float> Accel;
  11. */
  12. float rx;
  13. float ry;
  14. // float rz;
  15. };
  16. class CImuSensor
  17. {
  18. public:
  19. CImuSensor(CMessageQueue* q);
  20. void Start();
  21. void Stop();
  22. void Notify(int8_t * buffer,int32_t size);
  23. void PreProcess();
  24. void SetSensorSocket(SensorSocket<CImuSensor>* can);
  25. private:
  26. void ImuProcess(const cannet_frame& frame);
  27. int32_t bcd2dec(const int8_t *data);
  28. private:
  29. CMessageQueue * _message;
  30. ImuData _imu;
  31. SensorSocket<CImuSensor>* _can;
  32. };