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 };
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
boost::function< void(boost::system::error_code &ec)> set_handler_function
Result of an operation handler function.
Definition: imuApi.h:88
Z axe operation magnetometer mode.
Definition: imuApi.h:41
This class is responsible of the client logic. His main target is to subscribe to the server informat...
Definition: imuClient.h:16
Accelerometer device.
Definition: imuApi.h:58
The common structure use by any IMU device. It specifies when this sample was taken, the responsible device of, the sample and its quality.
Definition: imuApi.h:66
Properties
Available properties for IMU configuration.
Definition: imuApi.h:28
Configuration IMU structure. It is used to set and get the configuration of the device. It uses the enums previously defined.
Definition: imuApi.h:47
Deepsy Imu namespace that includes the different enums, structs or method signatures that should be u...
Polling frequency magnetomer rate (ms).
Definition: imuApi.h:35
boost::function< void(boost::system::error_code &ec, dpyImu::config_imu_struct &config_struct)> configimu_handler_function
Configuration handler function.
Definition: imuApi.h:87
Class which interfaces with the API logic.
Definition: imuApi.h:100
X and Y axes operation magnetometer mode.
Definition: imuApi.h:40
Polling frequency acceleremoter rate (ms).
Definition: imuApi.h:33
Magnetometer range (gaus).
Definition: imuApi.h:38
Polling frequency gyroscope rate (ms).
Definition: imuApi.h:34
Magnetometer device.
Definition: imuApi.h:60
Gysroscope range (dps).
Definition: imuApi.h:37
Antialiasing accelerometer frequency.
Definition: imuApi.h:39
Enable /disable magnetomer.
Definition: imuApi.h:32
enum dpyImu::e_Type DEVICE
Enum which defines the kind of devices that can compound an IMU.
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: imuApi.h:81
Gyroscope device.
Definition: imuApi.h:59
Enable / disable accelerometer.
Definition: imuApi.h:30
Enable / disable gyroscoper.
Definition: imuApi.h:31
boost::system::error_code status
The quality of the sample.
Definition: imuApi.h:73
e_Type
Enum which defines the kind of devices that can compound an IMU.
Definition: imuApi.h:56
Accelerometer range (g).
Definition: imuApi.h:36
std::string value
The value of the property.
Definition: imuApi.h:50