ellipse.cpp
Go to the documentation of this file.
1 #include "ellipse.h"
2 #include "ellipse_msg.h"
3 
4 #include <iostream>
5 #include <iomanip>
6 #include <fstream>
7 #include <ctime>
8 
9 #include <boost/foreach.hpp>
10 #include <boost/lexical_cast.hpp>
11 #include <boost/regex.hpp>
12 #include <boost/thread.hpp>
13 #include <boost/thread/xtime.hpp>
14 #include <boost/date_time/local_time/local_time.hpp>
15 
16 using namespace std;
17 
18 // From ros_com/recorder
19 std::string timeToStr(ros::WallTime ros_t){
20  (void)ros_t;
21  std::stringstream msg;
22  const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
23  boost::posix_time::time_facet *const f = new boost::posix_time::time_facet("%Y-%m-%d-%H-%M-%S");
24  msg.imbue(std::locale(msg.getloc(),f));
25  msg << now;
26  return msg.str();
27 }
28 
30  m_node = n;
31  load_param();
32 }
33 
35  sbgEComClose(&m_comHandle);
36  sbgInterfaceSerialDestroy(&m_sbgInterface);
37 }
38 
40  SbgErrorCode errorCode;
41 
42  // Set the parameters of the Interface (port, baud_rate)
43  errorCode = sbgInterfaceSerialCreate(&m_sbgInterface, m_uartPortName.c_str(), m_uartBaudRate);
44  if (errorCode != SBG_NO_ERROR){ROS_WARN("SBG DRIVER - sbgInterfaceSerialCreate Error : %s", sbgErrorCodeToString(errorCode));}
45 
46  // Init the SBG
47  errorCode = sbgEComInit(&m_comHandle, &m_sbgInterface);
48  if (errorCode != SBG_NO_ERROR){ROS_WARN("SBG DRIVER - sbgEComInit Error : %s", sbgErrorCodeToString(errorCode));}
49 
50  // Get Infos
51  read_get_info(&m_comHandle);
52 }
53 
55  SbgErrorCode errorCode = sbgEComSetReceiveLogCallback(&m_comHandle, onLogReceived, this);
56  if (errorCode != SBG_NO_ERROR){ROS_WARN("SBG DRIVER - sbgEComSetReceiveLogCallback Error : %s", sbgErrorCodeToString(errorCode));}
57 }
58 
60  if(m_log_status!=0)
61  m_sbgStatus_pub = m_node->advertise<sbg_driver::SbgStatus>("status",10);
62  if(m_log_utc_time !=0)
63  m_sbgUtcTime_pub = m_node->advertise<sbg_driver::SbgUtcTime>("utc_time",10);
64  if(m_log_imu_data !=0)
65  m_sbgImuData_pub = m_node->advertise<sbg_driver::SbgImuData>("imu_data",10);
66  if(m_log_ekf_euler !=0)
67  m_sbgEkfEuler_pub = m_node->advertise<sbg_driver::SbgEkfEuler>("ekf_euler",10);
68  if(m_log_ekf_quat !=0)
69  m_sbgEkfQuat_pub = m_node->advertise<sbg_driver::SbgEkfQuat>("ekf_quat",10);
70  if(m_log_ekf_nav !=0)
71  m_sbgEkfNav_pub = m_node->advertise<sbg_driver::SbgEkfNav>("ekf_nav",10);
72  if(m_log_ship_motion !=0)
73  m_sbgShipMotion_pub = m_node->advertise<sbg_driver::SbgShipMotion>("ship_motion",10);
74  if(m_log_mag !=0)
75  m_sbgMag_pub = m_node->advertise<sbg_driver::SbgMag>("mag",10);
76  if(m_log_mag_calib !=0)
77  m_sbgMagCalib_pub = m_node->advertise<sbg_driver::SbgMagCalib>("mag_calib",10);
78  if(m_log_gps1_vel !=0)
79  m_sbgGpsVel_pub = m_node->advertise<sbg_driver::SbgGpsVel>("gps_vel",10);
80  if(m_log_gps1_pos !=0)
81  m_sbgGpsPos_pub = m_node->advertise<sbg_driver::SbgGpsPos>("gps_pos",10);
82  if(m_log_gps1_hdt !=0)
83  m_sbgGpsHdt_pub = m_node->advertise<sbg_driver::SbgGpsHdt>("gps_hdt",10);
84  if(m_log_gps1_raw !=0)
85  m_sbgGpsRaw_pub = m_node->advertise<sbg_driver::SbgGpsRaw>("gps_raw",10);
86  if(m_log_odo_vel !=0)
87  m_sbgOdoVel_pub = m_node->advertise<sbg_driver::SbgOdoVel>("odo_vel",10);
88  if(m_log_event_a !=0)
89  m_sbgEventA_pub = m_node->advertise<sbg_driver::SbgEvent>("eventA",10);
90  if(m_log_event_b !=0)
91  m_sbgEventB_pub = m_node->advertise<sbg_driver::SbgEvent>("eventB",10);
92  if(m_log_event_c !=0)
93  m_sbgEventC_pub = m_node->advertise<sbg_driver::SbgEvent>("eventC",10);
94  if(m_log_event_d !=0)
95  m_sbgEventD_pub = m_node->advertise<sbg_driver::SbgEvent>("eventD",10);
96  if(m_log_pressure !=0)
97  m_sbgPressure_pub = m_node->advertise<sbg_driver::SbgPressure>("pressure",10);
98 }
99 
101  bool change = false;
102  change |= set_cmd_init_parameters();
103  change |= set_cmd_motion_profile();
104  change |= set_cmd_imu_lever_arm();
105  change |= set_cmd_aiding_assignement();
106  change |= set_cmd_mag_model();
107  change |= set_cmd_mag_reject_mode();
108  change |= set_cmd_gnss_model();
109  change |= set_cmd_gnss_lever_arm();
110  change |= set_cmd_gnss_reject_mode();
111  change |= set_cmd_odom_conf();
112  change |= set_cmd_odom_lever_arm();
113  change |= set_cmd_odom_reject_mode();
114  change |= set_cmd_output();
115 
116  if(change){
117  // // SAVE AND REBOOT
118  save_config();
119  }
120 }
121 
123  ROS_INFO("SBG DRIVER - The configuration of the Ellipse was updated according to the configuration file");
125  if (errorCode != SBG_NO_ERROR)
126  ROS_WARN("SBG DRIVER - sbgEComCmdSettingsAction (Saving) Error : %s", sbgErrorCodeToString(errorCode));
127  else
128  ROS_INFO("SBG DRIVER - SAVED & REBOOT");
129 }
130 
132  ros::NodeHandle n_private("~");
133  m_uartPortName = n_private.param<std::string>("uartConf/portName", "/dev/ttyUSB0");
134  m_uartBaudRate = (uint32) n_private.param<int>("uartConf/baudRate", 115200);
135  m_portOutput = (SbgEComOutputPort) n_private.param<int>("uartConf/portID", 0);
136 
137  m_initLat = (double) n_private.param<double>("sensorParameters/initLat", 48.419727);
138  m_initLong = (double) n_private.param<double>("sensorParameters/initLong", -4.472119);
139  m_initAlt = (double) n_private.param<double>("sensorParameters/initAlt", 100);
140  m_initYear = (uint16) n_private.param<int>("sensorParameters/year", 2018);
141  m_initMonth = (uint8) n_private.param<int>("sensorParameters/month", 03);
142  m_initDay = (uint8) n_private.param<int>("sensorParameters/day", 10);
143  m_motionProfileId = (uint32) n_private.param<int>("sensorParameters/motionProfie", 1);
144 
145  m_imuAxisDirectionX = n_private.param<int>("imuAlignementLeverArm/axisDirectionX",0);
146  m_imuAxisDirectionY = n_private.param<int>("imuAlignementLeverArm/axisDirectionY",0);
147  m_imuMisRoll = n_private.param<float>("imuAlignementLeverArm/misRoll",0);
148  m_imuMisPitch = n_private.param<float>("imuAlignementLeverArm/misPitch",0);
149  m_imuMisYaw = n_private.param<float>("imuAlignementLeverArm/misYaw",0);
150  m_imuLeverArm[0] = n_private.param<float>("imuAlignementLeverArm/leverArmX",0);
151  m_imuLeverArm[1] = n_private.param<float>("imuAlignementLeverArm/leverArmY",0);
152  m_imuLeverArm[2] = n_private.param<float>("imuAlignementLeverArm/leverArmZ",0);
153 
154  m_gnss1ModulePortAssignment = n_private.param<int>("aidingAssignment/gnss1ModulePortAssignment", 1);
155  m_gnss1ModuleSyncAssignment = n_private.param<int>("aidingAssignment/gnss1ModuleSyncAssignment", 0);
156  m_rtcmPortAssignment = n_private.param<int>("aidingAssignment/rtcmPortAssignment", 255);
157  m_odometerPinAssignment = n_private.param<int>("aidingAssignment/odometerPinAssignment", 0);
158 
159  m_magModelId = (uint32) n_private.param<int>("magnetometer/magnetometerModel", 201);
160  m_magRejectMode = n_private.param<int>("magnetometer/magnetometerRejectMode", 1);
161 
162  m_gnssModelId = (uint32) n_private.param<int>("gnss/gnss_model_id", 102);
163  m_gnss1LeverArmX = n_private.param<float>("gnss/leverArmX", 0);
164  m_gnss1LeverArmY = n_private.param<float>("gnss/leverArmY", 0);
165  m_gnss1LeverArmZ = n_private.param<float>("gnss/leverArmZ", 0);
166  m_gnss1PitchOffset = n_private.param<float>("gnss/pitchOffset", 0);
167  m_gnss1YawOffset = n_private.param<float>("gnss/yawOffset", 0);
168  m_gnss1AntennaDistance = n_private.param<float>("gnss/antennaDistance", 0);
169  m_gnss1PosRejectMode = n_private.param<int>("gnss/posRejectMode", 1);
170  m_gnss1VelRejectMode = n_private.param<int>("gnss/velRejectMode", 1);
171  m_gnss1HdtRejectMode = n_private.param<int>("gnss/hdtRejectMode", 1);
172 
173  m_odomGain = n_private.param<float>("odom/gain", 4800);
174  m_odomGainError = (uint8) n_private.param<int>("odom/gain_error", 0.1);
175  m_odomDirection = n_private.param<bool>("odom/direction", 0);
176  m_odomLever[0] = n_private.param<float>("odom/leverArmX", 0);
177  m_odomLever[1] = n_private.param<float>("odom/leverArmY", 0);
178  m_odomLever[2] = n_private.param<float>("odom/leverArmZ", 0);
179  m_odomRejectMode = n_private.param<int>("odom/rejectMode", 1);
180 
181  m_timeReference = (uint8)n_private.param<int>("output/timeReference",0);
182 
183  m_log_status = n_private.param<int>("output/log_status", 0);
184  m_log_imu_data = n_private.param<int>("output/log_imu_data", 0);
185  m_log_ekf_euler = n_private.param<int>("output/log_ekf_euler", 0);
186  m_log_ekf_quat = n_private.param<int>("output/log_ekf_quat", 0);
187  m_log_ekf_nav = n_private.param<int>("output/log_ekf_nav", 0);
188  m_log_ship_motion = n_private.param<int>("output/log_ship_motion", 0);
189  m_log_utc_time = n_private.param<int>("output/log_utc_time", 0);
190  m_log_mag = n_private.param<int>("output/log_mag", 0);
191  m_log_mag_calib = n_private.param<int>("output/log_mag_calib", 0);
192  m_log_gps1_vel = n_private.param<int>("output/log_gps1_vel", 0);
193  m_log_gps1_pos = n_private.param<int>("output/log_gps1_pos", 0);
194  m_log_gps1_hdt = n_private.param<int>("output/log_gps1_hdt", 0);
195  m_log_gps1_raw = n_private.param<int>("output/log_gps1_raw", 0);
196  m_log_odo_vel = n_private.param<int>("output/log_odo_vel", 0);
197  m_log_event_a = n_private.param<int>("output/log_event_a", 0);
198  m_log_event_b = n_private.param<int>("output/log_event_b", 0);
199  m_log_event_c = n_private.param<int>("output/log_event_c", 0);
200  m_log_event_d = n_private.param<int>("output/log_event_d", 0);
201  m_log_pressure = n_private.param<int>("output/log_pressure", 0);
202  m_rate_frequency = n_private.param<int>("output/frequency",0);
203 
204  m_magnetic_calibration_mode = n_private.param<int>("magnetometer/calibration/mode",1);
205  m_magnetic_calibration_bandwidth = n_private.param<int>("magnetometer/calibration/bandwidth",2);
206 
207  std::vector<int> mod_div;
208  mod_div.push_back(m_log_status);
209  mod_div.push_back(m_log_imu_data);
210  mod_div.push_back(m_log_ekf_euler);
211  mod_div.push_back(m_log_ekf_quat);
212  mod_div.push_back(m_log_ekf_nav);
213  mod_div.push_back(m_log_ship_motion);
214  mod_div.push_back(m_log_utc_time);
215  mod_div.push_back(m_log_mag);
216  mod_div.push_back(m_log_mag_calib);
217  mod_div.push_back(m_log_gps1_vel);
218  mod_div.push_back(m_log_gps1_pos);
219  mod_div.push_back(m_log_gps1_hdt);
220  mod_div.push_back(m_log_gps1_raw);
221  mod_div.push_back(m_log_odo_vel);
222  mod_div.push_back(m_log_event_a);
223  mod_div.push_back(m_log_event_b);
224  mod_div.push_back(m_log_event_c);
225  mod_div.push_back(m_log_event_d);
226  mod_div.push_back(m_log_pressure);
227 
228  if(m_rate_frequency==0){
229  int mod_div_min = 3e5;
230  for(int i=0; i<mod_div.size(); i++){
231  if(mod_div[i]<mod_div_min && mod_div[i]!=0)
232  mod_div_min = mod_div[i];
233  }
234 
235  if(mod_div_min>=10000) // Case Event
236  mod_div_min = 8;
237 
238  m_rate_frequency = MODE_DIV_2_FREQ[mod_div_min];
239  }
240 }
241 
243  sbgEComHandle(&m_comHandle);
244  if(m_new_sbgStatus && m_log_status != 0){
245  m_new_sbgStatus = false;
246  m_sbgStatus_pub.publish(m_sbgStatus_msg);
247  }
248 
249  if(m_new_sbgUtcTime && m_log_utc_time != 0){
250  m_new_sbgUtcTime = false;
251  m_sbgUtcTime_pub.publish(m_sbgUtcTime_msg);
252  }
253 
254  if(m_new_sbgImuData && m_log_imu_data != 0){
255  m_new_sbgImuData = false;
256  m_sbgImuData_pub.publish(m_sbgImuData_msg);
257  }
258 
259  if(m_new_sbgEkfEuler && m_log_ekf_euler != 0){
260  m_new_sbgEkfEuler = false;
261  m_sbgEkfEuler_pub.publish(m_sbgEkfEuler_msg);
262  }
263 
264  if(m_new_sbgEkfQuat && m_log_ekf_quat != 0){
265  m_new_sbgEkfQuat = false;
266  m_sbgEkfQuat_pub.publish(m_sbgEkfQuat_msg);
267  }
268 
269  if(m_new_sbgEkfNav && m_log_ekf_nav != 0){
270  m_new_sbgEkfNav = false;
271  m_sbgEkfNav_pub.publish(m_sbgEkfNav_msg);
272  }
273 
274  if(m_new_sbgShipMotion && m_log_ship_motion != 0){
275  m_new_sbgShipMotion = false;
276  m_sbgShipMotion_pub.publish(m_sbgShipMotion_msg);
277  }
278 
279  if(m_new_sbgMag && m_log_mag != 0){
280  m_new_sbgMag = false;
281  m_sbgMag_pub.publish(m_sbgMag_msg);
282  }
283 
284  if(m_new_sbgMagCalib && m_log_mag_calib != 0){
285  m_new_sbgMagCalib = false;
286  m_sbgMagCalib_pub.publish(m_sbgMagCalib_msg);
287  }
288 
289  if(m_new_sbgGpsVel && m_log_gps1_vel != 0){
290  m_new_sbgGpsVel = false;
291  m_sbgGpsVel_pub.publish(m_sbgGpsVel_msg);
292  }
293 
294  if(m_new_sbgGpsPos && m_log_gps1_pos != 0){
295  m_new_sbgGpsPos = false;
296  m_sbgGpsPos_pub.publish(m_sbgGpsPos_msg);
297  }
298 
299  if(m_new_sbgGpsHdt && m_log_gps1_hdt != 0){
300  m_new_sbgGpsHdt = false;
301  m_sbgGpsHdt_pub.publish(m_sbgGpsHdt_msg);
302  }
303 
304  if(m_new_sbgGpsRaw && m_log_gps1_raw != 0){
305  m_new_sbgGpsRaw = false;
306  m_sbgGpsRaw_pub.publish(m_sbgGpsRaw_msg);
307  }
308 
309  if(m_new_sbgOdoVel && m_log_odo_vel != 0){
310  m_new_sbgOdoVel = false;
311  m_sbgOdoVel_pub.publish(m_sbgOdoVel_msg);
312  }
313 
314  if(m_new_sbgEventA && m_log_event_a != 0){
315  m_new_sbgEventA = false;
316  m_sbgEventA_pub.publish(m_sbgEventA_msg);
317  }
318 
319  if(m_new_sbgEventB && m_log_event_b != 0){
320  m_new_sbgEventB = false;
321  m_sbgEventB_pub.publish(m_sbgEventB_msg);
322  }
323 
324  if(m_new_sbgEventC && m_log_event_c != 0){
325  m_new_sbgEventC = false;
326  m_sbgEventC_pub.publish(m_sbgEventC_msg);
327  }
328 
329  if(m_new_sbgEventD && m_log_event_d != 0){
330  m_new_sbgEventD = false;
331  m_sbgEventD_pub.publish(m_sbgEventD_msg);
332  }
333 
334  if(m_new_sbgPressure && m_log_pressure != 0){
335  m_new_sbgPressure = false;
336  m_sbgPressure_pub.publish(m_sbgPressure_msg);
337  }
338 }
339 
340 
341 SbgErrorCode onLogReceived(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg){
342  Ellipse *e = (Ellipse*)pUserArg;
343  switch (msg){
344  case SBG_ECOM_LOG_STATUS:
346  e->m_new_sbgStatus = true;
347  break;
348 
351  e->m_new_sbgUtcTime = true;
352  break;
353 
356  e->m_new_sbgImuData = true;
357  break;
358 
361  e->m_new_sbgEkfEuler = true;
362  break;
363 
366  e->m_new_sbgEkfQuat = true;
367  break;
368 
371  e->m_new_sbgEkfNav = true;
372  break;
373 
376  e->m_new_sbgShipMotion = true;
377  break;
378 
379  case SBG_ECOM_LOG_MAG:
380  read_ecom_log_mag(e->m_sbgMag_msg, pLogData);
381  e->m_new_sbgMag = true;
382  break;
383 
386  e->m_new_sbgMagCalib = true;
387  break;
388 
391  e->m_new_sbgGpsVel = true;
392  break;
393 
396  e->m_new_sbgGpsPos = true;
397  break;
398 
401  e->m_new_sbgGpsHdt = true;
402  break;
403 
406  e->m_new_sbgGpsRaw = true;
407  break;
408 
411  e->m_new_sbgOdoVel = true;
412  break;
413 
415  read_ecom_log_event(e->m_sbgEventA_msg, pLogData);
416  e->m_new_sbgEventA = true;
417  break;
418 
420  read_ecom_log_event(e->m_sbgEventB_msg, pLogData);
421  e->m_new_sbgEventB = true;
422  break;
423 
425  read_ecom_log_event(e->m_sbgEventC_msg, pLogData);
426  e->m_new_sbgEventC = true;
427  break;
428 
430  read_ecom_log_event(e->m_sbgEventD_msg, pLogData);
431  e->m_new_sbgEventD = true;
432  break;
433 
436  e->m_new_sbgPressure = true;
437  break;
438 
439  default:
440  break;
441  }
442  return SBG_NO_ERROR;
443 }
444 
445 
447  SbgEComInitConditionConf init_condition;
448  sbgEComCmdSensorGetInitCondition(&m_comHandle, &init_condition);
449  if(init_condition.year != m_initYear
450  || init_condition.day != m_initDay
451  || init_condition.month != m_initMonth
452  || init_condition.latitude != m_initLat
453  || init_condition.longitude != m_initLong
454  || init_condition.altitude != m_initAlt){
455  init_condition.year = m_initYear;
456  init_condition.day = m_initDay;
457  init_condition.month = m_initMonth;
458  init_condition.latitude = m_initLat;
459  init_condition.longitude = m_initLong;
460  init_condition.altitude = m_initAlt;
461  sbgEComCmdSensorSetInitCondition(&m_comHandle, &init_condition);
462  ROS_INFO("SBG DRIVER - [Param] New init");
463  return true;
464  }
465  return false;
466 }
467 
469  SbgEComModelInfo motion_profile;
470  sbgEComCmdSensorGetMotionProfileInfo(&m_comHandle, &motion_profile);
471  if(motion_profile.id != m_motionProfileId){
472  sbgEComCmdSensorSetMotionProfileId(&m_comHandle, m_motionProfileId);
473  ROS_INFO("SBG DRIVER - [Param] motion profile");
474  return true;
475  }
476  return false;
477 }
478 
480  SbgEComSensorAlignmentInfo pAlignConf;
481  float leverArm[3];
482  sbgEComCmdSensorGetAlignmentAndLeverArm(&m_comHandle, &pAlignConf, leverArm);
483 
484  if(leverArm[0] != m_imuLeverArm[0]
485  || leverArm[1] != m_imuLeverArm[1]
486  || leverArm[2] != m_imuLeverArm[2]
487  || pAlignConf.axisDirectionX != m_imuAxisDirectionX
488  || pAlignConf.axisDirectionY != m_imuAxisDirectionY
489  || pAlignConf.misRoll != m_imuMisRoll
490  || pAlignConf.misPitch != m_imuMisPitch
491  || pAlignConf.misYaw != m_imuMisYaw ){
492  leverArm[0] = m_imuLeverArm[0];
493  leverArm[1] = m_imuLeverArm[1];
494  leverArm[2] = m_imuLeverArm[2];
495  pAlignConf.axisDirectionX = (SbgEComAxisDirection) m_imuAxisDirectionX;
496  pAlignConf.axisDirectionY = (SbgEComAxisDirection) m_imuAxisDirectionY;
497  pAlignConf.misRoll = m_imuMisRoll;
498  pAlignConf.misPitch = m_imuMisPitch;
499  pAlignConf.misYaw = m_imuMisYaw ;
500  sbgEComCmdSensorSetAlignmentAndLeverArm(&m_comHandle, &pAlignConf, leverArm);
501  ROS_INFO("SBG DRIVER - [Param] imu lever arm");
502  return true;
503  }
504  return false;
505 }
506 
508  SbgEComAidingAssignConf aidingAssign;
509  sbgEComCmdSensorGetAidingAssignment(&m_comHandle, &aidingAssign);
510 
511  if(aidingAssign.gps1Port != m_gnss1ModulePortAssignment
512  || aidingAssign.gps1Sync != m_gnss1ModuleSyncAssignment
513  || aidingAssign.odometerPinsConf != m_odometerPinAssignment
514  || aidingAssign.rtcmPort != m_rtcmPortAssignment){
515  aidingAssign.gps1Port = (SbgEComModulePortAssignment) m_gnss1ModulePortAssignment;
516  aidingAssign.gps1Sync = (SbgEComModuleSyncAssignment) m_gnss1ModuleSyncAssignment;
517  aidingAssign.odometerPinsConf = (SbgEComOdometerPinAssignment) m_odometerPinAssignment;
518  aidingAssign.rtcmPort = (SbgEComModulePortAssignment) m_rtcmPortAssignment;
519  sbgEComCmdSensorSetAidingAssignment(&m_comHandle, &aidingAssign);
520  ROS_INFO("SBG DRIVER - [Param] Aiding assignement");
521  return true;
522  }
523  return false;
524 }
525 
527  SbgEComModelInfo model_info;
528  sbgEComCmdMagGetModelInfo(&m_comHandle, &model_info);
529  if(model_info.id != m_magModelId){
530  sbgEComCmdMagSetModelId(&m_comHandle, m_magModelId);
531  ROS_INFO("SBG DRIVER - [Param] Mag model");
532  return true;
533  }
534  return false;
535 }
536 
538  SbgEComMagRejectionConf rejection;
539  sbgEComCmdMagGetRejection(&m_comHandle, &rejection);
540  if(rejection.magneticField != m_magRejectMode){
541  rejection.magneticField = (SbgEComRejectionMode) m_magRejectMode;
542  sbgEComCmdMagSetRejection(&m_comHandle, &rejection);
543  ROS_INFO("SBG DRIVER - [Param] Mag reject mode");
544  return true;
545  }
546  return false;
547 }
548 
550  SbgEComModelInfo model_info;
551  sbgEComCmdGnss1GetModelInfo(&m_comHandle, &model_info);
552  if(model_info.id != m_gnssModelId){
553  sbgEComCmdMagSetModelId(&m_comHandle, m_gnssModelId);
554  ROS_INFO("SBG DRIVER - [Param] gnss model");
555  return true;
556  }
557  return false;
558 }
559 
561  SbgEComGnssAlignmentInfo pAlignInfo;
562  sbgEComCmdGnss1GetLeverArmAlignment(&m_comHandle, &pAlignInfo);
563  if(pAlignInfo.antennaDistance != m_gnss1AntennaDistance
564  || pAlignInfo.leverArmX != m_gnss1LeverArmX
565  || pAlignInfo.leverArmY != m_gnss1LeverArmY
566  || pAlignInfo.leverArmZ != m_gnss1LeverArmZ
567  || pAlignInfo.pitchOffset != m_gnss1PitchOffset
568  || pAlignInfo.yawOffset != m_gnss1YawOffset ){
569  pAlignInfo.antennaDistance = m_gnss1AntennaDistance;
570  pAlignInfo.leverArmX = m_gnss1LeverArmX;
571  pAlignInfo.leverArmY = m_gnss1LeverArmY;
572  pAlignInfo.leverArmZ = m_gnss1LeverArmZ;
573  pAlignInfo.pitchOffset = m_gnss1PitchOffset;
574  pAlignInfo.yawOffset = m_gnss1YawOffset ;
575  sbgEComCmdGnss1SetLeverArmAlignment(&m_comHandle, &pAlignInfo);
576  ROS_INFO("SBG DRIVER - [Param] Gnss lever arm");
577  return true;
578  }
579  return false;
580 }
581 
583  SbgEComGnssRejectionConf rejection;
584  sbgEComCmdGnss1GetRejection(&m_comHandle, &rejection);
585 
586  if(rejection.hdt != m_gnss1HdtRejectMode
587  || rejection.position != m_gnss1PosRejectMode
588  || rejection.velocity != m_gnss1VelRejectMode){
589 
590  rejection.hdt = (SbgEComRejectionMode) m_gnss1HdtRejectMode;
591  rejection.position = (SbgEComRejectionMode) m_gnss1PosRejectMode;
592  rejection.velocity = (SbgEComRejectionMode) m_gnss1VelRejectMode;
593  sbgEComCmdGnss1SetRejection(&m_comHandle, &rejection);
594  ROS_INFO("SBG DRIVER - [Param] gnss reject mode");
595  return true;
596  }
597  return false;
598 }
599 
601  SbgEComOdoConf odom;
602  sbgEComCmdOdoGetConf(&m_comHandle, &odom);
603 
604  if(odom.gain != m_odomGain
605  || odom.gainError != m_odomGainError
606  || odom.reverseMode != m_odomDirection){
607 
608  odom.gain = m_odomGain;
609  odom.gainError = m_odomGainError;
610  odom.reverseMode = m_odomDirection;
611  sbgEComCmdOdoSetConf(&m_comHandle, &odom);
612  ROS_INFO("SBG DRIVER - [Param] odom conf");
613  return true;
614  }
615  return false;
616 }
617 
619  float leverArm[3];
620  sbgEComCmdOdoGetLeverArm(&m_comHandle, leverArm);
621  if(leverArm[0] != m_odomLever[0]
622  || leverArm[1] != m_odomLever[1]
623  || leverArm[2] != m_odomLever[2]
624  ){
625  leverArm[0] = m_odomLever[0];
626  leverArm[1] = m_odomLever[1];
627  leverArm[2] = m_odomLever[2];
628  sbgEComCmdOdoSetLeverArm(&m_comHandle, leverArm);
629  ROS_INFO("SBG DRIVER - [Param] odom lever arm ");
630  return true;
631  }
632  return false;
633 }
634 
636  SbgEComOdoRejectionConf rejection;
637  sbgEComCmdOdoGetRejection(&m_comHandle, &rejection);
638  if(rejection.velocity != m_odomRejectMode){
639  rejection.velocity = (SbgEComRejectionMode) m_odomRejectMode;
640  sbgEComCmdOdoSetRejection(&m_comHandle, &rejection);
641  ROS_INFO("SBG DRIVER - [Param] odom reject mode");
642  return true;
643  }
644  return false;
645 }
646 
648  bool change = false;
649 
650  SbgEComOutputMode pConf;
651  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_STATUS,&pConf);
652  if(pConf != m_log_status){
653  pConf = (SbgEComOutputMode) m_log_status;
654  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_STATUS, pConf);
655  ROS_INFO("SBG DRIVER - [Param] log status");
656  change = true;
657  }
658 
659  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_UTC_TIME,&pConf);
660  if(pConf != m_log_utc_time){
661  pConf = (SbgEComOutputMode) m_log_utc_time;
662  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_UTC_TIME, pConf);
663  ROS_INFO("SBG DRIVER - [Param] log utc");
664  change = true;
665  }
666 
667  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_IMU_DATA,&pConf);
668  if(pConf != m_log_imu_data){
669  pConf = (SbgEComOutputMode) m_log_imu_data;
670  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_IMU_DATA, pConf);
671  ROS_INFO("SBG DRIVER - [Param] log imu data");
672  change = true;
673  }
674 
675  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_EULER,&pConf);
676  if(pConf != m_log_ekf_euler){
677  pConf = (SbgEComOutputMode) m_log_ekf_euler;
678  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_EULER, pConf);
679  ROS_INFO("SBG DRIVER - [Param] log ekf euler");
680  change = true;
681  }
682 
683  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_QUAT,&pConf);
684  if(pConf != m_log_ekf_quat){
685  pConf = (SbgEComOutputMode) m_log_ekf_quat;
686  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_QUAT, pConf);
687  ROS_INFO("SBG DRIVER - [Param] log ekf quat");
688  change = true;
689  }
690 
691  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_NAV,&pConf);
692  if(pConf != m_log_ekf_nav){
693  pConf = (SbgEComOutputMode) m_log_ekf_nav;
694  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EKF_NAV, pConf);
695  ROS_INFO("SBG DRIVER - [Param] log ekf nav");
696  change = true;
697  }
698 
700  if(pConf != m_log_ship_motion){
701  pConf = (SbgEComOutputMode) m_log_ship_motion;
703  ROS_INFO("SBG DRIVER - [Param] ship motion");
704  change = true;
705  }
706 
707  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_MAG,&pConf);
708  if(pConf != m_log_mag){
709  pConf = (SbgEComOutputMode) m_log_mag;
710  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_MAG, pConf);
711  ROS_INFO("SBG DRIVER - [Param] log mag");
712  change = true;
713  }
714 
715  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_MAG_CALIB,&pConf);
716  if(pConf != m_log_mag_calib){
717  pConf = (SbgEComOutputMode) m_log_mag_calib;
718  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_MAG_CALIB, pConf);
719  ROS_INFO("SBG DRIVER - [Param] mag calib");
720  change = true;
721  }
722 
723  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_VEL,&pConf);
724  if(pConf != m_log_gps1_vel){
725  pConf = (SbgEComOutputMode) m_log_gps1_vel;
726  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_VEL, pConf);
727  ROS_INFO("SBG DRIVER - [Param] gps1 vel");
728  change = true;
729  }
730 
731  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_POS,&pConf);
732  if(pConf != m_log_gps1_pos){
733  pConf = (SbgEComOutputMode) m_log_gps1_pos;
734  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_POS, pConf);
735  ROS_INFO("SBG DRIVER - [Param] gps1 pos");
736  change = true;
737  }
738 
739  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_HDT,&pConf);
740  if(pConf != m_log_gps1_hdt){
741  pConf = (SbgEComOutputMode) m_log_gps1_hdt;
742  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_HDT, pConf);
743  ROS_INFO("SBG DRIVER - [Param] gps1 hdt");
744  change = true;
745  }
746 
747  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_RAW,&pConf);
748  if(pConf != m_log_gps1_raw){
749  pConf = (SbgEComOutputMode) m_log_gps1_raw;
750  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_GPS1_RAW, pConf);
751  ROS_INFO("SBG DRIVER - [Param] gps1 raw");
752  change = true;
753  }
754 
755  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_ODO_VEL,&pConf);
756  if(pConf != m_log_odo_vel){
757  pConf = (SbgEComOutputMode) m_log_odo_vel;
758  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_ODO_VEL, pConf);
759  ROS_INFO("SBG DRIVER - [Param] odo vel");
760  change = true;
761  }
762 
763  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_A,&pConf);
764  if(pConf != m_log_event_a){
765  pConf = (SbgEComOutputMode) m_log_event_a;
766  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_A, pConf);
767  ROS_INFO("SBG DRIVER - [Param] event a");
768  change = true;
769  }
770 
771  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_B,&pConf);
772  if(pConf != m_log_event_b){
773  pConf = (SbgEComOutputMode) m_log_event_b;
774  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_B, pConf);
775  ROS_INFO("SBG DRIVER - [Param] event b");
776  change = true;
777  }
778 
779  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_C,&pConf);
780  if(pConf != m_log_event_c){
781  pConf = (SbgEComOutputMode) m_log_event_c;
782  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_C, pConf);
783  ROS_INFO("SBG DRIVER - [Param] event c");
784  change = true;
785  }
786 
787  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_D,&pConf);
788  if(pConf != m_log_event_d){
789  pConf = (SbgEComOutputMode) m_log_event_d;
790  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_EVENT_D, pConf);
791  ROS_INFO("SBG DRIVER - [Param] event d");
792  change = true;
793  }
794 
795  sbgEComCmdOutputGetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_PRESSURE,&pConf);
796  if(pConf != m_log_pressure){
797  pConf = (SbgEComOutputMode) m_log_pressure;
798  sbgEComCmdOutputSetConf(&m_comHandle, m_portOutput, SBG_ECOM_CLASS_LOG_ECOM_0, SBG_ECOM_LOG_PRESSURE, pConf);
799  ROS_INFO("SBG DRIVER - [Param] log pressure");
800  change = true;
801  }
802 
803  return change;
804 }
805 
806 
808  SbgErrorCode errorCode = sbgEComCmdMagStartCalib(&m_comHandle, (SbgEComMagCalibMode)m_magnetic_calibration_mode, (SbgEComMagCalibBandwidth)m_magnetic_calibration_bandwidth);
809  if (errorCode != SBG_NO_ERROR){
810  ROS_WARN("SBG DRIVER - sbgEComCmdMagStartCalib Error : %s", sbgErrorCodeToString(errorCode));
811  return false;
812  }else{
813  ROS_INFO("SBG DRIVER - MAG CALIBRATION Start calibration");
814  ROS_INFO("SBG DRIVER - MAG CALIBRATION mode : %s", MAG_CALIB_MODE[(SbgEComMagCalibMode)m_magnetic_calibration_mode].c_str());
815  ROS_INFO("SBG DRIVER - MAG CALIBRATION bandwidth : %s", MAG_CALIB_BW[(SbgEComMagCalibBandwidth)m_magnetic_calibration_bandwidth].c_str());
816  return true;
817  }
818 }
819 
821  SbgErrorCode errorCode = sbgEComCmdMagComputeCalib(&m_comHandle, &m_magCalibResults);
822  if (errorCode != SBG_NO_ERROR){
823  ROS_WARN("SBG DRIVER - sbgEComCmdMagStartCalib Error : %s", sbgErrorCodeToString(errorCode));
824  return false;
825  }
826 
827  ROS_INFO("SBG DRIVER - MAG CALIBRATION - %s", MAG_CALIB_QUAL[m_magCalibResults.quality].c_str());
828  ROS_INFO("SBG DRIVER - MAG CALIBRATION - %s", MAG_CALIB_CONF[m_magCalibResults.confidence].c_str());
829 
831 
832  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS)
833  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Not enough valid points. Maybe you are moving too fast");
834  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS)
835  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Unable to find a calibration solution. Maybe there are too much non static distortions");
836  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE)
837  ROS_WARN("SBG DRIVER - MAG CALIBRATION - The magnetic calibration has troubles to correct the magnetometers and inertial frame alignment");
838  if(m_magnetic_calibration_mode == SBG_ECOM_MAG_CALIB_MODE_2D){
839  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE)
840  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Too much roll motion for a 2D magnetic calibration");
841  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE)
842  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Too much pitch motion for a 2D magnetic calibration");
843  }
844  else{
845  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE)
846  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Not enough roll motion for a 3D magnetic calibration");
847  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE)
848  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Not enough pitch motion for a 3D magnetic calibration.");
849  }
850  if(m_magCalibResults.advancedStatus & SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE)
851  ROS_WARN("SBG DRIVER - MAG CALIBRATION - Not enough yaw motion to compute a valid magnetic calibration");
852 
854 
855  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Used Points: %u", m_magCalibResults.numPoints);
856  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Max Points: %u", m_magCalibResults.maxNumPoints);
857  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Mean, Std, Max");
858  ROS_INFO("SBG DRIVER - MAG CALIBRATION - [Before] %.2f %.2f %.2f", m_magCalibResults.beforeMeanError, m_magCalibResults.beforeStdError, m_magCalibResults.beforeMaxError);
859  ROS_INFO("SBG DRIVER - MAG CALIBRATION - [After] %.2f %.2f %.2f", m_magCalibResults.afterMeanError, m_magCalibResults.afterStdError, m_magCalibResults.afterMaxError);
860  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Accuracy (deg) %0.2f %0.2f %0.2f", sbgRadToDegF(m_magCalibResults.meanAccuracy), sbgRadToDegF(m_magCalibResults.stdAccuracy), sbgRadToDegF(m_magCalibResults.maxAccuracy));
861 
863 
864  ostringstream oss;
865  oss << "mag_calib";
866  oss << timeToStr(ros::WallTime::now());
867  oss << ".txt";
868 
869  ofstream save_file;
870  save_file.open(oss.str());
871  save_file << "Parameters" << endl;
872  save_file << "* CALIB_MODE = " << MAG_CALIB_MODE[(SbgEComMagCalibMode)m_magnetic_calibration_mode] << endl;
873  save_file << "* CALIB_BW = " << MAG_CALIB_BW[(SbgEComMagCalibBandwidth)m_magnetic_calibration_bandwidth] << endl;
874  save_file << "============================" << endl;
875  save_file << "Results" << endl;
876  save_file << MAG_CALIB_QUAL[m_magCalibResults.quality] << endl;
877  save_file << MAG_CALIB_CONF[m_magCalibResults.confidence] << endl;
878  save_file << "Infos" << endl;
879  save_file << "* Used Points : " << m_magCalibResults.numPoints << "/" << m_magCalibResults.maxNumPoints << endl;
880  save_file << "* Mean, Std, Max" << endl;
881  save_file << " [Before] " << m_magCalibResults.beforeMeanError << " " << m_magCalibResults.beforeStdError << " " << m_magCalibResults.beforeMaxError << endl;
882  save_file << " [After] " << m_magCalibResults.afterMeanError << " " << m_magCalibResults.afterStdError << " " << m_magCalibResults.afterMaxError << endl;
883  save_file << " [Accuracy] " << sbgRadToDegF(m_magCalibResults.meanAccuracy) << " " << sbgRadToDegF(m_magCalibResults.stdAccuracy) << " " << sbgRadToDegF(m_magCalibResults.maxAccuracy);
884  save_file << "* Offset" << endl;
885  save_file << m_magCalibResults.offset[0] << "\t" << m_magCalibResults.offset[1] << "\t" << m_magCalibResults.offset[2] << endl;
886  save_file << "* Matrix" << endl;
887  save_file << m_magCalibResults.matrix[0] << "\t" << m_magCalibResults.matrix[1] << "\t" << m_magCalibResults.matrix[2] << endl;
888  save_file << m_magCalibResults.matrix[3] << "\t" << m_magCalibResults.matrix[4] << "\t" << m_magCalibResults.matrix[5] << endl;
889  save_file << m_magCalibResults.matrix[6] << "\t" << m_magCalibResults.matrix[7] << "\t" << m_magCalibResults.matrix[8] << endl;
890  save_file.close();
891  const std::string tmp = oss.str();
892  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Saving data to %s", tmp.c_str());
893 
894  return true;
895 }
896 
898  SbgErrorCode errorCode = sbgEComCmdMagSetCalibData(&m_comHandle, m_magCalibResults.offset, m_magCalibResults.matrix);
899  if (errorCode != SBG_NO_ERROR){
900  ROS_WARN("SBG DRIVER - sbgEComCmdMagSetCalibData Error : %s", sbgErrorCodeToString(errorCode));
901  return false;
902  }
903  else{
904  ROS_INFO("SBG DRIVER - MAG CALIBRATION - Saving data to the device");
905  return true;
906  }
907 }
SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float leverArm[3])
SbgErrorCode sbgEComCmdMagGetModelInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
Definition: sbgEComCmdMag.c:29
SbgEComAxisDirection axisDirectionX
void read_ecom_log_event(sbg_driver::SbgEvent &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdGnss1SetRejection(SbgEComHandle *pHandle, const SbgEComGnssRejectionConf *pRejectConf)
SbgEComRejectionMode velocity
SbgErrorCode sbgEComCmdOdoGetConf(SbgEComHandle *pHandle, SbgEComOdoConf *pOdometerConf)
Definition: sbgEComCmdOdo.c:14
SbgErrorCode sbgEComCmdGnss1SetLeverArmAlignment(SbgEComHandle *pHandle, const SbgEComGnssAlignmentInfo *pAlignConf)
sbg_driver::SbgEvent m_sbgEventD_msg
Definition: ellipse.h:71
SbgEComModulePortAssignment gps1Port
bool set_cmd_mag_model()
Definition: ellipse.cpp:526
bool m_new_sbgMag
Definition: ellipse.h:82
void read_ecom_log_gps_pos(sbg_driver::SbgGpsPos &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdSettingsAction(SbgEComHandle *pHandle, SbgEComSettingsAction action)
unsigned int uint32
Definition: sbgTypes.h:58
bool m_new_sbgEventB
Definition: ellipse.h:90
bool end_mag_calibration()
Definition: ellipse.cpp:820
bool m_new_sbgGpsRaw
Definition: ellipse.h:87
bool save_mag_calibration()
Definition: ellipse.cpp:897
SbgErrorCode sbgEComCmdSensorGetAidingAssignment(SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf)
bool set_cmd_init_parameters()
Definition: ellipse.cpp:446
sbg_driver::SbgMag m_sbgMag_msg
Definition: ellipse.h:61
bool m_new_sbgShipMotion
Definition: ellipse.h:81
f
bool set_cmd_gnss_lever_arm()
Definition: ellipse.cpp:560
SbgErrorCode sbgEComCmdOutputSetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode conf)
SbgEComAxisDirection axisDirectionY
void publish()
Definition: ellipse.cpp:242
enum _SbgEComMagCalibMode SbgEComMagCalibMode
sbg_driver::SbgEkfQuat m_sbgEkfQuat_msg
Definition: ellipse.h:58
bool m_new_sbgPressure
Definition: ellipse.h:93
static std::map< SbgEComMagCalibConfidence, std::string > MAG_CALIB_CONF
Definition: ellipse.h:216
SbgErrorCode sbgEComCmdSensorGetMotionProfileInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
bool set_cmd_gnss_reject_mode()
Definition: ellipse.cpp:582
void read_ecom_log_imu_data(sbg_driver::SbgImuData &msg, const SbgBinaryLogData *pLogData)
Definition: ellipse_msg.cpp:59
bool set_cmd_aiding_assignement()
Definition: ellipse.cpp:507
SbgErrorCode sbgEComCmdMagStartCalib(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth)
sbg_driver::SbgOdoVel m_sbgOdoVel_msg
Definition: ellipse.h:67
SbgEComRejectionMode hdt
Ellipse(ros::NodeHandle *n)
Definition: ellipse.cpp:29
SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float leverArm[3])
SbgEComRejectionMode velocity
Definition: sbgEComCmdOdo.h:48
enum _SbgEComMagCalibBandwidth SbgEComMagCalibBandwidth
enum _SbgEComRejectionMode SbgEComRejectionMode
bool m_new_sbgGpsPos
Definition: ellipse.h:85
void read_ecom_log_gps_hdt(sbg_driver::SbgGpsHdt &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdMagSetModelId(SbgEComHandle *pHandle, uint32 id)
Definition: sbgEComCmdMag.c:15
#define ROS_WARN(...)
void read_ecom_log_ekf_quat(sbg_driver::SbgEkfQuat &msg, const SbgBinaryLogData *pLogData)
void read_ecom_log_odo_vel(sbg_driver::SbgOdoVel &msg, const SbgBinaryLogData *pLogData)
#define SBG_ECOM_MAG_CALIB_Y_MOTION_ISSUE
Definition: sbgEComCmdMag.h:81
SbgErrorCode sbgInterfaceSerialDestroy(SbgInterface *pHandle)
bool m_new_sbgEventA
Definition: ellipse.h:89
sbg_driver::SbgUtcTime m_sbgUtcTime_msg
Definition: ellipse.h:55
static std::map< SbgEComMagCalibQuality, std::string > MAG_CALIB_QUAL
Definition: ellipse.h:212
bool m_new_sbgEkfNav
Definition: ellipse.h:80
bool m_new_sbgOdoVel
Definition: ellipse.h:88
SbgEComModuleSyncAssignment gps1Sync
SbgErrorCode sbgEComCmdGnss1GetLeverArmAlignment(SbgEComHandle *pHandle, SbgEComGnssAlignmentInfo *pAlignConf)
sbg_driver::SbgStatus m_sbgStatus_msg
Definition: ellipse.h:54
sbg_driver::SbgGpsVel m_sbgGpsVel_msg
Definition: ellipse.h:63
bool set_cmd_odom_reject_mode()
Definition: ellipse.cpp:635
SbgErrorCode sbgEComCmdSensorSetAidingAssignment(SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf)
enum _SbgEComModuleSyncAssignment SbgEComModuleSyncAssignment
SBG_INLINE float sbgRadToDegF(float angle)
Definition: sbgDefines.h:238
SBG_INLINE const char * sbgErrorCodeToString(SbgErrorCode errorCode)
Definition: sbgErrorCodes.h:71
sbg_driver::SbgEvent m_sbgEventA_msg
Definition: ellipse.h:68
sbg_driver::SbgEkfNav m_sbgEkfNav_msg
Definition: ellipse.h:59
enum _SbgEComOdometerPinAssignment SbgEComOdometerPinAssignment
SbgEComModulePortAssignment rtcmPort
void read_ecom_log_utc_time(sbg_driver::SbgUtcTime &msg, const SbgBinaryLogData *pLogData)
Definition: ellipse_msg.cpp:41
SbgErrorCode sbgEComCmdGnss1GetRejection(SbgEComHandle *pHandle, SbgEComGnssRejectionConf *pRejectConf)
void read_ecom_log_ship_motion(sbg_driver::SbgShipMotion &msg, const SbgBinaryLogData *pLogData)
bool set_cmd_mag_reject_mode()
Definition: ellipse.cpp:537
bool m_new_sbgEventC
Definition: ellipse.h:91
void read_ecom_log_status(sbg_driver::SbgStatus &msg, const SbgBinaryLogData *pLogData)
Definition: ellipse_msg.cpp:3
#define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS
Definition: sbgEComCmdMag.h:79
bool m_new_sbgStatus
Definition: ellipse.h:75
bool start_mag_calibration()
Definition: ellipse.cpp:807
~Ellipse()
Definition: ellipse.cpp:34
bool set_cmd_imu_lever_arm()
Definition: ellipse.cpp:479
#define ROS_INFO(...)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
bool m_new_sbgEkfQuat
Definition: ellipse.h:79
void configure()
Definition: ellipse.cpp:100
SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle)
Definition: sbgECom.c:176
void read_ecom_log_gps_raw(sbg_driver::SbgGpsRaw &msg, const SbgBinaryLogData *pLogData)
bool m_new_sbgEventD
Definition: ellipse.h:92
SbgErrorCode sbgEComCmdOdoSetRejection(SbgEComHandle *pHandle, const SbgEComOdoRejectionConf *pRejectConf)
SbgErrorCode sbgEComCmdSensorSetMotionProfileId(SbgEComHandle *pHandle, uint32 id)
void read_ecom_log_pressure(sbg_driver::SbgPressure &msg, const SbgBinaryLogData *pLogData)
void read_ecom_log_ekf_nav(sbg_driver::SbgEkfNav &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdSensorGetInitCondition(SbgEComHandle *pHandle, SbgEComInitConditionConf *pConf)
void read_ecom_log_mag_calib(sbg_driver::SbgMagCalib &msg, const SbgBinaryLogData *pLogData)
sbg_driver::SbgShipMotion m_sbgShipMotion_msg
Definition: ellipse.h:60
SbgEComOdometerPinAssignment odometerPinsConf
SbgErrorCode sbgInterfaceSerialCreate(SbgInterface *pHandle, const char *deviceName, uint32 baudRate)
sbg_driver::SbgImuData m_sbgImuData_msg
Definition: ellipse.h:56
SbgErrorCode sbgEComCmdOdoGetRejection(SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf)
sbg_driver::SbgMagCalib m_sbgMagCalib_msg
Definition: ellipse.h:62
SbgErrorCode sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
Definition: sbgECom.c:236
bool set_cmd_odom_lever_arm()
Definition: ellipse.cpp:618
sbg_driver::SbgGpsHdt m_sbgGpsHdt_msg
Definition: ellipse.h:65
#define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS
Definition: sbgEComCmdMag.h:78
SbgErrorCode sbgEComCmdMagComputeCalib(SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults)
SbgErrorCode sbgEComCmdOutputGetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pConf)
sbg_driver::SbgGpsPos m_sbgGpsPos_msg
Definition: ellipse.h:64
uint8 SbgEComMsgId
Definition: sbgEComIds.h:278
bool m_new_sbgEkfEuler
Definition: ellipse.h:78
std::string timeToStr(ros::WallTime ros_t)
Definition: ellipse.cpp:19
SbgErrorCode sbgEComCmdGnss1GetModelInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
#define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE
Definition: sbgEComCmdMag.h:80
static std::map< int, int > MODE_DIV_2_FREQ
Definition: ellipse.h:210
enum _SbgEComAxisDirection SbgEComAxisDirection
enum _SbgEComModulePortAssignment SbgEComModulePortAssignment
void save_config()
Definition: ellipse.cpp:122
static WallTime now()
SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float offset[3], const float matrix[9])
Definition: sbgEComCmdMag.c:61
bool set_cmd_output()
Definition: ellipse.cpp:647
enum _SbgEComOutputPort SbgEComOutputPort
bool m_new_sbgGpsVel
Definition: ellipse.h:84
void connect()
Definition: ellipse.cpp:39
unsigned char uint8
Definition: sbgTypes.h:56
bool set_cmd_odom_conf()
Definition: ellipse.cpp:600
sbg_driver::SbgEkfEuler m_sbgEkfEuler_msg
Definition: ellipse.h:57
void init_publishers()
Definition: ellipse.cpp:59
sbg_driver::SbgGpsRaw m_sbgGpsRaw_msg
Definition: ellipse.h:66
bool set_cmd_gnss_model()
Definition: ellipse.cpp:549
void read_ecom_log_ekf_euler(sbg_driver::SbgEkfEuler &msg, const SbgBinaryLogData *pLogData)
#define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE
Definition: sbgEComCmdMag.h:82
enum _SbgEComClass SbgEComClass
void init_callback()
Definition: ellipse.cpp:54
void read_get_info(SbgEComHandle *comHandle)
void load_param()
Definition: ellipse.cpp:131
bool m_new_sbgImuData
Definition: ellipse.h:77
SbgEComRejectionMode magneticField
#define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE
Definition: sbgEComCmdMag.h:83
SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float leverArm[3])
SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf)
Definition: sbgEComCmdOdo.c:96
SbgErrorCode sbgEComCmdMagGetRejection(SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf)
SbgEComRejectionMode position
enum _SbgEComOutputMode SbgEComOutputMode
sbg_driver::SbgPressure m_sbgPressure_msg
Definition: ellipse.h:72
static std::map< SbgEComMagCalibBandwidth, std::string > MAG_CALIB_BW
Definition: ellipse.h:223
unsigned short uint16
Definition: sbgTypes.h:57
bool m_new_sbgGpsHdt
Definition: ellipse.h:86
SbgErrorCode sbgEComCmdSensorSetInitCondition(SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf)
SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface)
Definition: sbgECom.c:20
void read_ecom_log_mag(sbg_driver::SbgMag &msg, const SbgBinaryLogData *pLogData)
bool set_cmd_motion_profile()
Definition: ellipse.cpp:468
SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf)
enum _SbgErrorCode SbgErrorCode
bool m_new_sbgMagCalib
Definition: ellipse.h:83
SbgErrorCode sbgEComClose(SbgEComHandle *pHandle)
Definition: sbgECom.c:60
sbg_driver::SbgEvent m_sbgEventB_msg
Definition: ellipse.h:69
SbgErrorCode onLogReceived(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
Definition: ellipse.cpp:341
sbg_driver::SbgEvent m_sbgEventC_msg
Definition: ellipse.h:70
static std::map< SbgEComMagCalibMode, std::string > MAG_CALIB_MODE
Definition: ellipse.h:220
void read_ecom_log_gps_vel(sbg_driver::SbgGpsVel &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float leverArm[3])
bool m_new_sbgUtcTime
Definition: ellipse.h:76


sbg_driver
Author(s):
autogenerated on Sun Jan 27 2019 03:42:19