SPIKE-RT C API Reference [Japanese]
An RTOS-based software platform for LEGO® Education SPIKE™.
読み取り中…
検索中…
一致する文字列を見つけられません
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 {
19class IMU
20{
21public:
22
24 struct Acceleration {
25 float x;
26 float y;
27 float z;
28 };
29
32 float x;
33 float y;
34 float z;
35 };
36
37
41 IMU(void) {
42 // このinitは2回目以降エラーとなるが、値を取る上では問題ないためそのままとする
44 }
45
50 void getAcceleration(Acceleration &accel);
51
56 void getAngularVelocity(AngularVelocity &ang);
57
62 float getTemperature() const {
64 }
65
70 bool isReady() const {
71 return hub_imu_is_ready();
72 }
73
78 bool isStationary() const {
79 return hub_imu_is_stationary();
80 }
81
86 void setTilt(float angle) {
87 hub_imu_set_tilt(angle);
88 }
89
94 float getHeading() const {
95 return hub_imu_get_heading();
96 }
97
103 }
104
109 bool hasError() { return false; }
110
111
112}; // class IMU
113} // namespace spikeapi
114
115#endif // !SPIKE_CPP_API_IMU_H_
Definition IMU.h:20
bool isStationary() const
Definition IMU.h:78
void setTilt(float angle)
Definition IMU.h:86
void getAngularVelocity(AngularVelocity &ang)
Definition IMU.cpp:25
bool isReady() const
Definition IMU.h:70
float getTemperature() const
Definition IMU.h:62
bool hasError()
Definition IMU.h:109
float getHeading() const
Definition IMU.h:94
IMU(void)
Definition IMU.h:41
void resetHeading()
Definition IMU.h:101
void getAcceleration(Acceleration &accel)
Definition IMU.cpp:16
pbio_error_t hub_imu_init(void)
IMUドライバを初期化する.
Definition imu.c:32
bool hub_imu_is_ready(void)
IMUモジュールが使用可能かチェックする.
Definition imu.c:70
bool hub_imu_is_stationary(void)
IMUモジュールが静止状態がチェックする.
Definition imu.c:74
void hub_imu_reset_heading(void)
IMUの方位角をリセットする.
Definition imu.c:103
float hub_imu_get_heading(void)
IMUの方位角を返す.
Definition imu.c:99
void hub_imu_set_tilt(float angle)
IMUモジュールの傾斜角度をセットする.
Definition imu.c:78
float hub_imu_get_temperature(void)
IMUから温度を取得する.
Definition imu.c:95
API for the hub built-in IMU.
Definition IMU.h:24