imuApi.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <boost/function.hpp>
8 #include <boost/system/error_code.hpp>
9 #include <boost/shared_ptr.hpp>
10 
11 #include <vector>
12 
13 class ImuClient;
14 
15 #ifndef IMU_TYPES
16 #define IMU_TYPES
17 
23 namespace dpyImu {
24 
29 {
36  range_acc = 6,
37  range_gyr = 7,
38  range_mag = 8,
42 };
43 
48 {
50  std::string value = "";
51 };
52 
56 typedef enum e_Type
57 {
59  GYROSCOPE = 1,
61 } DEVICE;
62 
67 {
68  std::string timestamp = "";
70  int x = 0;
71  int y = 0;
72  int z = 0;
73  boost::system::error_code status;
74 
75 };
76 
81 typedef boost::function<void(const bool &available)> service_availability_handler;
82 
86 typedef boost::function< void(boost::system::error_code& ec, dpyImu::info_imu_struct& info_struct)> infoimu_handler_function;
87 typedef boost::function< void(boost::system::error_code& ec, dpyImu::config_imu_struct& config_struct)> configimu_handler_function;
88 typedef boost::function<void(boost::system::error_code& ec)> set_handler_function;
89 
90 
91 }
92 #endif
93 
94 
100 class Imu
101 {
102 private:
103  boost::shared_ptr<ImuClient> mClient;
104 public:
105  explicit Imu(std::string ip = "127.0.0.1");
106  ~Imu();
107  bool isAlive();
108  void monitorServiceAvailability_S(dpyImu::service_availability_handler handler);
109  void monitorServiceAvailability_U();
110  void asyncGetInertialValues(dpyImu::infoimu_handler_function handler, int device_number);
111  void getInertialValues_S(dpyImu::infoimu_handler_function handler);
112  void getInertialValues_U();
113  void asyncGetConfigImu(dpyImu::configimu_handler_function handler, int num_property);
114  void asyncSetConfigImu(dpyImu::set_handler_function handler, int num_property, std::string value);
115 };
@ x_y_op_mode_mag
X and Y axes operation magnetometer mode.
Definition: imuApi.h:40
enum dpyImu::e_Type DEVICE
Enum which defines the kind of devices that can compound an IMU.
boost::function< void(boost::system::error_code &ec, dpyImu::info_imu_struct &info_struct)> infoimu_handler_function
Handlers to the functions the client has to implement.
Definition: imuApi.h:86
Properties
Available properties for IMU configuration.
Definition: imuApi.h:28
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: imuApi.h:81
boost::function< void(boost::system::error_code &ec)> set_handler_function
Result of an operation handler function.
Definition: imuApi.h:88
Deepsy Imu namespace that includes the different enums, structs or method signatures that should be u...
int z
Z-axis Accelerometer: micro g. Gyroscope: micro degrees per second. Magnetometer: micro Gauss.
Definition: imuApi.h:72
std::string value
The value of the property.
Definition: imuApi.h:50
@ range_gyr
Gysroscope range (dps).
Definition: imuApi.h:37
This class is responsible of the client logic. His main target is to subscribe to the server informat...
Definition: imuClient.h:16
Class which interfaces with the API logic.
Definition: imuApi.h:100
boost::function< void(boost::system::error_code &ec, dpyImu::config_imu_struct &config_struct)> configimu_handler_function
Configuration handler function.
Definition: imuApi.h:87
@ poll_rate_ms_mag
Polling frequency magnetomer rate (ms).
Definition: imuApi.h:35
@ enable_device_mag
Enable /disable magnetomer.
Definition: imuApi.h:32
boost::system::error_code status
The quality of the sample.
Definition: imuApi.h:73
@ GYROSCOPE
Gyroscope device.
Definition: imuApi.h:59
@ enable_device_acc
Enable / disable accelerometer.
Definition: imuApi.h:30
@ anti_aliasing_freq_acc
Antialiasing accelerometer frequency.
Definition: imuApi.h:39
@ range_mag
Magnetometer range (gaus).
Definition: imuApi.h:38
@ enable_device_gyr
Enable / disable gyroscoper.
Definition: imuApi.h:31
e_Type
Enum which defines the kind of devices that can compound an IMU.
Definition: imuApi.h:56
@ poll_rate_ms_acc
Polling frequency acceleremoter rate (ms).
Definition: imuApi.h:33
Configuration IMU structure. It is used to set and get the configuration of the device....
Definition: imuApi.h:47
int x
X-axis Accelerometer: micro g. Gyroscope: micro degrees per second. Magnetometer: micro Gauss.
Definition: imuApi.h:70
@ z_op_mode_mag
Z axe operation magnetometer mode.
Definition: imuApi.h:41
@ poll_rate_ms_gyr
Polling frequency gyroscope rate (ms).
Definition: imuApi.h:34
e_Type type
Which device.
Definition: imuApi.h:69
std::string timestamp
The timestamp of the stored sample.
Definition: imuApi.h:68
@ range_acc
Accelerometer range (g).
Definition: imuApi.h:36
@ MAGNETOMETER
Magnetometer device.
Definition: imuApi.h:60
int y
Y-axis Accelerometer: micro g. Gyroscope: micro degrees per second. Magnetometer: micro Gauss.
Definition: imuApi.h:71
The common structure use by any IMU device. It specifies when this sample was taken,...
Definition: imuApi.h:66
@ ACCELEROMETER
Accelerometer device.
Definition: imuApi.h:58