Data Logging Example Project¶
This ISLoggerExample project demonstrates data logging with the InertialSense products (IMX, uAHRS, and uIMU) using the Inertial Sense SDK.
Files¶
Project Files¶
SDK Files¶
Implementation¶
Step 1: Add Includes¶
// Change these include paths to the correct paths for your project
#include "../../src/InertialSense.h"
Step 2: Instantiate InertialSense class¶
// InertialSense class wraps communications and logging in a convenient, easy to use class
InertialSense inertialSense(dataCallback);
if (!inertialSense.Open(argv[1]))
{
std::cout << "Failed to open com port at " << argv[1] << std::endl;
}
Step 3: Enable data logger¶
// get log type from command line
cISLogger::sSaveOptions options;
options.logType = (argc < 3 ? cISLogger::LOGTYPE_DAT : cISLogger::ParseLogType(argv[2]));
inertialSense.EnableLogger(true, "", options);
Step 4: Enable data broadcasting¶
// broadcast the standard set of post processing messages (ins, imu, etc.)
inertialSense.BroadcastBinaryDataRmcPreset();
// instead of the rmc preset (real-time message controller) you can request individual messages...
// inertialSense.BroadcastBinaryData(DID_IMU, 6); // (startupNavDtMs default)
By default, data logs will be stored in the "IS_logs" directory in the current directory.
build/IS_logs/LOG_SN30664_20180323_112822_0001.dat
Compile & Run (Linux/Mac)¶
- Create build directory
cd InertialSenseSDK/ExampleProjects/Logger mkdir build
- Run cmake from within build directory
cd build cmake ..
- Compile using make
make
- If necessary, add current user to the "dialout" group in order to read and write to the USB serial communication ports:
sudo usermod -a -G dialout $USER sudo usermod -a -G plugdev $USER (reboot computer)
- Run executable
./ISLoggerExample /dev/ttyUSB0
Compile & Run (Windows Powershell)¶
*Note - Install CMake for Windows natively, or install the CMake for Windows extension for Visual Studio
- Create build directory
cd InertialSenseSDK/ExampleProjects/Logger mkdir build
- Run cmake from within build directory
cd build cmake ..
-
Compile using make
cmake --build .
-
Run executable
C:\InertialSenseSDK\ExampleProjects\Logger\build\Release\ISLoggerExample.exe COM3
Summary¶
This section has covered the basic functionality you need to set up and communicate with Inertial Sense products. If this doesn't cover everything you need, feel free to reach out to us on the Inertial Sense SDK GitHub repository, and we will be happy to help.