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> 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));
47 errorCode =
sbgEComInit(&m_comHandle, &m_sbgInterface);
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);
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);
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);
87 m_sbgOdoVel_pub = m_node->advertise<sbg_driver::SbgOdoVel>(
"odo_vel",10);
89 m_sbgEventA_pub = m_node->advertise<sbg_driver::SbgEvent>(
"eventA",10);
91 m_sbgEventB_pub = m_node->advertise<sbg_driver::SbgEvent>(
"eventB",10);
93 m_sbgEventC_pub = m_node->advertise<sbg_driver::SbgEvent>(
"eventC",10);
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);
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();
123 ROS_INFO(
"SBG DRIVER - The configuration of the Ellipse was updated according to the configuration file");
128 ROS_INFO(
"SBG DRIVER - SAVED & REBOOT");
133 m_uartPortName = n_private.
param<std::string>(
"uartConf/portName",
"/dev/ttyUSB0");
134 m_uartBaudRate = (
uint32) n_private.
param<
int>(
"uartConf/baudRate", 115200);
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);
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);
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);
159 m_magModelId = (
uint32) n_private.
param<
int>(
"magnetometer/magnetometerModel", 201);
160 m_magRejectMode = n_private.
param<
int>(
"magnetometer/magnetometerRejectMode", 1);
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);
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);
181 m_timeReference = (
uint8)n_private.
param<
int>(
"output/timeReference",0);
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);
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);
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);
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];
235 if(mod_div_min>=10000)
244 if(m_new_sbgStatus && m_log_status != 0){
245 m_new_sbgStatus =
false;
246 m_sbgStatus_pub.publish(m_sbgStatus_msg);
249 if(m_new_sbgUtcTime && m_log_utc_time != 0){
250 m_new_sbgUtcTime =
false;
251 m_sbgUtcTime_pub.publish(m_sbgUtcTime_msg);
254 if(m_new_sbgImuData && m_log_imu_data != 0){
255 m_new_sbgImuData =
false;
256 m_sbgImuData_pub.publish(m_sbgImuData_msg);
259 if(m_new_sbgEkfEuler && m_log_ekf_euler != 0){
260 m_new_sbgEkfEuler =
false;
261 m_sbgEkfEuler_pub.publish(m_sbgEkfEuler_msg);
264 if(m_new_sbgEkfQuat && m_log_ekf_quat != 0){
265 m_new_sbgEkfQuat =
false;
266 m_sbgEkfQuat_pub.publish(m_sbgEkfQuat_msg);
269 if(m_new_sbgEkfNav && m_log_ekf_nav != 0){
270 m_new_sbgEkfNav =
false;
271 m_sbgEkfNav_pub.publish(m_sbgEkfNav_msg);
274 if(m_new_sbgShipMotion && m_log_ship_motion != 0){
275 m_new_sbgShipMotion =
false;
276 m_sbgShipMotion_pub.publish(m_sbgShipMotion_msg);
279 if(m_new_sbgMag && m_log_mag != 0){
280 m_new_sbgMag =
false;
281 m_sbgMag_pub.publish(m_sbgMag_msg);
284 if(m_new_sbgMagCalib && m_log_mag_calib != 0){
285 m_new_sbgMagCalib =
false;
286 m_sbgMagCalib_pub.publish(m_sbgMagCalib_msg);
289 if(m_new_sbgGpsVel && m_log_gps1_vel != 0){
290 m_new_sbgGpsVel =
false;
291 m_sbgGpsVel_pub.publish(m_sbgGpsVel_msg);
294 if(m_new_sbgGpsPos && m_log_gps1_pos != 0){
295 m_new_sbgGpsPos =
false;
296 m_sbgGpsPos_pub.publish(m_sbgGpsPos_msg);
299 if(m_new_sbgGpsHdt && m_log_gps1_hdt != 0){
300 m_new_sbgGpsHdt =
false;
301 m_sbgGpsHdt_pub.publish(m_sbgGpsHdt_msg);
304 if(m_new_sbgGpsRaw && m_log_gps1_raw != 0){
305 m_new_sbgGpsRaw =
false;
306 m_sbgGpsRaw_pub.publish(m_sbgGpsRaw_msg);
309 if(m_new_sbgOdoVel && m_log_odo_vel != 0){
310 m_new_sbgOdoVel =
false;
311 m_sbgOdoVel_pub.publish(m_sbgOdoVel_msg);
314 if(m_new_sbgEventA && m_log_event_a != 0){
315 m_new_sbgEventA =
false;
316 m_sbgEventA_pub.publish(m_sbgEventA_msg);
319 if(m_new_sbgEventB && m_log_event_b != 0){
320 m_new_sbgEventB =
false;
321 m_sbgEventB_pub.publish(m_sbgEventB_msg);
324 if(m_new_sbgEventC && m_log_event_c != 0){
325 m_new_sbgEventC =
false;
326 m_sbgEventC_pub.publish(m_sbgEventC_msg);
329 if(m_new_sbgEventD && m_log_event_d != 0){
330 m_new_sbgEventD =
false;
331 m_sbgEventD_pub.publish(m_sbgEventD_msg);
334 if(m_new_sbgPressure && m_log_pressure != 0){
335 m_new_sbgPressure =
false;
336 m_sbgPressure_pub.publish(m_sbgPressure_msg);
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;
460 init_condition.
altitude = m_initAlt;
462 ROS_INFO(
"SBG DRIVER - [Param] New init");
471 if(motion_profile.
id != m_motionProfileId){
473 ROS_INFO(
"SBG DRIVER - [Param] motion profile");
484 if(leverArm[0] != m_imuLeverArm[0]
485 || leverArm[1] != m_imuLeverArm[1]
486 || leverArm[2] != m_imuLeverArm[2]
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];
497 pAlignConf.
misRoll = m_imuMisRoll;
498 pAlignConf.
misPitch = m_imuMisPitch;
499 pAlignConf.
misYaw = m_imuMisYaw ;
501 ROS_INFO(
"SBG DRIVER - [Param] imu lever arm");
511 if(aidingAssign.
gps1Port != m_gnss1ModulePortAssignment
512 || aidingAssign.
gps1Sync != m_gnss1ModuleSyncAssignment
514 || aidingAssign.
rtcmPort != m_rtcmPortAssignment){
520 ROS_INFO(
"SBG DRIVER - [Param] Aiding assignement");
529 if(model_info.
id != m_magModelId){
531 ROS_INFO(
"SBG DRIVER - [Param] Mag model");
543 ROS_INFO(
"SBG DRIVER - [Param] Mag reject mode");
552 if(model_info.
id != m_gnssModelId){
554 ROS_INFO(
"SBG DRIVER - [Param] gnss model");
564 || pAlignInfo.
leverArmX != m_gnss1LeverArmX
565 || pAlignInfo.
leverArmY != m_gnss1LeverArmY
566 || pAlignInfo.
leverArmZ != m_gnss1LeverArmZ
568 || pAlignInfo.
yawOffset != m_gnss1YawOffset ){
574 pAlignInfo.
yawOffset = m_gnss1YawOffset ;
576 ROS_INFO(
"SBG DRIVER - [Param] Gnss lever arm");
586 if(rejection.
hdt != m_gnss1HdtRejectMode
587 || rejection.
position != m_gnss1PosRejectMode
588 || rejection.
velocity != m_gnss1VelRejectMode){
594 ROS_INFO(
"SBG DRIVER - [Param] gnss reject mode");
604 if(odom.
gain != m_odomGain
608 odom.
gain = m_odomGain;
612 ROS_INFO(
"SBG DRIVER - [Param] odom conf");
621 if(leverArm[0] != m_odomLever[0]
622 || leverArm[1] != m_odomLever[1]
623 || leverArm[2] != m_odomLever[2]
625 leverArm[0] = m_odomLever[0];
626 leverArm[1] = m_odomLever[1];
627 leverArm[2] = m_odomLever[2];
629 ROS_INFO(
"SBG DRIVER - [Param] odom lever arm ");
638 if(rejection.
velocity != m_odomRejectMode){
641 ROS_INFO(
"SBG DRIVER - [Param] odom reject mode");
652 if(pConf != m_log_status){
655 ROS_INFO(
"SBG DRIVER - [Param] log status");
660 if(pConf != m_log_utc_time){
663 ROS_INFO(
"SBG DRIVER - [Param] log utc");
668 if(pConf != m_log_imu_data){
671 ROS_INFO(
"SBG DRIVER - [Param] log imu data");
676 if(pConf != m_log_ekf_euler){
679 ROS_INFO(
"SBG DRIVER - [Param] log ekf euler");
684 if(pConf != m_log_ekf_quat){
687 ROS_INFO(
"SBG DRIVER - [Param] log ekf quat");
692 if(pConf != m_log_ekf_nav){
695 ROS_INFO(
"SBG DRIVER - [Param] log ekf nav");
700 if(pConf != m_log_ship_motion){
703 ROS_INFO(
"SBG DRIVER - [Param] ship motion");
708 if(pConf != m_log_mag){
711 ROS_INFO(
"SBG DRIVER - [Param] log mag");
716 if(pConf != m_log_mag_calib){
719 ROS_INFO(
"SBG DRIVER - [Param] mag calib");
724 if(pConf != m_log_gps1_vel){
727 ROS_INFO(
"SBG DRIVER - [Param] gps1 vel");
732 if(pConf != m_log_gps1_pos){
735 ROS_INFO(
"SBG DRIVER - [Param] gps1 pos");
740 if(pConf != m_log_gps1_hdt){
743 ROS_INFO(
"SBG DRIVER - [Param] gps1 hdt");
748 if(pConf != m_log_gps1_raw){
751 ROS_INFO(
"SBG DRIVER - [Param] gps1 raw");
756 if(pConf != m_log_odo_vel){
759 ROS_INFO(
"SBG DRIVER - [Param] odo vel");
764 if(pConf != m_log_event_a){
767 ROS_INFO(
"SBG DRIVER - [Param] event a");
772 if(pConf != m_log_event_b){
775 ROS_INFO(
"SBG DRIVER - [Param] event b");
780 if(pConf != m_log_event_c){
783 ROS_INFO(
"SBG DRIVER - [Param] event c");
788 if(pConf != m_log_event_d){
791 ROS_INFO(
"SBG DRIVER - [Param] event d");
796 if(pConf != m_log_pressure){
799 ROS_INFO(
"SBG DRIVER - [Param] log pressure");
813 ROS_INFO(
"SBG DRIVER - MAG CALIBRATION Start calibration");
833 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Not enough valid points. Maybe you are moving too fast");
835 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Unable to find a calibration solution. Maybe there are too much non static distortions");
837 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - The magnetic calibration has troubles to correct the magnetometers and inertial frame alignment");
840 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Too much roll motion for a 2D magnetic calibration");
842 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Too much pitch motion for a 2D magnetic calibration");
846 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Not enough roll motion for a 3D magnetic calibration");
848 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Not enough pitch motion for a 3D magnetic calibration.");
851 ROS_WARN(
"SBG DRIVER - MAG CALIBRATION - Not enough yaw motion to compute a valid magnetic calibration");
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);
870 save_file.open(oss.str());
871 save_file <<
"Parameters" << endl;
874 save_file <<
"============================" << endl;
875 save_file <<
"Results" << 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;
891 const std::string tmp = oss.str();
892 ROS_INFO(
"SBG DRIVER - MAG CALIBRATION - Saving data to %s", tmp.c_str());
904 ROS_INFO(
"SBG DRIVER - MAG CALIBRATION - Saving data to the device");
SbgErrorCode sbgEComCmdSensorSetAlignmentAndLeverArm(SbgEComHandle *pHandle, const SbgEComSensorAlignmentInfo *pAlignConf, const float leverArm[3])
SbgErrorCode sbgEComCmdMagGetModelInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
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)
SbgErrorCode sbgEComCmdGnss1SetLeverArmAlignment(SbgEComHandle *pHandle, const SbgEComGnssAlignmentInfo *pAlignConf)
sbg_driver::SbgEvent m_sbgEventD_msg
SbgEComModulePortAssignment gps1Port
void read_ecom_log_gps_pos(sbg_driver::SbgGpsPos &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdSettingsAction(SbgEComHandle *pHandle, SbgEComSettingsAction action)
bool end_mag_calibration()
bool save_mag_calibration()
SbgErrorCode sbgEComCmdSensorGetAidingAssignment(SbgEComHandle *pHandle, SbgEComAidingAssignConf *pConf)
bool set_cmd_init_parameters()
sbg_driver::SbgMag m_sbgMag_msg
bool set_cmd_gnss_lever_arm()
SbgErrorCode sbgEComCmdOutputSetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode conf)
SbgEComAxisDirection axisDirectionY
enum _SbgEComMagCalibMode SbgEComMagCalibMode
sbg_driver::SbgEkfQuat m_sbgEkfQuat_msg
static std::map< SbgEComMagCalibConfidence, std::string > MAG_CALIB_CONF
SbgErrorCode sbgEComCmdSensorGetMotionProfileInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
bool set_cmd_gnss_reject_mode()
void read_ecom_log_imu_data(sbg_driver::SbgImuData &msg, const SbgBinaryLogData *pLogData)
bool set_cmd_aiding_assignement()
SbgErrorCode sbgEComCmdMagStartCalib(SbgEComHandle *pHandle, SbgEComMagCalibMode mode, SbgEComMagCalibBandwidth bandwidth)
sbg_driver::SbgOdoVel m_sbgOdoVel_msg
Ellipse(ros::NodeHandle *n)
SbgErrorCode sbgEComCmdOdoGetLeverArm(SbgEComHandle *pHandle, float leverArm[3])
SbgEComRejectionMode velocity
enum _SbgEComMagCalibBandwidth SbgEComMagCalibBandwidth
enum _SbgEComRejectionMode SbgEComRejectionMode
void read_ecom_log_gps_hdt(sbg_driver::SbgGpsHdt &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdMagSetModelId(SbgEComHandle *pHandle, uint32 id)
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
SbgErrorCode sbgInterfaceSerialDestroy(SbgInterface *pHandle)
sbg_driver::SbgUtcTime m_sbgUtcTime_msg
static std::map< SbgEComMagCalibQuality, std::string > MAG_CALIB_QUAL
SbgEComModuleSyncAssignment gps1Sync
SbgErrorCode sbgEComCmdGnss1GetLeverArmAlignment(SbgEComHandle *pHandle, SbgEComGnssAlignmentInfo *pAlignConf)
sbg_driver::SbgStatus m_sbgStatus_msg
sbg_driver::SbgGpsVel m_sbgGpsVel_msg
bool set_cmd_odom_reject_mode()
SbgErrorCode sbgEComCmdSensorSetAidingAssignment(SbgEComHandle *pHandle, const SbgEComAidingAssignConf *pConf)
enum _SbgEComModuleSyncAssignment SbgEComModuleSyncAssignment
SBG_INLINE float sbgRadToDegF(float angle)
SBG_INLINE const char * sbgErrorCodeToString(SbgErrorCode errorCode)
sbg_driver::SbgEvent m_sbgEventA_msg
sbg_driver::SbgEkfNav m_sbgEkfNav_msg
enum _SbgEComOdometerPinAssignment SbgEComOdometerPinAssignment
SbgEComModulePortAssignment rtcmPort
void read_ecom_log_utc_time(sbg_driver::SbgUtcTime &msg, const SbgBinaryLogData *pLogData)
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()
void read_ecom_log_status(sbg_driver::SbgStatus &msg, const SbgBinaryLogData *pLogData)
#define SBG_ECOM_MAG_CALIB_TOO_MUCH_DISTORTIONS
bool start_mag_calibration()
bool set_cmd_imu_lever_arm()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle)
void read_ecom_log_gps_raw(sbg_driver::SbgGpsRaw &msg, const SbgBinaryLogData *pLogData)
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
SbgEComOdometerPinAssignment odometerPinsConf
SbgErrorCode sbgInterfaceSerialCreate(SbgInterface *pHandle, const char *deviceName, uint32 baudRate)
sbg_driver::SbgImuData m_sbgImuData_msg
SbgErrorCode sbgEComCmdOdoGetRejection(SbgEComHandle *pHandle, SbgEComOdoRejectionConf *pRejectConf)
sbg_driver::SbgMagCalib m_sbgMagCalib_msg
SbgErrorCode sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
bool set_cmd_odom_lever_arm()
sbg_driver::SbgGpsHdt m_sbgGpsHdt_msg
#define SBG_ECOM_MAG_CALIB_NOT_ENOUGH_POINTS
SbgErrorCode sbgEComCmdMagComputeCalib(SbgEComHandle *pHandle, SbgEComMagCalibResults *pCalibResults)
SbgErrorCode sbgEComCmdOutputGetConf(SbgEComHandle *pHandle, SbgEComOutputPort outputPort, SbgEComClass classId, SbgEComMsgId msgId, SbgEComOutputMode *pConf)
sbg_driver::SbgGpsPos m_sbgGpsPos_msg
std::string timeToStr(ros::WallTime ros_t)
SbgErrorCode sbgEComCmdGnss1GetModelInfo(SbgEComHandle *pHandle, SbgEComModelInfo *pModelInfo)
#define SBG_ECOM_MAG_CALIB_X_MOTION_ISSUE
static std::map< int, int > MODE_DIV_2_FREQ
enum _SbgEComAxisDirection SbgEComAxisDirection
enum _SbgEComModulePortAssignment SbgEComModulePortAssignment
SbgErrorCode sbgEComCmdMagSetCalibData(SbgEComHandle *pHandle, const float offset[3], const float matrix[9])
enum _SbgEComOutputPort SbgEComOutputPort
sbg_driver::SbgEkfEuler m_sbgEkfEuler_msg
sbg_driver::SbgGpsRaw m_sbgGpsRaw_msg
bool set_cmd_gnss_model()
void read_ecom_log_ekf_euler(sbg_driver::SbgEkfEuler &msg, const SbgBinaryLogData *pLogData)
#define SBG_ECOM_MAG_CALIB_Z_MOTION_ISSUE
enum _SbgEComClass SbgEComClass
void read_get_info(SbgEComHandle *comHandle)
SbgEComRejectionMode magneticField
#define SBG_ECOM_MAG_CALIB_ALIGNMENT_ISSUE
SbgErrorCode sbgEComCmdOdoSetLeverArm(SbgEComHandle *pHandle, const float leverArm[3])
SbgErrorCode sbgEComCmdOdoSetConf(SbgEComHandle *pHandle, const SbgEComOdoConf *pOdometerConf)
SbgErrorCode sbgEComCmdMagGetRejection(SbgEComHandle *pHandle, SbgEComMagRejectionConf *pRejectConf)
SbgEComRejectionMode position
enum _SbgEComOutputMode SbgEComOutputMode
sbg_driver::SbgPressure m_sbgPressure_msg
static std::map< SbgEComMagCalibBandwidth, std::string > MAG_CALIB_BW
SbgErrorCode sbgEComCmdSensorSetInitCondition(SbgEComHandle *pHandle, const SbgEComInitConditionConf *pConf)
SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface)
void read_ecom_log_mag(sbg_driver::SbgMag &msg, const SbgBinaryLogData *pLogData)
bool set_cmd_motion_profile()
SbgErrorCode sbgEComCmdMagSetRejection(SbgEComHandle *pHandle, const SbgEComMagRejectionConf *pRejectConf)
enum _SbgErrorCode SbgErrorCode
SbgErrorCode sbgEComClose(SbgEComHandle *pHandle)
sbg_driver::SbgEvent m_sbgEventB_msg
SbgErrorCode onLogReceived(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
sbg_driver::SbgEvent m_sbgEventC_msg
static std::map< SbgEComMagCalibMode, std::string > MAG_CALIB_MODE
void read_ecom_log_gps_vel(sbg_driver::SbgGpsVel &msg, const SbgBinaryLogData *pLogData)
SbgErrorCode sbgEComCmdSensorGetAlignmentAndLeverArm(SbgEComHandle *pHandle, SbgEComSensorAlignmentInfo *pAlignConf, float leverArm[3])