WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
IMU.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include "hal/IMUTypes.h"
10
11/**
12 * @defgroup hal_imu IMU Functions
13 * @ingroup hal_capi
14 * @{
15 */
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/**
22 * Get the acceleration along the axes of the IMU in meters per second squared.
23 *
24 * @param[out] accel the acceleration data
25 * @param[out] status the error code, or 0 for success
26 */
27void HAL_GetIMUAcceleration(HAL_Acceleration3d* accel, int32_t* status);
28
29/**
30 * Get the angular rate about the axes of the IMU in radians per second.
31 *
32 * @param[out] rates the angular rate data
33 * @param[out] status the error code, or 0 for success
34 */
35void HAL_GetIMUGyroRates(HAL_GyroRate3d* rates, int32_t* status);
36
37/**
38 * Get the angle, in radians, about the axes of the IMU in the "flat"
39 * orientation.
40 *
41 * @param[out] angles the angle data
42 * @param[out] status the error code, or 0 for success
43 */
44void HAL_GetIMUEulerAnglesFlat(HAL_EulerAngles3d* angles, int32_t* status);
45
46/**
47 * Get the angle, in radians, about the axes of the IMU in the "landscape"
48 * orientation.
49 *
50 * @param[out] angles the angle data
51 * @param[out] status the error code, or 0 for success
52 */
54
55/**
56 * Get the angle, in radians, about the axes of the IMU in the "portrait"
57 * orientation.
58 *
59 * @param[out] angles the angle data
60 * @param[out] status the error code, or 0 for success
61 */
62void HAL_GetIMUEulerAnglesPortrait(HAL_EulerAngles3d* angles, int32_t* status);
63
64/**
65 * Get the orientation of the IMU as a quaternion.
66 *
67 * @param[out] quat the quaternion
68 * @param[out] status the error code, or 0 for success
69 */
70void HAL_GetIMUQuaternion(HAL_Quaternion* quat, int32_t* status);
71
72/**
73 * Get the yaw value, in radians, of the IMU in the "flat" orientation.
74 *
75 * @param[out] timestamp the timestamp of the sample
76 * @return flat orientation yaw
77 */
78double HAL_GetIMUYawFlat(int64_t* timestamp);
79
80/**
81 * Get the yaw value, in radians, of the IMU in the "landscape" orientation.
82 *
83 * @param[out] timestamp the timestamp of the sample
84 * @return landscape orientation yaw
85 */
86double HAL_GetIMUYawLandscape(int64_t* timestamp);
87
88/**
89 * Get the yaw value, in radians, of the IMU in the "portrait" orientation.
90 *
91 * @param[out] timestamp the timestamp of the sample
92 * @return portrait orientation yaw
93 */
94double HAL_GetIMUYawPortrait(int64_t* timestamp);
95#ifdef __cplusplus
96} // extern "C"
97#endif
98/** @} */
void HAL_GetIMUGyroRates(HAL_GyroRate3d *rates, int32_t *status)
Get the angular rate about the axes of the IMU in radians per second.
double HAL_GetIMUYawFlat(int64_t *timestamp)
Get the yaw value, in radians, of the IMU in the "flat" orientation.
void HAL_GetIMUEulerAnglesLandscape(HAL_EulerAngles3d *angles, int32_t *status)
Get the angle, in radians, about the axes of the IMU in the "landscape" orientation.
double HAL_GetIMUYawLandscape(int64_t *timestamp)
Get the yaw value, in radians, of the IMU in the "landscape" orientation.
void HAL_GetIMUAcceleration(HAL_Acceleration3d *accel, int32_t *status)
Get the acceleration along the axes of the IMU in meters per second squared.
double HAL_GetIMUYawPortrait(int64_t *timestamp)
Get the yaw value, in radians, of the IMU in the "portrait" orientation.
void HAL_GetIMUEulerAnglesFlat(HAL_EulerAngles3d *angles, int32_t *status)
Get the angle, in radians, about the axes of the IMU in the "flat" orientation.
void HAL_GetIMUQuaternion(HAL_Quaternion *quat, int32_t *status)
Get the orientation of the IMU as a quaternion.
void HAL_GetIMUEulerAnglesPortrait(HAL_EulerAngles3d *angles, int32_t *status)
Get the angle, in radians, about the axes of the IMU in the "portrait" orientation.
Definition IMUTypes.h:22
Definition IMUTypes.h:38
Definition IMUTypes.h:30
Definition IMUTypes.h:13