SPIKE-RT C++ API Reference
Loading...
Searching...
No Matches
IMU.h
1//
2// IMU.h
3//
4// Copyright (c) 2025 Embedded Technology Software Design Robot Contest
5//
6
7#ifndef SPIKE_CPP_API_IMU_H_
8#define SPIKE_CPP_API_IMU_H_
9
10extern "C" {
11#include <spike/hub/imu.h>
12}
13
14namespace spikeapi {
18class IMU
19{
20public:
21
22 /* 加速度 mm/s^2*/
23 struct Acceleration {
24 float x;
25 float y;
26 float z;
27 };
28
29 /* 角速度 degree/s */
31 float x;
32 float y;
33 float z;
34 };
35
36
42 IMU(void) {
43 // このinitは2回目以降エラーとなるが、値を取る上では問題ないためそのままとする
44 hub_imu_init();
45 }
46
52 void getAcceleration(Acceleration &accel);
53
59 void getAngularVelocity(AngularVelocity &ang);
60
66 float getTemperature() const {
67 return hub_imu_get_temperature();
68 }
69
74 bool hasError() { return false; }
75
76
77}; // class IMU
78} // namespace spikeapi
79
80#endif // !SPIKE_CPP_API_IMU_H_
void getAngularVelocity(AngularVelocity &ang)
Definition IMU.cpp:25
float getTemperature() const
Definition IMU.h:66
bool hasError()
Definition IMU.h:74
IMU(void)
Definition IMU.h:42
void getAcceleration(Acceleration &accel)
Definition IMU.cpp:16
Definition IMU.h:23