sbg_device.h
Go to the documentation of this file.
1 
34 #ifndef SBG_ROS_SBG_DEVICE_H
35 #define SBG_ROS_SBG_DEVICE_H
36 
37 // Standard headers
38 #include <iostream>
39 #include <map>
40 #include <string>
41 
42 // ROS headers
43 #include <std_srvs/SetBool.h>
44 #include <std_srvs/Trigger.h>
45 
46 // Project headers
47 #include <config_applier.h>
48 #include <config_store.h>
49 #include <message_publisher.h>
50 
51 namespace sbg
52 {
56 class SbgDevice
57 {
58 private:
59 
60  //---------------------------------------------------------------------//
61  //- Static members definition -//
62  //---------------------------------------------------------------------//
63 
64  static std::map<SbgEComMagCalibQuality, std::string> g_mag_calib_quality_;
65  static std::map<SbgEComMagCalibConfidence, std::string> g_mag_calib_confidence_;
66  static std::map<SbgEComMagCalibMode, std::string> g_mag_calib_mode_;
67  static std::map<SbgEComMagCalibBandwidth, std::string> g_mag_calib_bandwidth;
68 
69  //---------------------------------------------------------------------//
70  //- Private variables -//
71  //---------------------------------------------------------------------//
72 
78 
80 
86 
87  //---------------------------------------------------------------------//
88  //- Private methods -//
89  //---------------------------------------------------------------------//
90 
101  static SbgErrorCode onLogReceivedCallback(SbgEComHandle* p_handle, SbgEComClass msg_class, SbgEComMsgId msg, const SbgBinaryLogData* p_log_data, void* p_user_arg);
102 
110  void onLogReceived(SbgEComClass msg_class, SbgEComMsgId msg, const SbgBinaryLogData& ref_sbg_data);
111 
115  void loadParameters(void);
116 
122  void connect(void);
123 
129  void readDeviceInfo(void);
130 
137  std::string getVersionAsString(uint32 sbg_version_enc) const;
138 
142  void initPublishers(void);
143 
151  void configure(void);
152 
160  bool processMagCalibration(std_srvs::Trigger::Request& ref_ros_request, std_srvs::Trigger::Response& ref_ros_response);
161 
169  bool saveMagCalibration(std_srvs::Trigger::Request& ref_ros_request, std_srvs::Trigger::Response& ref_ros_response);
170 
176  bool startMagCalibration(void);
177 
183  bool endMagCalibration(void);
184 
190  bool uploadMagCalibrationToDevice(void);
191 
195  void displayMagCalibrationStatusResult(void) const;
196 
200  void exportMagCalibrationResults(void) const;
201 
202 public:
203 
204  //---------------------------------------------------------------------//
205  //- Constructor -//
206  //---------------------------------------------------------------------//
207 
213  SbgDevice(ros::NodeHandle& ref_node_handle);
214 
218  ~SbgDevice(void);
219 
220  //---------------------------------------------------------------------//
221  //- Parameters -//
222  //---------------------------------------------------------------------//
223 
229  uint32_t getUpdateFrequency(void) const;
230 
231  //---------------------------------------------------------------------//
232  //- Public methods -//
233  //---------------------------------------------------------------------//
234 
240  void initDeviceForReceivingData(void);
241 
245  void initDeviceForMagCalibration(void);
246 
250  void periodicHandle(void);
251 };
252 }
253 
254 #endif // SBG_ROS_SBG_DEVICE_H
Apply configuration to the device.
MessagePublisher m_message_publisher_
Definition: sbg_device.h:76
ros::ServiceServer m_calib_save_service_
Definition: sbg_device.h:85
unsigned int uint32
Definition: sbgTypes.h:52
bool processMagCalibration(std_srvs::Trigger::Request &ref_ros_request, std_srvs::Trigger::Response &ref_ros_response)
Definition: sbg_device.cpp:213
void exportMagCalibrationResults(void) const
Definition: sbg_device.cpp:408
void periodicHandle(void)
Definition: sbg_device.cpp:483
void onLogReceived(SbgEComClass msg_class, SbgEComMsgId msg, const SbgBinaryLogData &ref_sbg_data)
Definition: sbg_device.cpp:112
Manage publishment of messages from logs.
bool uploadMagCalibrationToDevice(void)
Definition: sbg_device.cpp:328
uint32_t getUpdateFrequency(void) const
Definition: sbg_device.cpp:452
ros::NodeHandle & m_ref_node_
Definition: sbg_device.h:75
void displayMagCalibrationStatusResult(void) const
Definition: sbg_device.cpp:356
SbgInterface m_sbg_interface_
Definition: sbg_device.h:74
static std::map< SbgEComMagCalibQuality, std::string > g_mag_calib_quality_
Definition: sbg_device.h:64
ConfigStore m_config_store_
Definition: sbg_device.h:77
Class to handle the device configuration.
void connect(void)
Definition: sbg_device.cpp:129
SbgEComHandle m_com_handle_
Definition: sbg_device.h:73
void loadParameters(void)
Definition: sbg_device.cpp:120
std::string getVersionAsString(uint32 sbg_version_enc) const
Definition: sbg_device.cpp:189
void readDeviceInfo(void)
Definition: sbg_device.cpp:165
bool startMagCalibration(void)
Definition: sbg_device.cpp:283
static std::map< SbgEComMagCalibConfidence, std::string > g_mag_calib_confidence_
Definition: sbg_device.h:65
SbgEComMagCalibResults m_magCalibResults
Definition: sbg_device.h:83
static std::map< SbgEComMagCalibMode, std::string > g_mag_calib_mode_
Definition: sbg_device.h:66
uint32_t m_rate_frequency_
Definition: sbg_device.h:79
bool endMagCalibration(void)
Definition: sbg_device.cpp:308
uint8_t SbgEComMsgId
Definition: sbgEComIds.h:289
void configure(void)
Definition: sbg_device.cpp:204
SbgDevice(ros::NodeHandle &ref_node_handle)
Definition: sbg_device.cpp:59
static std::map< SbgEComMagCalibBandwidth, std::string > g_mag_calib_bandwidth
Definition: sbg_device.h:67
enum _SbgEComClass SbgEComClass
bool saveMagCalibration(std_srvs::Trigger::Request &ref_ros_request, std_srvs::Trigger::Response &ref_ros_response)
Definition: sbg_device.cpp:252
bool m_mag_calibration_done_
Definition: sbg_device.h:82
void initDeviceForReceivingData(void)
Definition: sbg_device.cpp:461
void initDeviceForMagCalibration(void)
Definition: sbg_device.cpp:475
bool m_mag_calibration_ongoing_
Definition: sbg_device.h:81
void initPublishers(void)
Definition: sbg_device.cpp:197
enum _SbgErrorCode SbgErrorCode
static SbgErrorCode onLogReceivedCallback(SbgEComHandle *p_handle, SbgEComClass msg_class, SbgEComMsgId msg, const SbgBinaryLogData *p_log_data, void *p_user_arg)
Definition: sbg_device.cpp:98
ros::ServiceServer m_calib_service_
Definition: sbg_device.h:84


sbg_driver
Author(s): SBG Systems
autogenerated on Sat Sep 3 2022 02:53:35