inertial_sense_ros.cpp
Go to the documentation of this file.
1 #include "inertial_sense_ros.h"
2 #include <chrono>
3 #include <stddef.h>
4 #include <unistd.h>
5 #include <tf/tf.h>
6 #include <ros/console.h>
7 #include <ISPose.h>
8 
10  nh_(), nh_private_("~"), initialized_(false)
11 {
12  connect();
14 
21 
23  configure_rtk();
25 
26  nh_private_.param<bool>("enable_log", log_enabled_, false);
27  if (log_enabled_)
28  {
29  start_log();//start log should always happen last, does not all stop all message streams.
30  }
31 
32 
33 // configure_ascii_output(); //does not work right now
34 
35  initialized_ = true;
36 }
37 
38 
40 {
41  SET_CALLBACK(DID_GPS1_POS, gps_pos_t, GPS_pos_callback,1); // we always need GPS for Fix status
42  SET_CALLBACK(DID_GPS1_VEL, gps_vel_t, GPS_vel_callback,1); // we always need GPS for Fix status
44 
45 
46  nh_private_.param<bool>("stream_INS", INS_.enabled, true);
47  if (INS_.enabled)
48  {
49  INS_.pub = nh_.advertise<nav_msgs::Odometry>("ins", 1);
53 // SET_CALLBACK(DID_INL2_VARIANCE, nav_dt_ms, inl2_variance_t, INS_variance_callback);
54  }
55  nh_private_.param<bool>("publishTf", publishTf, true);
56  nh_private_.param<int>("LTCF", LTCF, NED);
57  // Set up the IMU ROS stream
58  nh_private_.param<bool>("stream_IMU", IMU_.enabled, true);
59 
60  //std::cout << "\n\n\n\n\n\n\n\n\n\n stream_GPS: " << GPS_.enabled << "\n\n\n\n\n\n\n\n\n\n\n";
61  if (IMU_.enabled)
62  {
63  IMU_.pub = nh_.advertise<sensor_msgs::Imu>("imu", 1);
67  }
68 
69  // Set up the IMU bias ROS stream
70  nh_private_.param<bool>("stream_INL2_states", INL2_states_.enabled, false);
72  {
73  INL2_states_.pub = nh_.advertise<inertial_sense_ros::INL2States>("inl2_states", 1);
75  }
76 
77  // Set up the GPS ROS stream - we always need GPS information for time sync, just don't always need to publish it
78  nh_private_.param<bool>("stream_GPS", GPS_.enabled, true);
79  if (GPS_.enabled)
80  GPS_.pub = nh_.advertise<inertial_sense_ros::GPS>("gps", 1);
81 
82  nh_private_.param<bool>("stream_GPS_raw", GPS_obs_.enabled, false);
83  nh_private_.param<bool>("stream_GPS_raw", GPS_eph_.enabled, false);
84  if (GPS_obs_.enabled)
85  {
86  GPS_obs_.pub = nh_.advertise<inertial_sense_ros::GNSSObsVec>("gps/obs", 50);
87  GPS_eph_.pub = nh_.advertise<inertial_sense_ros::GNSSEphemeris>("gps/eph", 50);
88  GPS_eph_.pub2 = nh_.advertise<inertial_sense_ros::GlonassEphemeris>("gps/geph", 50);
93  }
94 
95  // Set up the GPS info ROS stream
96  nh_private_.param<bool>("stream_GPS_info", GPS_info_.enabled, false);
97  if (GPS_info_.enabled)
98  {
99  GPS_info_.pub = nh_.advertise<inertial_sense_ros::GPSInfo>("gps/info", 1);
101  }
102 
103  // Set up the magnetometer ROS stream
104  nh_private_.param<bool>("stream_mag", mag_.enabled, false);
105  if (mag_.enabled)
106  {
107  mag_.pub = nh_.advertise<sensor_msgs::MagneticField>("mag", 1);
108  // mag_.pub2 = nh_.advertise<sensor_msgs::MagneticField>("mag2", 1);
110  }
111 
112  // Set up the barometer ROS stream
113  nh_private_.param<bool>("stream_baro", baro_.enabled, false);
114  if (baro_.enabled)
115  {
116  baro_.pub = nh_.advertise<sensor_msgs::FluidPressure>("baro", 1);
118  }
119 
120  // Set up the preintegrated IMU (coning and sculling integral) ROS stream
121  nh_private_.param<bool>("stream_preint_IMU", dt_vel_.enabled, false);
122  if (dt_vel_.enabled)
123  {
124  dt_vel_.pub = nh_.advertise<inertial_sense_ros::PreIntIMU>("preint_imu", 1);
126  }
127 
128  // Set up ROS dianostics for rqt_robot_monitor
129  nh_private_.param<bool>("stream_diagnostics", diagnostics_.enabled, true);
130  if (diagnostics_.enabled)
131  {
132  diagnostics_.pub = nh_.advertise<diagnostic_msgs::DiagnosticArray>("diagnostics", 1);
134  }
135 }
136 
138 {
140  ROS_INFO_STREAM("Creating log in " << filename << " folder");
142 }
143 
145 {
146  // int NMEA_rate = nh_private_.param<int>("NMEA_rate", 0);
147  // int NMEA_message_configuration = nh_private_.param<int>("NMEA_configuration", 0x00);
148  // int NMEA_message_ports = nh_private_.param<int>("NMEA_ports", 0x00);
149  // ascii_msgs_t msgs = {};
150  // msgs.options = (NMEA_message_ports & NMEA_SER0) ? RMC_OPTIONS_PORT_SER0 : 0; // output on serial 0
151  // msgs.options |= (NMEA_message_ports & NMEA_SER1) ? RMC_OPTIONS_PORT_SER1 : 0; // output on serial 1
152  // msgs.gpgga = (NMEA_message_configuration & NMEA_GPGGA) ? NMEA_rate : 0;
153  // msgs.gpgll = (NMEA_message_configuration & NMEA_GPGLL) ? NMEA_rate : 0;
154  // msgs.gpgsa = (NMEA_message_configuration & NMEA_GPGSA) ? NMEA_rate : 0;
155  // msgs.gprmc = (NMEA_message_configuration & NMEA_GPRMC) ? NMEA_rate : 0;
156  // IS_.SendData(DID_ASCII_BCAST_PERIOD, (uint8_t*)(&msgs), sizeof(ascii_msgs_t), 0);
157 
158 }
159 
161 {
162  nh_private_.param<std::string>("port", port_, "/dev/ttyUSB0");
163  nh_private_.param<int>("baudrate", baudrate_, 921600);
164  nh_private_.param<std::string>("frame_id", frame_id_, "body");
165 
167  ROS_INFO("Connecting to serial port \"%s\", at %d baud", port_.c_str(), baudrate_);
168  if (! IS_.Open(port_.c_str(), baudrate_))
169  {
170  ROS_FATAL("inertialsense: Unable to open serial port \"%s\", at %d baud", port_.c_str(), baudrate_);
171  exit(0);
172  }
173  else
174  {
175  // Print if Successful
176  ROS_INFO("Connected to uINS %d on \"%s\", at %d baud", IS_.GetDeviceInfo().serialNumber, port_.c_str(), baudrate_);
177  }
178 }
179 
181 {
182  // Make sure the navigation rate is right, if it's not, then we need to change and reset it.
183  int nav_dt_ms = IS_.GetFlashConfig().startupNavDtMs;
184  if (nh_private_.getParam("navigation_dt_ms", nav_dt_ms))
185  {
186  if (nav_dt_ms != IS_.GetFlashConfig().startupNavDtMs)
187  {
188  uint32_t data = nav_dt_ms;
189  IS_.SendData(DID_FLASH_CONFIG, (uint8_t*)(&data), sizeof(uint32_t), offsetof(nvm_flash_cfg_t, startupNavDtMs));
190  ROS_INFO("navigation rate change from %dms to %dms, resetting uINS to make change", IS_.GetFlashConfig().startupNavDtMs, nav_dt_ms);
191  sleep(3);
192  reset_device();
193  }
194  }
195 }
196 
198 {
199  set_vector_flash_config<float>("INS_rpy_radians", 3, offsetof(nvm_flash_cfg_t, insRotation));
200  set_vector_flash_config<float>("INS_xyz", 3, offsetof(nvm_flash_cfg_t, insOffset));
201  set_vector_flash_config<float>("GPS_ant1_xyz", 3, offsetof(nvm_flash_cfg_t, gps1AntOffset));
202  set_vector_flash_config<float>("GPS_ant2_xyz", 3, offsetof(nvm_flash_cfg_t, gps2AntOffset));
203  set_vector_flash_config<double>("GPS_ref_lla", 3, offsetof(nvm_flash_cfg_t, refLla));
204 
205  set_flash_config<float>("inclination", offsetof(nvm_flash_cfg_t, magInclination), 0.0f);
206  set_flash_config<float>("declination", offsetof(nvm_flash_cfg_t, magDeclination), 0.0f);
207  set_flash_config<int>("dynamic_model", offsetof(nvm_flash_cfg_t, insDynModel), 8);
208  set_flash_config<int>("ser1_baud_rate", offsetof(nvm_flash_cfg_t, ser1BaudRate), 921600);
209 }
210 
212 {
213  bool RTK_rover, RTK_rover_radio_enable, RTK_base, dual_GNSS;
214  std::string gps_type;
215  nh_private_.param<std::string>("gps_type", gps_type, "M8");
216  nh_private_.param<bool>("RTK_rover", RTK_rover, false);
217  nh_private_.param<bool>("RTK_rover_radio_enable", RTK_rover_radio_enable, false);
218  nh_private_.param<bool>("RTK_base", RTK_base, false);
219  nh_private_.param<bool>("dual_GNSS", dual_GNSS, false);
220  nh_private_.param<bool>("dual_GNSS", dual_GNSS, false);
221  std::string RTK_server_IP, RTK_correction_type;
222  int RTK_server_port;
223  nh_private_.param<std::string>("RTK_server_IP", RTK_server_IP, "127.0.0.1");
224  nh_private_.param<int>("RTK_server_port", RTK_server_port, 7777);
225  nh_private_.param<std::string>("RTK_correction_type", RTK_correction_type, "UBLOX");
226  ROS_ERROR_COND(RTK_rover && RTK_base, "unable to configure uINS to be both RTK rover and base - default to rover");
227  ROS_ERROR_COND(RTK_rover && dual_GNSS, "unable to configure uINS to be both RTK rover as dual GNSS - default to dual GNSS");
228 
229  uint32_t RTKCfgBits = 0;
230  if (dual_GNSS)
231  {
232  RTK_rover = false;
233  ROS_INFO("InertialSense: Configured as dual GNSS (compassing)");
238  RTK_.enabled = true;
239  RTK_.pub = nh_.advertise<inertial_sense_ros::RTKInfo>("RTK/info", 10);
240  RTK_.pub2 = nh_.advertise<inertial_sense_ros::RTKRel>("RTK/rel", 10);
241  }
242 
243  if (RTK_rover_radio_enable)
244  {
245  RTK_base = false;
246  ROS_INFO("InertialSense: Configured as RTK Rover with radio enabled");
249 
252  RTK_.enabled = true;
253  RTK_.pub = nh_.advertise<inertial_sense_ros::RTKInfo>("RTK/info", 10);
254  RTK_.pub2 = nh_.advertise<inertial_sense_ros::RTKRel>("RTK/rel", 10);
255  }
256  else if (RTK_rover)
257  {
258  RTK_base = false;
259  std::string RTK_connection = RTK_correction_type + ":" + RTK_server_IP + ":" + std::to_string(RTK_server_port);
260  ROS_INFO("InertialSense: Configured as RTK Rover");
263 
264  if (IS_.OpenServerConnection(RTK_connection))
265  ROS_INFO_STREAM("Successfully connected to " << RTK_connection << " RTK server");
266  else
267  ROS_ERROR_STREAM("Failed to connect to base server at " << RTK_connection);
268 
271  RTK_.enabled = true;
272  RTK_.pub = nh_.advertise<inertial_sense_ros::RTKInfo>("RTK/info", 10);
273  RTK_.pub2 = nh_.advertise<inertial_sense_ros::RTKRel>("RTK/rel", 10);
274  }
275  else if (RTK_base)
276  {
277  std::string RTK_connection = RTK_server_IP + ":" + std::to_string(RTK_server_port);
278  RTK_.enabled = true;
279  ROS_INFO("InertialSense: Configured as RTK Base");
282 
283  if (IS_.CreateHost(RTK_connection))
284  {
285  ROS_INFO_STREAM("Successfully created " << RTK_connection << " as RTK server");
286  initialized_ = true;
287  return;
288  }
289  else
290  ROS_ERROR_STREAM("Failed to create base server at " << RTK_connection);
291  }
292  IS_.SendData(DID_FLASH_CONFIG, reinterpret_cast<uint8_t*>(&RTKCfgBits), sizeof(RTKCfgBits), offsetof(nvm_flash_cfg_t, RTKCfgBits));
293 }
294 
295 template <typename T>
296 void InertialSenseROS::set_vector_flash_config(std::string param_name, uint32_t size, uint32_t offset){
297  std::vector<double> tmp(size,0);
298  T v[size];
299  if (nh_private_.hasParam(param_name))
300  nh_private_.getParam(param_name, tmp);
301  for (int i = 0; i < size; i++)
302  {
303  v[i] = tmp[i];
304  }
305 
306  IS_.SendData(DID_FLASH_CONFIG, reinterpret_cast<uint8_t*>(&v), sizeof(v), offset);
308 }
309 
310 template <typename T>
311 void InertialSenseROS::set_flash_config(std::string param_name, uint32_t offset, T def)
312 {
313  T tmp;
314  nh_private_.param<T>(param_name, tmp, def);
315  IS_.SendData(DID_FLASH_CONFIG, reinterpret_cast<uint8_t*>(&tmp), sizeof(T), offset);
316 }
317 
319 {
320  odom_msg.header.frame_id = frame_id_;
321  if (LTCF == NED)
322  {
323  odom_msg.pose.pose.position.x = msg->ned[0];
324  odom_msg.pose.pose.position.y = msg->ned[1];
325  odom_msg.pose.pose.position.z = msg->ned[2];
326  }
327  else if (LTCF == ENU)
328  {
329  odom_msg.pose.pose.position.x = msg->ned[1];
330  odom_msg.pose.pose.position.y = msg->ned[0];
331  odom_msg.pose.pose.position.z = -msg->ned[2];
332  }
333 
334 }
335 
336 //void InertialSenseROS::INS_variance_callback(const inl2_variance_t * const msg)
337 //{
338 // // We have to convert NED velocity covariance into body-fixed
339 // tf::Matrix3x3 cov_vel_NED;
340 // cov_vel_NED.setValue(msg->PvelNED[0], 0, 0, 0, msg->PvelNED[1], 0, 0, 0, msg->PvelNED[2]);
341 // tf::Quaternion att;
342 // tf::quaternionMsgToTF(odom_msg.pose.pose.orientation, att);
343 // tf::Matrix3x3 R_NED_B(att);
344 // tf::Matrix3x3 cov_vel_B = R_NED_B.transposeTimes(cov_vel_NED * R_NED_B);
345 
346 // // Populate Covariance Matrix
347 // for (int i = 0; i < 3; i++)
348 // {
349 // // Position and velocity covariance is only valid if in NAV mode (with GPS)
350 // if (insStatus_ & INS_STATUS_NAV_MODE)
351 // {
352 // odom_msg.pose.covariance[7*i] = msg->PxyzNED[i];
353 // for (int j = 0; j < 3; j++)
354 // odom_msg.twist.covariance[6*i+j] = cov_vel_B[i][j];
355 // }
356 // else
357 // {
358 // odom_msg.pose.covariance[7*i] = 0;
359 // odom_msg.twist.covariance[7*i] = 0;
360 // }
361 // odom_msg.pose.covariance[7*(i+3)] = msg->PattNED[i];
362 // odom_msg.twist.covariance[7*(i+3)] = msg->PWBias[i];
363 // }
364 //}
365 
366 
368 {
370  { // Don't run if msg->timeOfWeek is not valid
371  return;
372  }
373 
374  odom_msg.header.stamp = ros_time_from_week_and_tow(msg->week, msg->timeOfWeek);
375  odom_msg.header.frame_id = frame_id_;
376 
377  if (LTCF == NED)
378  {
379  odom_msg.pose.pose.orientation.w = msg->qn2b[0];
380  odom_msg.pose.pose.orientation.x = msg->qn2b[1];
381  odom_msg.pose.pose.orientation.y = msg->qn2b[2];
382  odom_msg.pose.pose.orientation.z = msg->qn2b[3];
383  }
384  else if (LTCF == ENU)
385  {
386  // q_enu2b = q_enu2ned * q_n2b
387  // q_enu2ned = [0, 0.7, 0.7, 0], which is eul = [180, 0, 90]
388  // Let q_n2b = [0.7, 0, 0, 0.7], which is eul = [0, 0, 90], robot facing east
389  // Then q_enu2b = [0, 1, 0, 0], which is eul = [180, 0, 0], a 180 deg flip about x-axis that takes ENU frame to body
390  // Which means the following 3 lines are not always true.
391  //odom_msg.pose.pose.orientation.x = msg->qn2b[2];
392  //odom_msg.pose.pose.orientation.y = msg->qn2b[1];
393  //odom_msg.pose.pose.orientation.z = -msg->qn2b[3];
394  // This fixes it:
395 
396  ixQuat q_enu2ned, q_enu2b;
397  ixEuler eul = {M_PI, 0, 0.5*M_PI};
398  euler2quat(eul, q_enu2ned);
399  mul_Quat_Quat(q_enu2b, msg->qn2b, q_enu2ned);
400 
401  odom_msg.pose.pose.orientation.w = q_enu2b[0];
402  odom_msg.pose.pose.orientation.x = q_enu2b[1];
403  odom_msg.pose.pose.orientation.y = q_enu2b[2];
404  odom_msg.pose.pose.orientation.z = q_enu2b[3];
405  }
406 
407  odom_msg.twist.twist.linear.x = msg->uvw[0];
408  odom_msg.twist.twist.linear.y = msg->uvw[1];
409  odom_msg.twist.twist.linear.z = msg->uvw[2];
410 
411  lla_[0] = msg->lla[0];
412  lla_[1] = msg->lla[1];
413  lla_[2] = msg->lla[2];
414 
415  odom_msg.pose.covariance[0] = lla_[0];
416  odom_msg.pose.covariance[1] = lla_[1];
417  odom_msg.pose.covariance[2] = lla_[2];
418  odom_msg.pose.covariance[3] = ecef_[0];
419  odom_msg.pose.covariance[4] = ecef_[1];
420  odom_msg.pose.covariance[5] = ecef_[2];
421  odom_msg.pose.covariance[6] = LTCF; //Defined in inertial_sense.h: enum InertialSenseROS::ltcf
422 
423  odom_msg.twist.twist.angular.x = imu1_msg.angular_velocity.x;
424  odom_msg.twist.twist.angular.y = imu1_msg.angular_velocity.y;
425  odom_msg.twist.twist.angular.z = imu1_msg.angular_velocity.z;
426 
427  if (publishTf)
428  {
429  // Calculate the TF from the pose...
430  transform.setOrigin(tf::Vector3(odom_msg.pose.pose.position.x, odom_msg.pose.pose.position.y, odom_msg.pose.pose.position.z));
432  tf::quaternionMsgToTF(odom_msg.pose.pose.orientation, q);
434 
435  br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "ins", "ins_base_link"));
436  }
437 
438  if (INS_.enabled)
440 }
441 
442 
444 {
445  inl2_states_msg.header.stamp = ros_time_from_tow(msg->timeOfWeek);
446  inl2_states_msg.header.frame_id = frame_id_;
447 
448  inl2_states_msg.quatEcef.w = msg->qe2b[0];
449  inl2_states_msg.quatEcef.x = msg->qe2b[1];
450  inl2_states_msg.quatEcef.y = msg->qe2b[2];
451  inl2_states_msg.quatEcef.z = msg->qe2b[3];
452 
453  inl2_states_msg.velEcef.x = msg->ve[0];
454  inl2_states_msg.velEcef.y = msg->ve[1];
455  inl2_states_msg.velEcef.z = msg->ve[2];
456 
457  inl2_states_msg.posEcef.x = msg->ecef[0];
458  inl2_states_msg.posEcef.y = msg->ecef[1];
459  inl2_states_msg.posEcef.z = msg->ecef[2];
460 
461  inl2_states_msg.gyroBias.x = msg->biasPqr[0];
462  inl2_states_msg.gyroBias.y = msg->biasPqr[1];
463  inl2_states_msg.gyroBias.z = msg->biasPqr[2];
464 
465  inl2_states_msg.accelBias.x = msg->biasAcc[0];
466  inl2_states_msg.accelBias.y = msg->biasAcc[1];
467  inl2_states_msg.accelBias.z = msg->biasAcc[2];
468 
469  inl2_states_msg.baroBias = msg->biasBaro;
470  inl2_states_msg.magDec = msg->magDec;
471  inl2_states_msg.magInc = msg->magInc;
472 
473  // Use custom INL2 states message
475  {
477  }
478 }
479 
480 
482 {
483  imu1_msg.header.stamp = imu2_msg.header.stamp = ros_time_from_start_time(msg->time);
484  imu1_msg.header.frame_id = imu2_msg.header.frame_id = frame_id_;
485 
486  imu1_msg.angular_velocity.x = msg->I[0].pqr[0];
487  imu1_msg.angular_velocity.y = msg->I[0].pqr[1];
488  imu1_msg.angular_velocity.z = msg->I[0].pqr[2];
489  imu1_msg.linear_acceleration.x = msg->I[0].acc[0];
490  imu1_msg.linear_acceleration.y = msg->I[0].acc[1];
491  imu1_msg.linear_acceleration.z = msg->I[0].acc[2];
492 
493  // imu2_msg.angular_velocity.x = msg->I[1].pqr[0];
494  // imu2_msg.angular_velocity.y = msg->I[1].pqr[1];
495  // imu2_msg.angular_velocity.z = msg->I[1].pqr[2];
496  // imu2_msg.linear_acceleration.x = msg->I[1].acc[0];
497  // imu2_msg.linear_acceleration.y = msg->I[1].acc[1];
498  // imu2_msg.linear_acceleration.z = msg->I[1].acc[2];
499 
500  if (IMU_.enabled)
501  {
503  // IMU_.pub2.publish(imu2_msg);
504  }
505 }
506 
507 
509 {
510  GPS_week_ = msg->week;
511  GPS_towOffset_ = msg->towOffset;
513  {
514  gps_msg.header.stamp = ros_time_from_week_and_tow(msg->week, msg->timeOfWeekMs/1e3);
515  gps_msg.fix_type = msg->status & GPS_STATUS_FIX_MASK;
516  gps_msg.header.frame_id =frame_id_;
517  gps_msg.num_sat = (uint8_t)(msg->status & GPS_STATUS_NUM_SATS_USED_MASK);
518  gps_msg.cno = msg->cnoMean;
519  gps_msg.latitude = msg->lla[0];
520  gps_msg.longitude = msg->lla[1];
521  gps_msg.altitude = msg->lla[2];
522  gps_msg.posEcef.x = ecef_[0] = msg->ecef[0];
523  gps_msg.posEcef.y = ecef_[1] = msg->ecef[1];
524  gps_msg.posEcef.z = ecef_[2] = msg->ecef[2];
525  gps_msg.hMSL = msg->hMSL;
526  gps_msg.hAcc = msg->hAcc;
527  gps_msg.vAcc = msg->vAcc;
528  gps_msg.pDop = msg->pDop;
529  publishGPS();
530  }
531 }
532 
534 {
535  if (GPS_.enabled && GPS_towOffset_ > 0.001)
536  {
538  gps_velEcef.vector.x = msg->vel[0];
539  gps_velEcef.vector.y = msg->vel[1];
540  gps_velEcef.vector.z = msg->vel[2];
541  publishGPS();
542  }
543 }
544 
546 {
547  if ((gps_velEcef.header.stamp - gps_msg.header.stamp).toSec() < 2e-3)
548  {
549  gps_msg.velEcef = gps_velEcef.vector;
551  }
552 }
553 
555 {
556  IS_.Update();
557 }
558 
560 {
561  // create the subscriber if it doesn't exist
562  if (strobe_pub_.getTopic().empty())
563  strobe_pub_ = nh_.advertise<std_msgs::Header>("strobe_time", 1);
564 
565  if (GPS_towOffset_ > 0.001)
566  {
567  std_msgs::Header strobe_msg;
568  strobe_msg.stamp = ros_time_from_week_and_tow(msg->week, msg->timeOfWeekMs * 1e-3);
569  strobe_pub_.publish(strobe_msg);
570  }
571 }
572 
573 
575 {
576  if(GPS_towOffset_ < 0.001)
577  { // Wait for valid msg->timeOfWeekMs
578  return;
579  }
580 
581  gps_info_msg.header.stamp =ros_time_from_tow(msg->timeOfWeekMs/1e3);
582  gps_info_msg.header.frame_id = frame_id_;
583  gps_info_msg.num_sats = msg->numSats;
584  for (int i = 0; i < 50; i++)
585  {
586  gps_info_msg.sattelite_info[i].sat_id = msg->sat[i].svId;
587  gps_info_msg.sattelite_info[i].cno = msg->sat[i].cno;
588  }
590 }
591 
592 
594 {
595  sensor_msgs::MagneticField mag_msg;
596  mag_msg.header.stamp = ros_time_from_start_time(msg->time);
597  mag_msg.header.frame_id = frame_id_;
598  mag_msg.magnetic_field.x = msg->mag[0];
599  mag_msg.magnetic_field.y = msg->mag[1];
600  mag_msg.magnetic_field.z = msg->mag[2];
601 
602  mag_.pub.publish(mag_msg);
603 }
604 
606 {
607  sensor_msgs::FluidPressure baro_msg;
608  baro_msg.header.stamp = ros_time_from_start_time(msg->time);
609  baro_msg.header.frame_id = frame_id_;
610  baro_msg.fluid_pressure = msg->bar;
611  baro_msg.variance = msg-> barTemp;
612 
613  baro_.pub.publish(baro_msg);
614 }
615 
617 {
618  inertial_sense_ros::PreIntIMU preintIMU_msg;
619  preintIMU_msg.header.stamp = ros_time_from_start_time(msg->time);
620  preintIMU_msg.header.frame_id = frame_id_;
621  preintIMU_msg.dtheta.x = msg->theta1[0];
622  preintIMU_msg.dtheta.y = msg->theta1[1];
623  preintIMU_msg.dtheta.z = msg->theta1[2];
624 
625  preintIMU_msg.dvel.x = msg->vel1[0];
626  preintIMU_msg.dvel.y = msg->vel1[1];
627  preintIMU_msg.dvel.z = msg->vel1[2];
628 
629  preintIMU_msg.dt = msg->dt;
630 
631  dt_vel_.pub.publish(preintIMU_msg);
632 }
633 
635 {
636  if (RTK_.enabled && GPS_towOffset_ > 0.001)
637  {
638  inertial_sense_ros::RTKInfo rtk_info;
639  rtk_info.header.stamp = ros_time_from_week_and_tow(GPS_week_, msg->timeOfWeekMs/1000.0);
640  rtk_info.baseAntcount = msg->baseAntennaCount;
642  + msg->baseGpsEphemerisCount;
645  rtk_info.BaseLLA[0] = msg->baseLla[0];
646  rtk_info.BaseLLA[1] = msg->baseLla[1];
647  rtk_info.BaseLLA[2] = msg->baseLla[2];
648 
650  + msg->roverGpsEphemerisCount;
653  rtk_info.cycle_slip_count = msg->cycleSlipCount;
654  RTK_.pub.publish(rtk_info);
655  }
656 }
657 
658 
660 {
661  if (RTK_.enabled && GPS_towOffset_ > 0.001)
662  {
663  inertial_sense_ros::RTKRel rtk_rel;
664  rtk_rel.header.stamp = ros_time_from_week_and_tow(GPS_week_, msg->timeOfWeekMs/1000.0);
665  rtk_rel.differential_age = msg->differentialAge;
666  rtk_rel.ar_ratio = msg->arRatio;
667  rtk_rel.vector_base_to_rover.x = msg->baseToRoverVector[0];
668  rtk_rel.vector_base_to_rover.y = msg->baseToRoverVector[1];
669  rtk_rel.vector_base_to_rover.z = msg->baseToRoverVector[2];
670  rtk_rel.distance_base_to_rover = msg->baseToRoverDistance;
671  rtk_rel.heading_base_to_rover = msg->baseToRoverHeading;
672  RTK_.pub2.publish(rtk_rel);
673 
674  // save for diagnostics
675  diagnostic_ar_ratio_ = rtk_rel.ar_ratio;
676  diagnostic_differential_age_ = rtk_rel.differential_age;
677  diagnostic_heading_base_to_rover_ = rtk_rel.heading_base_to_rover;
678  }
679 }
680 
682 {
683  switch(msg->dataType)
684  {
686  GPS_obs_callback((obsd_t*)&msg->data.obs, msg->obsCount);
687  break;
688 
690  GPS_eph_callback((eph_t*)&msg->data.eph);
691  break;
692 
695  break;
696 
697  default:
698  break;
699  }
700 }
701 
702 void InertialSenseROS::GPS_obs_callback(const obsd_t * const msg, int nObs)
703 {
704  if (obs_Vec_.obs.size() > 0 &&
705  (msg[0].time.time != obs_Vec_.obs[0].time.time ||
706  msg[0].time.sec != obs_Vec_.obs[0].time.sec))
708 
709  for (int i = 0; i < nObs; i++)
710  {
711  inertial_sense_ros::GNSSObservation obs;
712  obs.header.stamp = ros_time_from_gtime(msg[i].time.time, msg[i].time.sec);
713  obs.time.time = msg[i].time.time;
714  obs.time.sec = msg[i].time.sec;
715  obs.sat = msg[i].sat;
716  obs.rcv = msg[i].rcv;
717  obs.SNR = msg[i].SNR[0];
718  obs.LLI = msg[i].LLI[0];
719  obs.code = msg[i].code[0];
720  obs.qualL = msg[i].qualL[0];
721  obs.qualP = msg[i].qualP[0];
722  obs.L = msg[i].L[0];
723  obs.P = msg[i].P[0];
724  obs.D = msg[i].D[0];
725  obs_Vec_.obs.push_back(obs);
727  }
728 }
729 
731 {
732  if (obs_Vec_.obs.size() == 0)
733  return;
734 
735  if ((ros::Time::now() - last_obs_time_).toSec() > 1e-2)
736  {
737  obs_Vec_.header.stamp = ros_time_from_gtime(obs_Vec_.obs[0].time.time, obs_Vec_.obs[0].time.sec);
738  obs_Vec_.time = obs_Vec_.obs[0].time;
740  obs_Vec_.obs.clear();
741 // cout << "dt" << (obs_Vec_.header.stamp - ros::Time::now()) << endl;
742  }
743 }
744 
745 
747 {
748  inertial_sense_ros::GNSSEphemeris eph;
749  eph.sat = msg->sat;
750  eph.iode = msg->iode;
751  eph.iodc = msg->iodc;
752  eph.sva = msg->sva;
753  eph.svh = msg->svh;
754  eph.week = msg->week;
755  eph.code = msg->code;
756  eph.flag = msg->flag;
757  eph.toe.time = msg->toe.time;
758  eph.toc.time = msg->toc.time;
759  eph.ttr.time = msg->ttr.time;
760  eph.toe.sec = msg->toe.sec;
761  eph.toc.sec = msg->toc.sec;
762  eph.ttr.sec = msg->ttr.sec;
763  eph.A = msg->A;
764  eph.e = msg->e;
765  eph.i0 = msg->i0;
766  eph.OMG0 = msg->OMG0;
767  eph.omg = msg->omg;
768  eph.M0 = msg->M0;
769  eph.deln = msg->deln;
770  eph.OMGd = msg->OMGd;
771  eph.idot = msg->idot;
772  eph.crc = msg->crc;
773  eph.crs = msg->crs;
774  eph.cuc = msg->cuc;
775  eph.cus = msg->cus;
776  eph.cic = msg->cic;
777  eph.cis = msg->cis;
778  eph.toes = msg->toes;
779  eph.fit = msg->fit;
780  eph.f0 = msg->f0;
781  eph.f1 = msg->f1;
782  eph.f2 = msg->f2;
783  eph.tgd[0] = msg->tgd[0];
784  eph.tgd[1] = msg->tgd[1];
785  eph.tgd[2] = msg->tgd[2];
786  eph.tgd[3] = msg->tgd[3];
787  eph.Adot = msg->Adot;
788  eph.ndot = msg->ndot;
789  GPS_eph_.pub.publish(eph);
790 }
791 
793 {
794  inertial_sense_ros::GlonassEphemeris geph;
795  geph.sat = msg->sat;
796  geph.iode = msg->iode;
797  geph.frq = msg->frq;
798  geph.svh = msg->svh;
799  geph.sva = msg->sva;
800  geph.age = msg->age;
801  geph.toe.time = msg->toe.time;
802  geph.tof.time = msg->tof.time;
803  geph.toe.sec = msg->toe.sec;
804  geph.tof.sec = msg->tof.sec;
805  geph.pos[0] = msg->pos[0];
806  geph.pos[1] = msg->pos[1];
807  geph.pos[2] = msg->pos[2];
808  geph.vel[0] = msg->vel[0];
809  geph.vel[1] = msg->vel[1];
810  geph.vel[2] = msg->vel[2];
811  geph.acc[0] = msg->acc[0];
812  geph.acc[1] = msg->acc[1];
813  geph.acc[2] = msg->acc[2];
814  geph.taun = msg->taun;
815  geph.gamn = msg->gamn;
816  geph.dtaun = msg->dtaun;
817  GPS_eph_.pub2.publish(geph);
818 }
819 
821 {
822  // Create diagnostic objects
823  diagnostic_msgs::DiagnosticArray diag_array;
824  diag_array.header.stamp = ros::Time::now();
825 
826  // CNO mean
827  diagnostic_msgs::DiagnosticStatus cno_mean;
828  cno_mean.name = "CNO Mean";
829  cno_mean.level = diagnostic_msgs::DiagnosticStatus::OK;
830  cno_mean.message = std::to_string(gps_msg.cno);
831  diag_array.status.push_back(cno_mean);
832 
833  if (RTK_.enabled){
834  diagnostic_msgs::DiagnosticStatus rtk_status;
835  rtk_status.name = "RTK";
836  rtk_status.level = diagnostic_msgs::DiagnosticStatus::OK;
837  std::string rtk_message;
838 
839  // AR ratio
840  diagnostic_msgs::KeyValue ar_ratio;
841  ar_ratio.key = "AR Ratio";
842  ar_ratio.value = std::to_string(diagnostic_ar_ratio_);
843  rtk_status.values.push_back(ar_ratio);
844  if (diagnostic_ar_ratio_ < 3.0){
845  rtk_status.level = diagnostic_msgs::DiagnosticStatus::WARN;
846  rtk_message = "Float: " + std::to_string(diagnostic_ar_ratio_);
847  } else if (diagnostic_ar_ratio_ < 6.0){
848  rtk_message = "Fix: " + std::to_string(diagnostic_ar_ratio_);
849  } else {
850  rtk_message = "Fix and Hold: " + std::to_string(diagnostic_ar_ratio_);
851  }
852 
853  // Differential age
854  diagnostic_msgs::KeyValue differential_age;
855  differential_age.key = "Differential Age";
856  differential_age.value = std::to_string(diagnostic_differential_age_);
857  rtk_status.values.push_back(differential_age);
858  if (diagnostic_differential_age_ > 1.5){
859  rtk_status.level = diagnostic_msgs::DiagnosticStatus::WARN;
860  rtk_message += " Differential Age Large";
861  }
862 
863  // Heading base to rover
864  diagnostic_msgs::KeyValue heading_base_to_rover;
865  heading_base_to_rover.key = "Heading Base to Rover (rad)";
866  heading_base_to_rover.value = std::to_string(diagnostic_heading_base_to_rover_);
867  rtk_status.values.push_back(heading_base_to_rover);
868 
869  rtk_status.message = rtk_message;
870  diag_array.status.push_back(rtk_status);
871  }
872 
873  diagnostics_.pub.publish(diag_array);
874 }
875 
876 bool InertialSenseROS::set_current_position_as_refLLA(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
877 {
878  (void)req;
879  double current_lla_[3];
880  current_lla_[0] = lla_[0];
881  current_lla_[1] = lla_[1];
882  current_lla_[2] = lla_[2];
883 
884  IS_.SendData(DID_FLASH_CONFIG, reinterpret_cast<uint8_t*>(&current_lla_), sizeof(current_lla_), offsetof(nvm_flash_cfg_t, refLla));
885 
886  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 1);
887 
888  int i = 0;
889  nvm_flash_cfg_t current_flash = IS_.GetFlashConfig();
890  while (current_flash.refLla[0] == IS_.GetFlashConfig().refLla[0] && current_flash.refLla[1] == IS_.GetFlashConfig().refLla[1] && current_flash.refLla[2] == IS_.GetFlashConfig().refLla[2])
891  {
892  comManagerStep();
893  i++;
894  if(i>100){break;}
895  }
896 
897  if(current_lla_[0] == IS_.GetFlashConfig().refLla[0] && current_lla_[1] == IS_.GetFlashConfig().refLla[1] && current_lla_[2] == IS_.GetFlashConfig().refLla[2])
898  {
899  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 0);
900  res.success = true;
901  res.message = ("Update was succesful. refLla: Lat: " + to_string(current_lla_[0]) + " Lon: " +to_string( current_lla_[1]) + " Alt: " + to_string(current_lla_[2]));
902  }
903  else
904  {
905  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 0);
906  res.success = false;
907  res.message = "Unable to update refLLA. Please try again.";
908 
909  }
910 
911  }
912 
913 bool InertialSenseROS::set_refLLA_to_value(inertial_sense_ros::refLLAUpdate::Request &req, inertial_sense_ros::refLLAUpdate::Response &res)
914 {
915  IS_.SendData(DID_FLASH_CONFIG, reinterpret_cast<uint8_t*>(&req.lla), sizeof(req.lla), offsetof(nvm_flash_cfg_t, refLla));
916 
917  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 1);
918 
919  int i = 0;
920  nvm_flash_cfg_t current_flash = IS_.GetFlashConfig();
921  while (current_flash.refLla[0] == IS_.GetFlashConfig().refLla[0] && current_flash.refLla[1] == IS_.GetFlashConfig().refLla[1] && current_flash.refLla[2] == IS_.GetFlashConfig().refLla[2])
922 {
923  comManagerStep();
924  i++;
925  if(i>100){break;}
926 }
927 
928  if(req.lla[0] == IS_.GetFlashConfig().refLla[0] && req.lla[1] == IS_.GetFlashConfig().refLla[1] && req.lla[2] == IS_.GetFlashConfig().refLla[2])
929 {
930  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 0);
931  res.success = true;
932  res.message = ("Update was succesful. refLla: Lat: " + to_string(req.lla[0]) + " Lon: " +to_string( req.lla[1]) + " Alt: " + to_string(req.lla[2]));
933 }
934  else
935 {
936  comManagerGetData(0, DID_FLASH_CONFIG, 0, 0, 0);
937  res.success = false;
938  res.message = "Unable to update refLLA. Please try again.";
939  }
940 }
941 
942 bool InertialSenseROS::perform_mag_cal_srv_callback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
943 {
944  (void)req;
945  uint32_t single_axis_command = 2;
946  IS_.SendData(DID_MAG_CAL, reinterpret_cast<uint8_t*>(&single_axis_command), sizeof(uint32_t), offsetof(mag_cal_t, recalCmd));
947 
948  is_comm_instance_t comm;
949  uint8_t buffer[2048];
950  is_comm_init(&comm, buffer, sizeof(buffer));
951  serial_port_t* serialPort = IS_.GetSerialPort();
952  uint8_t inByte;
953  int n;
954 
955  while ((n = serialPortReadCharTimeout(serialPort, &inByte, 20)) > 0)
956  {
957  // Search comm buffer for valid packets
958  if (is_comm_parse_byte(&comm, inByte) == _PTYPE_INERTIAL_SENSE_DATA && comm.dataHdr.id == DID_INS_1)
959  {
960  ins_1_t* msg = (ins_1_t*)(comm.dataPtr + comm.dataHdr.offset);
961  if (msg->insStatus & 0x00400000)
962  {
963  res.success = true;
964  res.message = "Successfully initiated mag recalibration.";
965  return true;
966  }
967  }
968  }
969 }
970 
971 bool InertialSenseROS::perform_multi_mag_cal_srv_callback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
972 {
973  (void)req;
974  uint32_t multi_axis_command = 1;
975  IS_.SendData(DID_MAG_CAL, reinterpret_cast<uint8_t*>(&multi_axis_command), sizeof(uint32_t), offsetof(mag_cal_t, recalCmd));
976 
977  is_comm_instance_t comm;
978  uint8_t buffer[2048];
979  is_comm_init(&comm, buffer, sizeof(buffer));
980  serial_port_t* serialPort = IS_.GetSerialPort();
981  uint8_t inByte;
982  int n;
983 
984  while ((n = serialPortReadCharTimeout(serialPort, &inByte, 20)) > 0)
985  {
986  // Search comm buffer for valid packets
987  if (is_comm_parse_byte(&comm, inByte) == _PTYPE_INERTIAL_SENSE_DATA && comm.dataHdr.id == DID_INS_1)
988  {
989  ins_1_t* msg = (ins_1_t*)(comm.dataPtr + comm.dataHdr.offset);
990  if (msg->insStatus & 0x00400000)
991  {
992  res.success = true;
993  res.message = "Successfully initiated mag recalibration.";
994  return true;
995  }
996  }
997  }
998 }
999 
1001 {
1002  // send reset command
1003  system_command_t reset_command;
1004  reset_command.command = 99;
1005  reset_command.invCommand = ~reset_command.command;
1006  IS_.SendData(DID_SYS_CMD, reinterpret_cast<uint8_t*>(&reset_command), sizeof(system_command_t), 0);
1007  sleep(1);
1008 }
1009 
1010 bool InertialSenseROS::update_firmware_srv_callback(inertial_sense_ros::FirmwareUpdate::Request &req, inertial_sense_ros::FirmwareUpdate::Response &res)
1011 {
1012  IS_.Close();
1013  vector<InertialSense::bootloader_result_t> results = IS_.BootloadFile("*", req.filename, 921600);
1014  if (!results[0].error.empty())
1015  {
1016  res.success = false;
1017  res.message = results[0].error;
1018  return false;
1019  }
1020  IS_.Open(port_.c_str(), baudrate_);
1021  return true;
1022 }
1023 
1024 
1025 ros::Time InertialSenseROS::ros_time_from_week_and_tow(const uint32_t week, const double timeOfWeek)
1026 {
1027  ros::Time rostime(0, 0);
1028  // If we have a GPS fix, then use it to set timestamp
1029  if (GPS_towOffset_ > 0.001)
1030  {
1031  uint64_t sec = UNIX_TO_GPS_OFFSET + floor(timeOfWeek) + week*7*24*3600;
1032  uint64_t nsec = (timeOfWeek - floor(timeOfWeek))*1e9;
1033  rostime = ros::Time(sec, nsec);
1034  }
1035  else
1036  {
1037  // Otherwise, estimate the uINS boot time and offset the messages
1038  if (!got_first_message_)
1039  {
1040  got_first_message_ = true;
1041  INS_local_offset_ = ros::Time::now().toSec() - timeOfWeek;
1042  }
1043  else // low-pass filter offset to account for drift
1044  {
1045  double y_offset = ros::Time::now().toSec() - timeOfWeek;
1046  INS_local_offset_ = 0.005 * y_offset + 0.995 * INS_local_offset_;
1047  }
1048  // Publish with ROS time
1049  rostime = ros::Time(INS_local_offset_ + timeOfWeek);
1050  }
1051  return rostime;
1052 }
1053 
1055 {
1056  ros::Time rostime(0, 0);
1057 
1058  // If we have a GPS fix, then use it to set timestamp
1059  if (GPS_towOffset_ > 0.001)
1060  {
1061  uint64_t sec = UNIX_TO_GPS_OFFSET + floor(time + GPS_towOffset_) + GPS_week_*7*24*3600;
1062  uint64_t nsec = (time + GPS_towOffset_ - floor(time + GPS_towOffset_))*1e9;
1063  rostime = ros::Time(sec, nsec);
1064  }
1065  else
1066  {
1067  // Otherwise, estimate the uINS boot time and offset the messages
1068  if (!got_first_message_)
1069  {
1070  got_first_message_ = true;
1071  INS_local_offset_ = ros::Time::now().toSec() - time;
1072  }
1073  else // low-pass filter offset to account for drift
1074  {
1075  double y_offset = ros::Time::now().toSec() - time;
1076  INS_local_offset_ = 0.005 * y_offset + 0.995 * INS_local_offset_;
1077  }
1078  // Publish with ROS time
1079  rostime = ros::Time(INS_local_offset_ + time);
1080  }
1081  return rostime;
1082 }
1083 
1085 {
1087 }
1088 
1090 {
1091  return (rt.sec - UNIX_TO_GPS_OFFSET - GPS_week_*604800) + rt.nsec*1.0e-9;
1092 }
1093 
1094 ros::Time InertialSenseROS::ros_time_from_gtime(const uint64_t sec, double subsec)
1095 {
1096  ros::Time out;
1097  out.sec = sec - LEAP_SECONDS;
1098  out.nsec = subsec * 1e9;
1099  return out;
1100 }
1101 
tf::TransformBroadcaster br
double refLla[3]
Definition: data_sets.h:2003
#define DID_DUAL_IMU
Definition: data_sets.h:92
double f0
Definition: data_sets.h:2521
uint8_t qualP[1]
Definition: data_sets.h:2402
imus_t I
Definition: data_sets.h:617
float bar
Definition: data_sets.h:666
float baseToRoverVector[3]
Definition: data_sets.h:2729
int32_t week
Definition: data_sets.h:2452
double P[1]
Definition: data_sets.h:2411
ixVector4 ixQuat
Definition: ISConstants.h:796
double taun
Definition: data_sets.h:2576
static vector< bootloader_result_t > BootloadFile(const string &comPort, const string &fileName, const string &bootloaderFileName, int baudRate=IS_BAUD_RATE_BOOTLOADER, pfnBootloadProgress uploadProgress=NULLPTR, pfnBootloadProgress verifyProgress=NULLPTR, pfnBootloadStatus infoProgress=NULLPTR, bool updateBootloader=false)
uint8_t LLI[1]
Definition: data_sets.h:2393
TFSIMD_FORCE_INLINE void setRotation(const Quaternion &q)
filename
int32_t iode
Definition: data_sets.h:2440
inertial_sense_ros::GPSInfo gps_info_msg
#define ROS_FATAL(...)
double towOffset
Definition: data_sets.h:787
double sec
Definition: data_sets.h:2129
inertial_sense_ros::GPS gps_msg
is_can_ve ve
Definition: CAN_comm.h:258
uint32_t baseGpsEphemerisCount
Definition: data_sets.h:2809
uint8_t arRatio
Definition: CAN_comm.h:232
double toes
Definition: data_sets.h:2515
float qn2b[4]
Definition: data_sets.h:534
double gamn
Definition: data_sets.h:2579
ros::Publisher strobe_pub_
ros::NodeHandle nh_private_
double acc[3]
Definition: data_sets.h:2573
ros::Time ros_time_from_gtime(const uint64_t sec, double subsec)
ros_stream_t GPS_info_
double tgd[4]
Definition: data_sets.h:2530
gtime_t toc
Definition: data_sets.h:2464
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
#define DID_GPS1_VEL
Definition: data_sets.h:64
def mul_Quat_Quat(q1, q2)
Definition: pose.py:39
void RTK_Rel_callback(const gps_rtk_rel_t *const msg)
uint32_t id
Definition: ISComm.h:376
is_can_uvw uvw
Definition: CAN_comm.h:257
#define DID_INS_1
Definition: data_sets.h:38
float vel[3]
Definition: data_sets.h:806
bool update_firmware_srv_callback(inertial_sense_ros::FirmwareUpdate::Request &req, inertial_sense_ros::FirmwareUpdate::Response &res)
uint8_t svId
Definition: data_sets.h:823
void mag_callback(const magnetometer_t *const msg)
double cis
Definition: data_sets.h:2512
void GPS_raw_callback(const gps_raw_t *const msg)
double pos[3]
Definition: data_sets.h:2567
int32_t flag
Definition: data_sets.h:2458
#define DID_GPS2_RTK_CMP_REL
Definition: data_sets.h:125
void preint_IMU_callback(const preintegrated_imu_t *const msg)
int32_t age
Definition: data_sets.h:2558
obsd_t obs[MAX_OBSERVATION_COUNT_IN_RTK_MESSAGE]
Definition: data_sets.h:2883
uGpsRawData data
Definition: data_sets.h:2920
const dev_info_t GetDeviceInfo(int pHandle=0)
bool OpenServerConnection(const string &connectionString)
geometry_msgs::Vector3Stamped gps_velEcef
uint32_t baseGpsObservationCount
Definition: data_sets.h:2779
void GPS_info_callback(const gps_sat_t *const msg)
float mag[3]
Definition: data_sets.h:655
double dtaun
Definition: data_sets.h:2582
float biasPqr[3]
Definition: data_sets.h:906
float timeOfWeekMs
Definition: CAN_comm.h:29
float diagnostic_heading_base_to_rover_
#define DID_INS_2
Definition: data_sets.h:39
protocol_type_t is_comm_parse_byte(is_comm_instance_t *instance, uint8_t byte)
Definition: ISComm.c:499
void GPS_pos_callback(const gps_pos_t *const msg)
int32_t svh
Definition: data_sets.h:2449
void INS1_callback(const ins_1_t *const msg)
double OMGd
Definition: data_sets.h:2491
double M0
Definition: data_sets.h:2485
void RTK_Misc_callback(const gps_rtk_misc_t *const msg)
ros::Timer obs_bundle_timer_
#define DID_PREINTEGRATED_IMU
Definition: data_sets.h:37
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
double f2
Definition: data_sets.h:2527
double omg
Definition: data_sets.h:2482
void diagnostics_callback(const ros::TimerEvent &event)
double baseLla[3]
Definition: data_sets.h:2770
float pqr[3]
Definition: data_sets.h:603
#define ROS_ERROR_COND(cond,...)
uint32_t week
Definition: CAN_comm.h:26
void comManagerStep(void)
Definition: com_manager.c:281
inertial_sense_ros::INL2States inl2_states_msg
uint8_t cno
Definition: data_sets.h:826
double L[1]
Definition: data_sets.h:2408
#define DID_GPS_BASE_RAW
Definition: data_sets.h:94
int16_t theta1
Definition: CAN_comm.h:48
gtime_t toe
Definition: data_sets.h:2561
#define DID_MAG_CAL
Definition: data_sets.h:53
float magInc
Definition: data_sets.h:918
int32_t iode
Definition: data_sets.h:2546
bool CreateHost(const string &ipAndPort)
double timeOfWeek
Definition: data_sets.h:417
double ndot
Definition: data_sets.h:2536
double idot
Definition: data_sets.h:2494
int32_t code
Definition: data_sets.h:2455
gtime_t tof
Definition: data_sets.h:2564
int32_t svh
Definition: data_sets.h:2552
float hMSL
Definition: data_sets.h:772
float baseToRoverDistance
Definition: data_sets.h:2732
int32_t iodc
Definition: data_sets.h:2443
uint32_t roverGlonassObservationCount
Definition: data_sets.h:2782
nav_msgs::Odometry odom_msg
void SendData(eDataIDs dataId, uint8_t *data, uint32_t length, uint32_t offset)
uint32_t roverGpsObservationCount
Definition: data_sets.h:2776
ros::ServiceServer firmware_update_srv_
bool SetLoggerEnabled(bool enable, const string &path=cISLogger::g_emptyString, cISLogger::eLogType logType=cISLogger::eLogType::LOGTYPE_DAT, uint64_t rmcPreset=RMC_PRESET_PPD_BITS, float maxDiskSpacePercent=0.5f, uint32_t maxFileSize=1024 *1024 *5, const string &subFolder=cISLogger::g_emptyString)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
uint32_t roverBeidouEphemerisCount
Definition: data_sets.h:2824
#define LEAP_SECONDS
void publish(const boost::shared_ptr< M > &message) const
#define RMC_PRESET_PPD_ROBOT
Definition: data_sets.h:1351
double tow_from_ros_time(const ros::Time &rt)
void GPS_vel_callback(const gps_vel_t *const msg)
uint32_t invCommand
Definition: data_sets.h:1125
nvm_flash_cfg_t GetFlashConfig(int pHandle=0)
#define DID_GPS1_SAT
Definition: data_sets.h:49
#define WARN(msg)
Definition: catch.hpp:14704
void strobe_in_time_callback(const strobe_in_time_t *const msg)
double cus
Definition: data_sets.h:2506
double crs
Definition: data_sets.h:2500
void INS2_callback(const ins_2_t *const msg)
double f1
Definition: data_sets.h:2524
#define UNIX_TO_GPS_OFFSET
ros::ServiceServer mag_cal_srv_
float pDop
Definition: data_sets.h:781
#define DID_SYS_CMD
Definition: data_sets.h:41
uint32_t baseAntennaCount
Definition: data_sets.h:2842
#define DID_GPS2_RAW
Definition: data_sets.h:104
uint32_t numSats
Definition: data_sets.h:871
sensor_msgs::Imu imu2_msg
double cuc
Definition: data_sets.h:2503
static void quaternionMsgToTF(const geometry_msgs::Quaternion &msg, Quaternion &bt)
ros::Timer diagnostics_timer_
uint32_t command
Definition: data_sets.h:1122
float D[1]
Definition: data_sets.h:2414
#define ROS_INFO(...)
uint32_t hdwStatus
Definition: CAN_comm.h:40
bool getParam(const std::string &key, std::string &s) const
double i0
Definition: data_sets.h:2476
ros::Time ros_time_from_start_time(const double time)
ros_time_from_start_time
uint32_t cnoMean
Definition: CAN_comm.h:226
void set_flash_config(std::string param_name, uint32_t offset, T def) __attribute__((optimize(0)))
#define DID_GPS2_RTK_CMP_MISC
Definition: data_sets.h:126
#define DID_GPS1_RAW
Definition: data_sets.h:103
uint8_t code[1]
Definition: data_sets.h:2396
double vel[3]
Definition: data_sets.h:2570
#define DID_FLASH_CONFIG
Definition: data_sets.h:46
uint32_t roverGpsEphemerisCount
Definition: data_sets.h:2806
double A
Definition: data_sets.h:2470
void set_vector_flash_config(std::string param_name, uint32_t size, uint32_t offset)
void sendTransform(const StampedTransform &transform)
eph_t eph
Definition: data_sets.h:2886
float baseToRoverHeading
Definition: data_sets.h:2735
int32_t sva
Definition: data_sets.h:2555
#define M_PI
Definition: ISConstants.h:356
int64_t time
Definition: data_sets.h:2126
void GPS_obs_callback(const obsd_t *const msg, int nObs)
double lla[3]
Definition: data_sets.h:511
ixVector3 ixEuler
Definition: ISConstants.h:797
uint32_t roverGlonassEphemerisCount
Definition: data_sets.h:2812
double cic
Definition: data_sets.h:2509
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
uint32_t status
Definition: CAN_comm.h:114
#define DID_MAGNETOMETER_1
Definition: data_sets.h:86
ros::ServiceServer multi_mag_cal_srv_
gtime_t toe
Definition: data_sets.h:2461
USBInterfaceDescriptor data
bool hasParam(const std::string &key) const
uint32_t baseGalileoEphemerisCount
Definition: data_sets.h:2821
int16_t vel1
Definition: CAN_comm.h:181
ros::Time ros_time_from_tow(const double tow)
ros_time_from_tow Get equivalent ros time from tow and internal week counter
gtime_t ttr
Definition: data_sets.h:2467
uint8_t rcv
Definition: data_sets.h:2387
uint16_t dt
Definition: CAN_comm.h:174
double deln
Definition: data_sets.h:2488
void GPS_geph_callback(const geph_t *const msg)
int32_t sat
Definition: data_sets.h:2543
void is_comm_init(is_comm_instance_t *instance, uint8_t *buffer, int bufferSize)
Definition: ISComm.c:185
float acc[3]
Definition: data_sets.h:606
uint32_t insStatus
Definition: CAN_comm.h:37
uint32_t roverGalileoEphemerisCount
Definition: data_sets.h:2818
ros_stream_t INL2_states_
#define false
Definition: compiler.h:424
#define DID_GPS1_POS
Definition: data_sets.h:47
double Adot
Definition: data_sets.h:2533
uint32_t baseGalileoObservationCount
Definition: data_sets.h:2791
#define SET_CALLBACK(DID, __type, __cb_fun, __periodmultiple)
ros::ServiceServer refLLA_set_current_srv_
def euler2quat(euler)
Definition: pose.py:147
uint32_t baseGlonassEphemerisCount
Definition: data_sets.h:2815
std::string getTopic() const
uint32_t serialNumber
Definition: data_sets.h:442
bool Open(const char *port, int baudRate=IS_COM_BAUDRATE_DEFAULT, bool disableBroadcastsOnClose=false)
#define ROS_INFO_STREAM(args)
bool perform_mag_cal_srv_callback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
p_data_hdr_t dataHdr
Definition: ISComm.h:507
bool set_refLLA_to_value(inertial_sense_ros::refLLAUpdate::Request &req, inertial_sense_ros::refLLAUpdate::Response &res)
float ned[3]
Definition: data_sets.h:514
float biasAcc[3]
Definition: data_sets.h:909
sensor_msgs::Imu imu1_msg
#define OK
void GPS_eph_callback(const eph_t *const msg)
serial_port_t * GetSerialPort(int pHandle=0)
ros::Time ros_time_from_week_and_tow(const uint32_t week, const double timeOfWeek)
ros_time_from_week_and_tow Get current ROS time from week and tow
double ecef[3]
Definition: data_sets.h:420
void GPS_obs_bundle_timer_callback(const ros::TimerEvent &e)
gps_sat_sv_t sat[MAX_NUM_SAT_CHANNELS]
Definition: data_sets.h:873
bool set_current_position_as_refLLA(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
int32_t sat
Definition: data_sets.h:2437
int serialPortReadCharTimeout(serial_port_t *serialPort, unsigned char *c, int timeoutMilliseconds)
Definition: serialPort.c:196
ros::ServiceServer refLLA_set_value_srv_
#define DID_STROBE_IN_TIME
Definition: data_sets.h:102
static Time now()
uint32_t roverGalileoObservationCount
Definition: data_sets.h:2788
#define DID_GPS1_RTK_POS_REL
Definition: data_sets.h:55
static string CreateCurrentTimestamp()
Definition: ISLogger.cpp:180
float hAcc
Definition: data_sets.h:775
uint32_t baseBeidouObservationCount
Definition: data_sets.h:2797
uint32_t roverBeidouObservationCount
Definition: data_sets.h:2794
tf::Transform transform
float vAcc
Definition: data_sets.h:778
float qe2b[4]
Definition: data_sets.h:589
void comManagerGetData(int pHandle, uint32_t dataId, int offset, int size, int periodMultiple)
Request data This function requests the specified data w/ offset and length for partial reads...
Definition: com_manager.c:516
void IMU_callback(const dual_imu_t *const msg)
int32_t sva
Definition: data_sets.h:2446
geph_t gloEph
Definition: data_sets.h:2889
void baro_callback(const barometer_t *const msg)
#define ROS_ERROR_STREAM(args)
uint8_t obsCount
Definition: data_sets.h:2914
uint32_t baseBeidouEphemerisCount
Definition: data_sets.h:2827
is_can_time time
Definition: CAN_comm.h:252
uint8_t dataType
Definition: data_sets.h:2911
int32_t frq
Definition: data_sets.h:2549
uint32_t offset
Definition: ISComm.h:382
float biasBaro
Definition: data_sets.h:912
ros::NodeHandle nh_
uint32_t startupNavDtMs
Definition: data_sets.h:1973
double fit
Definition: data_sets.h:2518
uint8_t differentialAge
Definition: CAN_comm.h:234
uint8_t SNR[1]
Definition: data_sets.h:2390
TFSIMD_FORCE_INLINE void setOrigin(const Vector3 &origin)
#define DID_BAROMETER
Definition: data_sets.h:87
uint32_t cycleSlipCount
Definition: data_sets.h:2773
inertial_sense_ros::GNSSObsVec obs_Vec_
float magDec
Definition: data_sets.h:915
uint8_t qualL[1]
Definition: data_sets.h:2399
bool perform_multi_mag_cal_srv_callback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
#define DID_INL2_STATES
Definition: data_sets.h:82
ros_stream_t diagnostics_
uint32_t baseGlonassObservationCount
Definition: data_sets.h:2785
double OMG0
Definition: data_sets.h:2479
double crc
Definition: data_sets.h:2497
double e
Definition: data_sets.h:2473
#define DID_GPS1_RTK_POS_MISC
Definition: data_sets.h:56
void INL2_states_callback(const inl2_states_t *const msg)
uint8_t * dataPtr
Definition: ISComm.h:510


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57