📄 imu.h
字号:
/****************************************************************************** File Name: include/IMU.h Description: IMU data structure definition and its transformation******************************************************************************//****************************************************************************** Author: alfred.liushu@gmail.com Upadate: 2008/09/16 File founded Copyright 2008-2009 Robot Lab., Dept.of Automation, Tsinghua University******************************************************************************/#ifndef __IMU_H__#define __IMU_H__#include <math.h>#include "../include/Setting.h"/****************************** Data structures ***************************************************//*Raw data structure*/typedef struct{ DATATYPE acceleration; /*Accelerations in meters per square second*/ DATATYPE angularVelocity; /*Angular velocities in degrees per second, clockwise*/}IMURAW;/*Formatted data structure*/typedef struct{ DATATYPE acceleration; /*Accelerations in meters per square second*/ DATATYPE angularVelocity; /*Angular velocities in radians per second, anticlockwise*/}IMU;/****************************** Synchronition parameters ***************************************************/const TIME IMUPeriod = 10; /*IMU period time, measured in milliseconds*//****************************** Transformation constants ***************************************************/const DATATYPE AccelerationGain = DATATYPE(1); /*1*/const DATATYPE AngularGain = -Pi/180; /*Transform deg/s-clockwise to rad/s-anticlockwise*//****************************** Transformation function definitions ***************************************************/inline void IMURAW2IMU(const IMURAW& raw, IMU& imu); /*Transform raw data from IMU*/inline void IMU2IMURAW(const IMU& imu, IMURAW& raw); /*Transform IMU data to raw format*//****************************** Transformation function implementations ***************************************************/void IMURAW2IMU(const IMURAW& raw, IMU& imu){ imu.acceleration = raw.acceleration * AccelerationGain; imu.angularVelocity = raw.angularVelocity * AngularGain;}void IMU2IMURAW(const IMU& imu, IMURAW& raw){ raw.acceleration = imu.acceleration / AccelerationGain; raw.angularVelocity = imu.angularVelocity / AngularGain;}#endif /*__IMU_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -