58 #include "rnr/rnrconfig.h" 78 static const char *SubSysName =
"IMU";
79 static const char *ProdName =
"CleanFlight Naze32";
86 printSubHdr(
"Initialize IMU");
90 if( imu.
open(LaeDevIMU, LaeBaudRateIMU) == LAE_OK )
101 printTestResult(sTag,
"Open IMU serial device %s.", LaeDevIMU);
113 printSubHdr(
"Read IMU Information and Configuration");
128 printTestResult(sTag,
"Read IMU identity.", LaeDevIMU);
142 printTestResult(sTag,
"Read raw IMU data");
145 printf(
" %s\n", strIdent.c_str());
162 showLabel = cnt == 0;
172 printf(
"%7s %34s | %34s | %34s\n",
175 " accel[x,y,z] (meters/s^2) ",
176 " gyro[x,y,z] (radians/s) ",
177 " rpy[roll,pitch,yaw] (radians) ");
181 "%10.4lf, %10.4lf, %10.4lf | " 182 "%10.4lf, %10.4lf, %10.4lf | " 183 "%10.4lf, %10.4lf, %10.4lf\r",
185 accel[X], accel[Y], accel[Z],
186 gyro[X], gyro[Y], gyro[Z],
187 rpy[ROLL], rpy[PITCH], rpy[YAW]);
194 DiagStats runImuDiagnostics(
bool bAnyKey)
202 printHdr(
"Inertia Measurement Unit Diagnostics");
207 statsTest = initImu(imu);
209 printSubTotals(statsTest);
211 statsTotal += statsTest;
216 if( !statsTotal.fatal )
218 statsTest = readInfo(imu);
220 printSubTotals(statsTest);
222 statsTotal += statsTest;
229 bQuit = statsTotal.fatal;
232 printSubHdr(
"Read IMU Sensor Data");
238 statsTest += readImu(imu, cnt++);
240 if( !bAnyKey || kbhit() || statsTest.fatal )
243 printSubTotals(statsTest);
252 statsTotal += statsTest;
257 printTotals(statsTotal);
virtual int open(const std::string &strDevName, int nBaudRate)
virtual int readRawImu()
Read sensor and board raw IMU values.
Multiwii Serial Protocal Interface.
virtual void getImuData(double accel[], double gyro[], double mag[], double rpy[], Quaternion &q)
Get the last sensed, converted, and computed IMU data.
void zero()
Zero statistics.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Simple diagnostics statistics class.
const int NumOfAxes
maximum number of axes per sensor component.
Laelaps common utilities.
Laelaps built-in Inertial Measurement Unit class interface.
std::string getIdentity()
Get IMU identity.
virtual void exec()
Exectute one step to read, convert, and compute IMU values.
virtual int readIdentity(std::string &strIdent)
Read sensor identity values.
Top-level package include file.