IMU C++

Namespaces

 dpyImu
 Deepsy Imu namespace that includes the different enums, structs or method signatures that should be used.
 

Classes

class  Imu
 Class which interfaces with the API logic. More...
 

Detailed Description

IMU API related documentation

Here it will give a quick overview of basic IMU capabilities. If you find IMU API useful and would like to know more details, please check out further sections of the IMU documentation or contact the Deepsy platform team.

Examples

Creating a class object:

Imu imu(ip_address);


Specific IMU examples

To get the priodic inertial values: It is received the priodic inertial values.

#include <dpy/imuApi.h>
void request_info(int error_code, dpyImu::info_imu_struct& info_struct)
{
std::cout << "\nIMU information at: "<< info_struct.timestamp << " (YYYYMMDD T HHMMSS.SSSSSS)" << std::endl;
std::cout << "\nacc_x: "<< std::setprecision(9) << ((double) info_struct.acc_x/1000000) << "(g)" << std::endl;
std::cout << "\nError code [" << error_code << "]" << std::endl;
}
int main()
{
Imu imu("127.0.0.1");
imu.getInertialValues_S(request_info);
return 0;
}


To get a configuration property value:

#include <dpy/imuApi.h>
int main()
{
Imu imu(ip_address);
auto fp = boost::bind(&Our_class::request_config, this, _1, _2 ); //Where _1 and _2 are the input parameters
imu.getConfigImu(fp, Properties::poll_rate_ms_acc);
return 0;
}
void Our_class::request_config(int error_code, dpyImu::config_imu_struct config_struct)
{
if(error_code!=0) {
std::cout << "\nError code: "<< error_code << std::endl;
}
else {
std::cout << "\nValue: " << config_struct.value << std::endl;
}
}


To set configuration property value:

#include <dpy/imuApi.h>
int main()
{
std::shared_ptr<Imu> imu = std::make_shared<Imu>();
imu->setConfigImu(answer,Property::enable_device_gyr,0);
return 0;
}
void Our_class::answer(int error_code)
{
if (error_code == 0) {
std::cout << "\nThe operation was succesfull";
} else {
std::cout << "\nThe operation was unsuccesfull";
}
}