packet_publisher.cpp
Go to the documentation of this file.
1 #include "unistd.h"
2 #include <map>
3 #include <cmath>
4 
5 #include "packet_publisher.hpp"
6 
7 // Bound rotations
8 double BoundFromNegPiToPi(const double _value)
9 {
10  double num = std::fmod(_value, (2 * M_PI));
11  if (num > M_PI)
12  {
13  num = num - (2 * M_PI);
14  }
15  return num;
16 }
17 
18 double BoundFromNegPiToPi(const float _value)
19 {
20  double num = std::fmod(_value, (2 * M_PI));
21  if (num > M_PI)
22  {
23  num = num - (2 * M_PI);
24  }
25  return num;
26 }
27 
28 double BoundFromZeroTo2Pi(const double _value)
29 {
30  return std::fmod(_value, (2 * M_PI));
31 }
32 
33 double BoundFromZeroTo2Pi(const float _value)
34 {
35  return std::fmod(_value, (2 * M_PI));
36 }
37 
38 tf2::Quaternion quatFromRPY(double roll, double pitch, double yaw)
39 {
40  tf2::Quaternion quat;
41  quat.setRPY(roll, pitch, yaw);
42  return quat;
43 }
44 
46 // Custom ROS Message Publishers
49 {
50  kvh_geo_fog_3d_msgs::KvhGeoFog3DSystemState sysStateMsg;
51  sysStateMsg.header.stamp = ros::Time::now();
52 
53  sysStateMsg.system_status = _packet.system_status.r;
54  sysStateMsg.filter_status = _packet.filter_status.r;
55 
56  sysStateMsg.unix_time_s = _packet.unix_time_seconds;
57  sysStateMsg.unix_time_us = _packet.microseconds;
58 
59  sysStateMsg.latitude_rad = _packet.latitude;
60  sysStateMsg.longitude_rad = _packet.longitude;
61  sysStateMsg.height_m = _packet.height;
62 
63  sysStateMsg.absolute_velocity_north_mps = _packet.velocity[0];
64  sysStateMsg.absolute_velocity_east_mps = _packet.velocity[1];
65  sysStateMsg.absolute_velocity_down_mps = _packet.velocity[2];
66 
67  sysStateMsg.body_acceleration_x_mps = _packet.body_acceleration[0];
68  sysStateMsg.body_acceleration_y_mps = _packet.body_acceleration[1];
69  sysStateMsg.body_acceleration_z_mps = _packet.body_acceleration[2];
70 
71  sysStateMsg.g_force_g = _packet.g_force;
72 
73  sysStateMsg.roll_rad = _packet.orientation[0];
74  sysStateMsg.pitch_rad = _packet.orientation[1];
75  sysStateMsg.heading_rad = _packet.orientation[2];
76 
77  sysStateMsg.angular_velocity_x_rad_per_s = _packet.angular_velocity[0];
78  sysStateMsg.angular_velocity_y_rad_per_s = _packet.angular_velocity[1];
79  sysStateMsg.angular_velocity_z_rad_per_s = _packet.angular_velocity[2];
80 
81  sysStateMsg.latitude_stddev_m = _packet.standard_deviation[0];
82  sysStateMsg.longitude_stddev_m = _packet.standard_deviation[1];
83  sysStateMsg.height_stddev_m = _packet.standard_deviation[2];
84 
85  _publisher.publish(sysStateMsg);
86 }
87 
89 {
90  kvh_geo_fog_3d_msgs::KvhGeoFog3DSatellites satellitesMsg;
91  satellitesMsg.header.stamp = ros::Time::now();
92  satellitesMsg.hdop = _packet.hdop;
93  satellitesMsg.vdop = _packet.vdop;
94  satellitesMsg.gps_satellites = _packet.gps_satellites;
95  satellitesMsg.glonass_satellites = _packet.glonass_satellites;
96  satellitesMsg.beidou_satellites = _packet.beidou_satellites;
97  satellitesMsg.galileo_satellites = _packet.sbas_satellites;
98 
99  _publisher.publish(satellitesMsg);
100 }
101 
103 {
104  kvh_geo_fog_3d_msgs::KvhGeoFog3DDetailSatellites detailSatellitesMsg;
105 
106  detailSatellitesMsg.header.stamp = ros::Time::now();
107 
108  // MAXIMUM_DETAILED_SATELLITES is defined as 32 in spatial_packets.h
109  // We must check if each field equals 0 as that denotes the end of the array
110  for (int i = 0; i < MAXIMUM_DETAILED_SATELLITES; i++)
111  {
112  satellite_t satellite = _packet.satellites[i];
113 
114  // Check if all fields = 0, if so then we should end our loop
115  if (satellite.satellite_system == 0 && satellite.number == 0 &&
116  satellite.frequencies.r == 0 && satellite.elevation == 0 &&
117  satellite.azimuth == 0 && satellite.snr == 0)
118  {
119  break;
120  }
121 
122  detailSatellitesMsg.satellite_system.push_back(satellite.satellite_system);
123  detailSatellitesMsg.satellite_number.push_back(satellite.number);
124  detailSatellitesMsg.satellite_frequencies.push_back(satellite.frequencies.r);
125  detailSatellitesMsg.elevation_deg.push_back(satellite.elevation);
126  detailSatellitesMsg.azimuth_deg.push_back(satellite.azimuth);
127  detailSatellitesMsg.snr_decibal.push_back(satellite.snr);
128  }
129 
130  _publisher.publish(detailSatellitesMsg);
131 }
132 
134 {
135  kvh_geo_fog_3d_msgs::KvhGeoFog3DLocalMagneticField localMagFieldMsg;
136  localMagFieldMsg.header.stamp = ros::Time::now();
137  localMagFieldMsg.loc_mag_field_x_mG = _packet.magnetic_field[0];
138  localMagFieldMsg.loc_mag_field_y_mG = _packet.magnetic_field[1];
139  localMagFieldMsg.loc_mag_field_z_mG = _packet.magnetic_field[2];
140 
141  _publisher.publish(localMagFieldMsg);
142 }
143 
145 {
146  kvh_geo_fog_3d_msgs::KvhGeoFog3DUTMPosition utmPosMsg;
147  utmPosMsg.header.stamp = ros::Time::now();
148  utmPosMsg.northing_m = _packet.position[0];
149  utmPosMsg.easting_m = _packet.position[1];
150  utmPosMsg.height_m = _packet.position[2];
151  utmPosMsg.zone_character = _packet.zone;
152 
153  _publisher.publish(utmPosMsg);
154 }
155 
157 {
158  kvh_geo_fog_3d_msgs::KvhGeoFog3DECEFPos ecefPosMsg;
159  ecefPosMsg.header.stamp = ros::Time::now();
160  ecefPosMsg.ecef_x_m = _packet.position[0];
161  ecefPosMsg.ecef_y_m = _packet.position[1];
162  ecefPosMsg.ecef_z_m = _packet.position[2];
163 
164  _publisher.publish(ecefPosMsg);
165 }
166 
168 {
169  kvh_geo_fog_3d_msgs::KvhGeoFog3DNorthSeekingInitStatus northSeekInitStatMsg;
170  northSeekInitStatMsg.header.stamp = ros::Time::now();
171 
172  northSeekInitStatMsg.flags = _packet.north_seeking_status.r;
173  northSeekInitStatMsg.quadrant_1_data_per = _packet.quadrant_data_collection_progress[0];
174  northSeekInitStatMsg.quadrant_2_data_per = _packet.quadrant_data_collection_progress[1];
175  northSeekInitStatMsg.quadrant_3_data_per = _packet.quadrant_data_collection_progress[2];
176  northSeekInitStatMsg.quadrant_4_data_per = _packet.quadrant_data_collection_progress[3];
177 
178  northSeekInitStatMsg.current_rotation_angle_rad = _packet.current_rotation_angle;
179 
180  northSeekInitStatMsg.current_gyro_bias_sol_x_rad_s = _packet.current_gyroscope_bias_solution[0];
181  northSeekInitStatMsg.current_gyro_bias_sol_y_rad_s = _packet.current_gyroscope_bias_solution[1];
182  northSeekInitStatMsg.current_gyro_bias_sol_z_rad_s = _packet.current_gyroscope_bias_solution[2];
183  northSeekInitStatMsg.current_gyro_bias_sol_error_per = _packet.current_gyroscope_bias_solution_error;
184 
185  _publisher.publish(northSeekInitStatMsg);
186 }
187 
189 {
190  kvh_geo_fog_3d_msgs::KvhGeoFog3DOdometerState odometerStateMsg;
191  odometerStateMsg.header.stamp = ros::Time::now();
192  odometerStateMsg.odometer_pulse_count = _packet.pulse_count;
193  odometerStateMsg.odometer_distance_m = _packet.distance;
194  odometerStateMsg.odometer_speed_mps = _packet.speed;
195  odometerStateMsg.odometer_slip_m = _packet.slip;
196  odometerStateMsg.odometer_active = _packet.active;
197 
198  _publisher.publish(odometerStateMsg);
199 }
200 
202 {
203  kvh_geo_fog_3d_msgs::KvhGeoFog3DRawSensors rawSensorMsg;
204 
205  rawSensorMsg.header.stamp = ros::Time::now();
206 
207  rawSensorMsg.accelerometer_x_mpss = _packet.accelerometers[0];
208  rawSensorMsg.accelerometer_y_mpss = _packet.accelerometers[1];
209  rawSensorMsg.accelerometer_z_mpss = _packet.accelerometers[2];
210 
211  rawSensorMsg.gyro_x_rps = _packet.gyroscopes[0];
212  rawSensorMsg.gyro_y_rps = _packet.gyroscopes[1];
213  rawSensorMsg.gyro_z_rps = _packet.gyroscopes[2];
214 
215  rawSensorMsg.magnetometer_x_mG = _packet.magnetometers[0];
216  rawSensorMsg.magnetometer_y_mG = _packet.magnetometers[1];
217  rawSensorMsg.magnetometer_z_mG = _packet.magnetometers[2];
218 
219  rawSensorMsg.imu_temp_c = _packet.imu_temperature;
220  rawSensorMsg.pressure_pa = _packet.pressure;
221  rawSensorMsg.pressure_temp_c = _packet.pressure_temperature;
222 
223  _publisher.publish(rawSensorMsg);
224 }
225 
227 {
228  kvh_geo_fog_3d_msgs::KvhGeoFog3DRawGNSS rawGnssMsg;
229 
230  rawGnssMsg.header.stamp = ros::Time::now();
231  rawGnssMsg.unix_time_s = _packet.unix_time_seconds;
232  rawGnssMsg.unix_time_us = _packet.microseconds;
233 
234  rawGnssMsg.latitude_rad = _packet.position[0];
235  rawGnssMsg.longitude_rad = _packet.position[1];
236  rawGnssMsg.height_m = _packet.position[2];
237 
238  rawGnssMsg.latitude_stddev_m = _packet.position_standard_deviation[0];
239  rawGnssMsg.longitude_stddev_m = _packet.position_standard_deviation[1];
240  rawGnssMsg.height_stddev_m = _packet.position_standard_deviation[2];
241 
242  rawGnssMsg.vel_north_m = _packet.velocity[0];
243  rawGnssMsg.vel_east_m = _packet.velocity[1];
244  rawGnssMsg.vel_down_m = _packet.velocity[2];
245 
246  rawGnssMsg.tilt_rad = _packet.tilt;
247  rawGnssMsg.tilt_stddev_rad = _packet.tilt_standard_deviation;
248 
249  rawGnssMsg.heading_rad = _packet.heading;
250  rawGnssMsg.heading_stddev_rad = _packet.heading_standard_deviation;
251 
252  rawGnssMsg.gnss_fix = _packet.flags.b.fix_type;
253  rawGnssMsg.doppler_velocity_valid = _packet.flags.b.velocity_valid;
254  rawGnssMsg.time_valid = _packet.flags.b.time_valid;
255  rawGnssMsg.external_gnss = _packet.flags.b.external_gnss;
256  rawGnssMsg.tilt_valid = _packet.flags.b.tilt_valid;
257  rawGnssMsg.heading_valid = _packet.flags.b.heading_valid;
258 
259  _publisher.publish(rawGnssMsg);
260 }
261 
262 void PublishIMURaw(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
263 {
264  sensor_msgs::Imu imuRaw;
265  imuRaw.header.stamp = ros::Time::now();
266  imuRaw.header.frame_id = "imu_link_frd";
267 
268  // \todo Fill in orientation from sysState RPY? Or from quaternion packet
269  // imuRaw.orientation = ???
270  // Set not to use orientation
271  imuRaw.orientation_covariance[0] = -1;
272 
273  imuRaw.angular_velocity.x = _sysStatePacket.angular_velocity[0];
274  imuRaw.angular_velocity.y = _sysStatePacket.angular_velocity[1];
275  imuRaw.angular_velocity.z = _sysStatePacket.angular_velocity[2];
276  // Leave covariance at 0 since we don't have it
277  // imuRaw.angular_velocity_covariance[0]
278  // imuRaw.angular_velocity_covariance[4]
279  // imuRaw.angular_velocity_covariance[8]
280 
281  imuRaw.linear_acceleration.x = _sysStatePacket.body_acceleration[0];
282  imuRaw.linear_acceleration.y = _sysStatePacket.body_acceleration[1];
283  imuRaw.linear_acceleration.z = _sysStatePacket.body_acceleration[2];
284  // Leave covariance at 0 since we don't have it
285  // imuDataRaw.linear_acceleration_covariance[0]
286  // imuDataRaw.linear_acceleration_covariance[4]
287  // imuDataRaw.linear_acceleration_covariance[8]
288 
289  _publisher.publish(imuRaw);
290 }
291 
292 void PublishIMURawFLU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
293 {
294  sensor_msgs::Imu imuRawFLU;
295  imuRawFLU.header.stamp = ros::Time::now();
296  imuRawFLU.header.frame_id = "imu_link_flu";
297 
298  // \todo Fill in orientation from sysState RPY? Or from quaternion packet
299  // imuRaw.orientation = ???
300  // Set not to use orientation
301  imuRawFLU.orientation_covariance[0] = -1;
302 
303  // ANGULAR VELOCITY
304  imuRawFLU.angular_velocity.x = _sysStatePacket.angular_velocity[0];
305  imuRawFLU.angular_velocity.y = -1 * _sysStatePacket.angular_velocity[1];
306  imuRawFLU.angular_velocity.z = -1 * _sysStatePacket.angular_velocity[2]; // To account for east north up system
307  // Covarience should not care about offsets due to FRD to FLU conversion
308  // imuRawFLU.angular_velocity_covariance[0]
309  // imuRawFLU.angular_velocity_covariance[4]
310  // imuRawFLU.angular_velocity_covariance[8]
311 
312  // LINEAR ACCELERATION
313  imuRawFLU.linear_acceleration.x = _sysStatePacket.body_acceleration[0];
314  imuRawFLU.linear_acceleration.y = -1 * _sysStatePacket.body_acceleration[1];
315  imuRawFLU.linear_acceleration.z = -1 * _sysStatePacket.body_acceleration[2];
316  // Leave covariance at 0 since we don't have it
317  // imuRawFLU.linear_acceleration_covariance[0]
318  // imuRawFLU.linear_acceleration_covariance[4]
319  // imuRawFLU.linear_acceleration_covariance[8]
320 
321  _publisher.publish(imuRawFLU);
322 }
323 
325 {
326  sensor_msgs::Imu imuNED;
327  imuNED.header.stamp = ros::Time::now();
328  imuNED.header.frame_id = "imu_link_frd";
329 
330  // Orientation
331  double roll = _sysStatePacket.orientation[0];
332  double pitch = _sysStatePacket.orientation[1];
333  double yaw = _sysStatePacket.orientation[2];
334  double yawBounded = BoundFromZeroTo2Pi(yaw);
335  tf2::Quaternion q = quatFromRPY(roll, pitch, yawBounded);
336  imuNED.orientation.x = q.getX();
337  imuNED.orientation.y = q.getY();
338  imuNED.orientation.z = q.getZ();
339  imuNED.orientation.w = q.getW();
340  // Orientation covariance
341  imuNED.orientation_covariance[0] = pow(_eulStdDevPack.standard_deviation[0], 2);
342  imuNED.orientation_covariance[4] = pow(_eulStdDevPack.standard_deviation[1], 2);
343  imuNED.orientation_covariance[8] = pow(_eulStdDevPack.standard_deviation[2], 2);
344 
345  // ANGULAR VELOCITY
346  imuNED.angular_velocity.x = _sysStatePacket.angular_velocity[0];
347  imuNED.angular_velocity.y = _sysStatePacket.angular_velocity[1];
348  imuNED.angular_velocity.z = _sysStatePacket.angular_velocity[2];
349  // Covarience should not care about offsets due to FRD to FLU conversion
350  // imuRawFLU.angular_velocity_covariance[0]
351  // imuRawFLU.angular_velocity_covariance[4]
352  // imuRawFLU.angular_velocity_covariance[8]
353 
354  // LINEAR ACCELERATION
355  imuNED.linear_acceleration.x = _sysStatePacket.body_acceleration[0];
356  imuNED.linear_acceleration.y = _sysStatePacket.body_acceleration[1];
357  imuNED.linear_acceleration.z = _sysStatePacket.body_acceleration[2];
358  // Leave covariance at 0 since we don't have it
359  // imuRawFLU.linear_acceleration_covariance[0]
360  // imuRawFLU.linear_acceleration_covariance[4]
361  // imuRawFLU.linear_acceleration_covariance[8]
362 
363  _publisher.publish(imuNED);
364 }
365 
367 {
368  sensor_msgs::Imu imuENU;
369  imuENU.header.stamp = ros::Time::now();
370  imuENU.header.frame_id = "imu_link_flu";
371 
372  //For NED -> ENU transformation:
373  //(X -> Y, Y -> -X, Z -> -Z, Yaw = -Yaw + 90 deg, Pitch -> -Pitch, and Roll -> Roll)
374  double roll = _sysStatePacket.orientation[0];
375  double pitch = -1 * _sysStatePacket.orientation[1];
376  double yawNED = BoundFromZeroTo2Pi(_sysStatePacket.orientation[2]);
377  double yawENU = BoundFromZeroTo2Pi(-1 * yawNED + (M_PI_2));
378 
379  tf2::Quaternion q = quatFromRPY(roll, pitch, yawENU);
380 
381  imuENU.orientation.x = q.getX();
382  imuENU.orientation.y = q.getY();
383  imuENU.orientation.z = q.getZ();
384  imuENU.orientation.w = q.getW();
385 
386  imuENU.orientation_covariance[0] = pow(_eulStdDevPack.standard_deviation[0], 2);
387  imuENU.orientation_covariance[4] = pow(_eulStdDevPack.standard_deviation[1], 2);
388  imuENU.orientation_covariance[8] = pow(_eulStdDevPack.standard_deviation[2], 2);
389 
390  // ANGULAR VELOCITY
391  // Keep in mind that for the sensor_msgs/Imu message, accelerations are
392  // w.r.t the frame_id, which in this case is imu_link_flu.
393  imuENU.angular_velocity.x = _sysStatePacket.angular_velocity[0];
394  imuENU.angular_velocity.y = -1 * _sysStatePacket.angular_velocity[1];
395  imuENU.angular_velocity.z = -1 * _sysStatePacket.angular_velocity[2];
396 
397  // LINEAR ACCELERATION
398  // Keep in mind that for the sensor_msgs/Imu message, accelerations are
399  // w.r.t the frame_id, which in this case is imu_link_flu.
400  imuENU.linear_acceleration.x = _sysStatePacket.body_acceleration[0];
401  imuENU.linear_acceleration.y = -1 * _sysStatePacket.body_acceleration[1];
402  imuENU.linear_acceleration.z = -1 * _sysStatePacket.body_acceleration[2];
403 
404  _publisher.publish(imuENU);
405 }
406 
407 void PublishIMU_RPY_NED(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
408 {
409  geometry_msgs::Vector3Stamped imuRpyNED;
410  imuRpyNED.header.stamp = ros::Time::now();
411  imuRpyNED.header.frame_id = "imu_link_frd";
412 
413  double roll = _sysStatePacket.orientation[0];
414  double pitch = _sysStatePacket.orientation[1];
415  double yaw = _sysStatePacket.orientation[2];
416  double boundedYaw = BoundFromZeroTo2Pi(yaw);
417 
418  imuRpyNED.vector.x = roll;
419  imuRpyNED.vector.y = pitch;
420  imuRpyNED.vector.z = boundedYaw;
421 
422  _publisher.publish(imuRpyNED);
423 }
425 {
426  geometry_msgs::Vector3Stamped imuRpyNEDDeg;
427  imuRpyNEDDeg.header.stamp = ros::Time::now();
428  imuRpyNEDDeg.header.frame_id = "imu_link_frd";
429 
430  double roll = _sysStatePacket.orientation[0];
431  double pitch = _sysStatePacket.orientation[1];
432  double yaw = _sysStatePacket.orientation[2];
433  double boundedYaw = BoundFromZeroTo2Pi(yaw);
434 
435  imuRpyNEDDeg.vector.x = ((roll * 180.0) / M_PI);
436  imuRpyNEDDeg.vector.y = ((pitch * 180.0) / M_PI);
437  imuRpyNEDDeg.vector.z = ((boundedYaw * 180.0) / M_PI);
438 
439  _publisher.publish(imuRpyNEDDeg);
440 }
441 
442 void PublishIMU_RPY_ENU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
443 {
444  geometry_msgs::Vector3Stamped imuRpyENU;
445  imuRpyENU.header.stamp = ros::Time::now();
446  imuRpyENU.header.frame_id = "imu_link_flu";
447 
448  //For NED -> ENU transformation:
449  //(X -> Y, Y -> -X, Z -> -Z, Yaw = -Yaw + 90 deg, Pitch -> -Pitch, and Roll -> Roll)
450  double roll = _sysStatePacket.orientation[0];
451  double pitch = -1 * _sysStatePacket.orientation[1];
452  double yawNED = BoundFromZeroTo2Pi(_sysStatePacket.orientation[2]);
453  double yawENU = BoundFromZeroTo2Pi(-1 * yawNED + (M_PI_2));
454 
455  imuRpyENU.vector.x = roll;
456  imuRpyENU.vector.y = pitch;
457  imuRpyENU.vector.z = yawENU;
458 
459  _publisher.publish(imuRpyENU);
460 }
461 
463 {
464  geometry_msgs::Vector3Stamped imuRpyENUDeg;
465  imuRpyENUDeg.header.stamp = ros::Time::now();
466  imuRpyENUDeg.header.frame_id = "imu_link_flu";
467 
468  //For NED -> ENU transformation:
469  //(X -> Y, Y -> -X, Z -> -Z, Yaw = -Yaw + 90 deg, Pitch -> -Pitch, and Roll -> Roll)
470  double rollDeg = ((_sysStatePacket.orientation[0] * 180.0) / M_PI);
471  double pitchDeg = -1 * ((_sysStatePacket.orientation[1] * 180.0) / M_PI);
472  double yawNED = BoundFromZeroTo2Pi(_sysStatePacket.orientation[2]);
473  double yawENU = BoundFromZeroTo2Pi(-1 * yawNED + (M_PI_2));
474  double yawENUDeg = ((yawENU * 180.0) / M_PI);
475 
476  imuRpyENUDeg.vector.x = rollDeg;
477  imuRpyENUDeg.vector.y = pitchDeg;
478  imuRpyENUDeg.vector.z = yawENUDeg;
479 
480  _publisher.publish(imuRpyENUDeg);
481 }
482 
483 void PublishNavSatFix(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
484 {
485  sensor_msgs::NavSatFix navSatFixMsg;
486  navSatFixMsg.header.stamp = ros::Time::now();
487  navSatFixMsg.header.frame_id = "gps";
488 
489  // Set nav sat status
490  int status = _sysStatePacket.filter_status.b.gnss_fix_type;
491  switch (status)
492  {
493  case 0:
494  navSatFixMsg.status.status = navSatFixMsg.status.STATUS_NO_FIX;
495  break;
496  case 1:
497  case 2:
498  navSatFixMsg.status.status = navSatFixMsg.status.STATUS_FIX;
499  break;
500  case 3:
501  navSatFixMsg.status.status = navSatFixMsg.status.STATUS_SBAS_FIX;
502  break;
503  default:
504  navSatFixMsg.status.status = navSatFixMsg.status.STATUS_GBAS_FIX;
505  }
506 
507  //NavSatFix specifies degrees as lat/lon, but KVH publishes in radians
508  double latitude_deg = (_sysStatePacket.latitude * 180.0) / M_PI;
509  double longitude_deg = (_sysStatePacket.longitude * 180.0) / M_PI;
510  navSatFixMsg.latitude = latitude_deg;
511  navSatFixMsg.longitude = longitude_deg;
512  navSatFixMsg.altitude = _sysStatePacket.height;
513  navSatFixMsg.position_covariance_type = navSatFixMsg.COVARIANCE_TYPE_DIAGONAL_KNOWN;
514  // They use ENU for mat for this matrix.
515  navSatFixMsg.position_covariance[0] = pow(_sysStatePacket.standard_deviation[1], 2);
516  navSatFixMsg.position_covariance[4] = pow(_sysStatePacket.standard_deviation[0], 2);
517  navSatFixMsg.position_covariance[8] = pow(_sysStatePacket.standard_deviation[2], 2);
518 
519  _publisher.publish(navSatFixMsg);
520 }
521 
522 void PublishRawNavSatFix(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, raw_gnss_packet_t _rawGnssPacket)
523 {
524  sensor_msgs::NavSatFix rawNavSatFixMsg;
525  rawNavSatFixMsg.header.stamp = ros::Time::now();
526  rawNavSatFixMsg.header.frame_id = "gps";
527 
528  //NavSatFix specifies degrees as lat/lon, but KVH publishes in radians
529  double rawGnssLatitude_deg = (_rawGnssPacket.position[0] * 180.0) / M_PI;
530  double rawGnssLongitude_deg = (_rawGnssPacket.position[1] * 180.0) / M_PI;
531  rawNavSatFixMsg.latitude = rawGnssLatitude_deg;
532  rawNavSatFixMsg.longitude = rawGnssLongitude_deg;
533  rawNavSatFixMsg.altitude = _rawGnssPacket.position[2];
534 
535  int status = _sysStatePacket.filter_status.b.gnss_fix_type;
536  switch (status)
537  {
538  case 0:
539  rawNavSatFixMsg.status.status = rawNavSatFixMsg.status.STATUS_NO_FIX;
540  break;
541  case 1:
542  case 2:
543  rawNavSatFixMsg.status.status = rawNavSatFixMsg.status.STATUS_FIX;
544  break;
545  case 3:
546  rawNavSatFixMsg.status.status = rawNavSatFixMsg.status.STATUS_SBAS_FIX;
547  break;
548  default:
549  rawNavSatFixMsg.status.status = rawNavSatFixMsg.status.STATUS_GBAS_FIX;
550  }
551 
552  rawNavSatFixMsg.position_covariance_type = rawNavSatFixMsg.COVARIANCE_TYPE_DIAGONAL_KNOWN;
553  // They use ENU for mat for this matrix. To me it makes sense that we should use
554  // the longitude standard deviation for east.
555  rawNavSatFixMsg.position_covariance[0] = pow(_rawGnssPacket.position_standard_deviation[1], 2);
556  rawNavSatFixMsg.position_covariance[4] = pow(_rawGnssPacket.position_standard_deviation[0], 2);
557  rawNavSatFixMsg.position_covariance[8] = pow(_rawGnssPacket.position_standard_deviation[2], 2);
558 
559  _publisher.publish(rawNavSatFixMsg);
560 }
561 
562 void PublishMagField(ros::Publisher &_publisher, raw_sensors_packet_t _rawSensorPack)
563 {
564  sensor_msgs::MagneticField magFieldMsg;
565 
566  magFieldMsg.header.stamp = ros::Time::now();
567  magFieldMsg.header.frame_id = "imu_link_frd";
568  magFieldMsg.magnetic_field.x = _rawSensorPack.magnetometers[0];
569  magFieldMsg.magnetic_field.y = _rawSensorPack.magnetometers[1];
570  magFieldMsg.magnetic_field.z = _rawSensorPack.magnetometers[2];
571 
572  _publisher.publish(magFieldMsg);
573 }
574 
575 void PublishOdomNED(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, utm_position_packet_t _utmPosPacket,
577 {
578  nav_msgs::Odometry odomMsgNED;
579  odomMsgNED.header.stamp = ros::Time::now();
580  odomMsgNED.header.frame_id = "utm_ned"; //The nav_msgs/Odometry "Pose" section should be in this frame
581  odomMsgNED.child_frame_id = "imu_link_frd"; //The nav_msgs/Odometry "Twist" section should be in this frame
582 
583  // Position NED
584  odomMsgNED.pose.pose.position.x = _utmPosPacket.position[0];
585  odomMsgNED.pose.pose.position.y = _utmPosPacket.position[1];
586  odomMsgNED.pose.pose.position.z = -1 * _utmPosPacket.position[2];
587  odomMsgNED.pose.covariance[0] = _sysStatePacket.standard_deviation[0];
588  odomMsgNED.pose.covariance[7] = _sysStatePacket.standard_deviation[1];
589  odomMsgNED.pose.covariance[14] = _sysStatePacket.standard_deviation[2];
590 
591  // Orientation
592  double roll = _sysStatePacket.orientation[0];
593  double pitch = _sysStatePacket.orientation[1];
594  double yaw = BoundFromZeroTo2Pi(_sysStatePacket.orientation[2]);
595  tf2::Quaternion q = quatFromRPY(roll, pitch, yaw);
596  odomMsgNED.pose.pose.orientation.x = q.getX();
597  odomMsgNED.pose.pose.orientation.y = q.getY();
598  odomMsgNED.pose.pose.orientation.z = q.getZ();
599  odomMsgNED.pose.pose.orientation.w = q.getW();
600 
601  odomMsgNED.pose.covariance[21] = pow(_eulerStdPacket.standard_deviation[1], 2);
602  odomMsgNED.pose.covariance[28] = pow(_eulerStdPacket.standard_deviation[0], 2);
603  odomMsgNED.pose.covariance[35] = pow(_eulerStdPacket.standard_deviation[2], 2);
604 
605  // NED uses FRD rates/accels
606  odomMsgNED.twist.twist.linear.x = _bodyVelPacket.velocity[0];
607  odomMsgNED.twist.twist.linear.y = _bodyVelPacket.velocity[1];
608  odomMsgNED.twist.twist.linear.z = _bodyVelPacket.velocity[2];
609  odomMsgNED.twist.covariance[0] = 0.0001;
610  odomMsgNED.twist.covariance[7] = 0.0001;
611  odomMsgNED.twist.covariance[14] = 0.0001;
612 
613  odomMsgNED.twist.twist.angular.x = _sysStatePacket.angular_velocity[0];
614  odomMsgNED.twist.twist.angular.y = _sysStatePacket.angular_velocity[1];
615  odomMsgNED.twist.twist.angular.z = _sysStatePacket.angular_velocity[2];
616  odomMsgNED.twist.covariance[21] = 0.0001;
617  odomMsgNED.twist.covariance[28] = 0.0001;
618  odomMsgNED.twist.covariance[35] = 0.0001;
619 
620  _publisher.publish(odomMsgNED);
621 }
622 
623 void PublishOdomENU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, utm_position_packet_t _utmPosPacket,
625 {
626  nav_msgs::Odometry odomMsgENU;
627  odomMsgENU.header.stamp = ros::Time::now();
628  odomMsgENU.header.frame_id = "utm_enu"; //The nav_msgs/Odometry "Pose" section should be in this frame
629  odomMsgENU.child_frame_id = "imu_link_flu"; //The nav_msgs/Odometry "Twist" section should be in this frame
630 
631  // POSE
632  // Position ENU
633  odomMsgENU.pose.pose.position.x = _utmPosPacket.position[1];
634  odomMsgENU.pose.pose.position.y = _utmPosPacket.position[0];
635  odomMsgENU.pose.pose.position.z = _utmPosPacket.position[2];
636  odomMsgENU.pose.covariance[0] = _sysStatePacket.standard_deviation[0];
637  odomMsgENU.pose.covariance[7] = _sysStatePacket.standard_deviation[1];
638  odomMsgENU.pose.covariance[14] = _sysStatePacket.standard_deviation[2];
639 
640  // Orientation
641  //For NED -> ENU transformation:
642  //(X -> Y, Y -> -X, Z -> -Z, Yaw = -Yaw + 90 deg, Pitch -> -Pitch, and Roll -> Roll)
643  double roll = _sysStatePacket.orientation[0];
644  double pitch = -1 * _sysStatePacket.orientation[1];
645  double yawNED = BoundFromZeroTo2Pi(_sysStatePacket.orientation[2]);
646  double yawENU = (-1 * yawNED + M_PI_2);
647  tf2::Quaternion q = quatFromRPY(roll, pitch, yawENU);
648 
649  // Orientation ENU
650  // Use orientation quaternion we created earlier
651  odomMsgENU.pose.pose.orientation.x = q.getX();
652  odomMsgENU.pose.pose.orientation.y = q.getY();
653  odomMsgENU.pose.pose.orientation.z = q.getZ();
654  odomMsgENU.pose.pose.orientation.w = q.getW();
655 
656  // Use covariance array created earlier to fill out orientation covariance
657  odomMsgENU.pose.covariance[21] = pow(_eulStdPacket.standard_deviation[1], 2);
658  odomMsgENU.pose.covariance[28] = pow(_eulStdPacket.standard_deviation[0], 2);
659  odomMsgENU.pose.covariance[35] = pow(_eulStdPacket.standard_deviation[2], 2);
660 
661  // ENU uses FLU rates/accels
662  odomMsgENU.twist.twist.linear.x = _bodyVelPacket.velocity[0];
663  odomMsgENU.twist.twist.linear.y = -(_bodyVelPacket.velocity[1]);
664  odomMsgENU.twist.twist.linear.z = -(_bodyVelPacket.velocity[2]);
665  odomMsgENU.twist.covariance[0] = 0.0001;
666  odomMsgENU.twist.covariance[7] = 0.0001;
667  odomMsgENU.twist.covariance[14] = 0.0001;
668 
669  odomMsgENU.twist.twist.angular.x = _sysStatePacket.angular_velocity[0];
670  odomMsgENU.twist.twist.angular.y = (-1 * _sysStatePacket.angular_velocity[1]);
671  odomMsgENU.twist.twist.angular.z = (-1 * _sysStatePacket.angular_velocity[2]);
672  odomMsgENU.twist.covariance[21] = 0.0001;
673  odomMsgENU.twist.covariance[28] = 0.0001;
674  odomMsgENU.twist.covariance[35] = 0.0001;
675 
676  _publisher.publish(odomMsgENU);
677 }
678 
679 void PublishOdomState(ros::Publisher &_publisher, odometer_state_packet_t _odomStatePacket, double odomPulseToMeters)
680 {
681  nav_msgs::Odometry kvhOdomStateMsg;
682 
683  kvhOdomStateMsg.header.stamp = ros::Time::now();
684 
685  //Technically this should be w.r.t the fixed frame locked to your wheel
686  //with the encoder mounted. But, since I don't know what you're going to
687  //call it, we'll stick with base_link.
688  kvhOdomStateMsg.header.frame_id = "base_link";
689 
690  kvhOdomStateMsg.pose.pose.position.x = (_odomStatePacket.pulse_count * odomPulseToMeters);
691 
692  kvhOdomStateMsg.pose.pose.position.x = (_odomStatePacket.pulse_count * odomPulseToMeters);
693  kvhOdomStateMsg.pose.pose.position.y = 0;
694  kvhOdomStateMsg.pose.pose.position.z = 0;
695  kvhOdomStateMsg.twist.twist.linear.x = _odomStatePacket.speed;
696  kvhOdomStateMsg.twist.twist.linear.y = 0;
697  kvhOdomStateMsg.twist.twist.linear.z = 0;
698 
699  _publisher.publish(kvhOdomStateMsg);
700 }
701 
702 void PublishOdomSpeed(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, odometer_state_packet_t _odomStatePacket,
703  double _trackWidth, double _odometerVelocityCovariance, bool _encoderOnLeft)
704 {
705  double yawRate = _sysStatePacket.angular_velocity[2];
706  //Derived from r = v/w, with r = radius of curvature, v = velocity, and w = angular rate,
707  //and given angular rate is the same at the wheel as it is at center axle.
708  double trackWidth = _trackWidth;
709  double vehicleVelocity;
710  if (_encoderOnLeft)
711  {
712  vehicleVelocity = _odomStatePacket.speed + (0.5 * trackWidth * yawRate);
713  } //end: if( initOptions.encoderOnLeft )
714  else
715  {
716  vehicleVelocity = _odomStatePacket.speed - (0.5 * trackWidth * yawRate);
717  } //end: else
718 
719  geometry_msgs::TwistWithCovarianceStamped kvhOdomVehSpeedMsg;
720 
721  kvhOdomVehSpeedMsg.header.stamp = ros::Time::now();
722  kvhOdomVehSpeedMsg.header.frame_id = "base_link";
723 
724  kvhOdomVehSpeedMsg.twist.twist.linear.x = vehicleVelocity;
725  kvhOdomVehSpeedMsg.twist.twist.linear.y = 0.0;
726  kvhOdomVehSpeedMsg.twist.twist.linear.z = 0.0;
727  kvhOdomVehSpeedMsg.twist.covariance[0] = _odometerVelocityCovariance;
728  kvhOdomVehSpeedMsg.twist.covariance[7] = _odometerVelocityCovariance;
729  kvhOdomVehSpeedMsg.twist.covariance[14] = _odometerVelocityCovariance;
730 
731  _publisher.publish(kvhOdomVehSpeedMsg);
732 }
733 
734 void PublishIMUSensorRaw(ros::Publisher &_publisher, raw_sensors_packet_t _rawSensorPack)
735 {
736  sensor_msgs::Imu imuRaw;
737  imuRaw.header.stamp = ros::Time::now();
738  imuRaw.header.frame_id = "imu_link_frd";
739 
740  // No orientation, so set cov to -1
741  imuRaw.orientation_covariance[0] = -1;
742 
743  // ANGULAR VELOCITY
744  imuRaw.angular_velocity.x = _rawSensorPack.gyroscopes[0];
745  imuRaw.angular_velocity.y = _rawSensorPack.gyroscopes[1];
746  imuRaw.angular_velocity.z = _rawSensorPack.gyroscopes[2];
747 
748  // LINEAR ACCELERATION
749  imuRaw.linear_acceleration.x = _rawSensorPack.accelerometers[0];
750  imuRaw.linear_acceleration.y = _rawSensorPack.accelerometers[1];
751  imuRaw.linear_acceleration.z = _rawSensorPack.accelerometers[2];
752 
753  _publisher.publish(imuRaw);
754 }
755 
757 {
758  sensor_msgs::Imu imuRawFLU;
759  imuRawFLU.header.stamp = ros::Time::now();
760  imuRawFLU.header.frame_id = "imu_link_flu";
761 
762  // ANGULAR VELOCITY
763  imuRawFLU.angular_velocity.x = _rawSensorPack.gyroscopes[0];
764  imuRawFLU.angular_velocity.y = -1 * _rawSensorPack.gyroscopes[1];
765  imuRawFLU.angular_velocity.z = -1 * _rawSensorPack.gyroscopes[2]; // To account for east north up system
766 
767  // LINEAR ACCELERATION
768  imuRawFLU.linear_acceleration.x = _rawSensorPack.accelerometers[0];
769  imuRawFLU.linear_acceleration.y = -1 * _rawSensorPack.accelerometers[1];
770  imuRawFLU.linear_acceleration.z = -1 * _rawSensorPack.accelerometers[2];
771 
772  _publisher.publish(imuRawFLU);
773 }
774 
776 {
777  geometry_msgs::TwistWithCovarianceStamped velNED;
778  velNED.header.frame_id = "utm_ned";
779  velNED.header.stamp = ros::Time::now();
780  velNED.twist.twist.linear.x = _sysStatePack.velocity[0];
781  velNED.twist.twist.linear.y = _sysStatePack.velocity[1];
782  velNED.twist.twist.linear.z = _sysStatePack.velocity[2];
783 
784  velNED.twist.covariance[0] = pow(_velStdPack.standard_deviation[0], 2);
785  velNED.twist.covariance[7] = pow(_velStdPack.standard_deviation[1], 2);
786  velNED.twist.covariance[14] = pow(_velStdPack.standard_deviation[2], 2);
787 
788  _publisher.publish(velNED);
789 }
790 
792 {
793  geometry_msgs::TwistWithCovarianceStamped velENU;
794  velENU.header.frame_id = "utm_enu";
795  velENU.header.stamp = ros::Time::now();
796  velENU.twist.twist.linear.x = _sysStatePack.velocity[1];
797  velENU.twist.twist.linear.y = _sysStatePack.velocity[0];
798  velENU.twist.twist.linear.z = -1 * (_sysStatePack.velocity[2]);
799 
800  velENU.twist.covariance[0] = pow(_velStdPack.standard_deviation[1], 2);
801  velENU.twist.covariance[7] = pow(_velStdPack.standard_deviation[0], 2);
802  velENU.twist.covariance[14] = pow(_velStdPack.standard_deviation[2], 2);
803 
804  _publisher.publish(velENU);
805 }
806 
809 {
810  geometry_msgs::TwistWithCovarianceStamped bodyVelFLU;
811  bodyVelFLU.header.frame_id = "imu_link_flu";
812  bodyVelFLU.header.stamp = ros::Time::now();
813  bodyVelFLU.twist.twist.linear.x = _bodyVelPack.velocity[0];
814  bodyVelFLU.twist.twist.linear.y = -(_bodyVelPack.velocity[1]);
815  bodyVelFLU.twist.twist.linear.z = -(_bodyVelPack.velocity[2]);
816 
817  double heading = _sysStatePacket.orientation[2];
818  double bodyVelStdDevX = (_velStdPack.standard_deviation[0] * cos(heading)) - (_velStdPack.standard_deviation[1] * sin(heading));
819  double bodyVelStdDevY = (_velStdPack.standard_deviation[0] * sin(heading)) + (_velStdPack.standard_deviation[1] * cos(heading));
820  bodyVelFLU.twist.covariance[0] = pow(bodyVelStdDevX, 2);
821  bodyVelFLU.twist.covariance[7] = pow(bodyVelStdDevY, 2);
822  bodyVelFLU.twist.covariance[14] = pow(_velStdPack.standard_deviation[2], 2);
823 
824  _publisher.publish(bodyVelFLU);
825 }
826 
829 {
830  geometry_msgs::TwistWithCovarianceStamped bodyVelFRD;
831  bodyVelFRD.header.frame_id = "imu_link_frd";
832  bodyVelFRD.header.stamp = ros::Time::now();
833  bodyVelFRD.twist.twist.linear.x = _bodyVelPack.velocity[0];
834  bodyVelFRD.twist.twist.linear.y = _bodyVelPack.velocity[1];
835  bodyVelFRD.twist.twist.linear.z = _bodyVelPack.velocity[2];
836 
837  double heading = _sysStatePacket.orientation[2];
838  double bodyVelStdDevX = (_velStdPack.standard_deviation[0] * cos(heading)) - (_velStdPack.standard_deviation[1] * sin(heading));
839  double bodyVelStdDevY = (_velStdPack.standard_deviation[0] * sin(heading)) + (_velStdPack.standard_deviation[1] * cos(heading));
840  bodyVelFRD.twist.covariance[0] = pow(bodyVelStdDevX, 2);
841  bodyVelFRD.twist.covariance[7] = pow(bodyVelStdDevY, 2);
842  bodyVelFRD.twist.covariance[14] = pow(_velStdPack.standard_deviation[2], 2);
843 
844  _publisher.publish(bodyVelFRD);
845 }
system_state_packet_t::r
uint16_t r
Definition: spatial_packets.h:250
system_state_packet_t::system_status
union system_state_packet_t::@0 system_status
raw_gnss_packet_t::position
double position[3]
Definition: spatial_packets.h:406
PublishIMU_RPY_NED
void PublishIMU_RPY_NED(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:407
system_state_packet_t::filter_status
union system_state_packet_t::@1 filter_status
raw_sensors_packet_t::gyroscopes
float gyroscopes[3]
Definition: spatial_packets.h:395
velocity_standard_deviation_packet_t
Definition: spatial_packets.h:377
satellites_packet_t::beidou_satellites
uint8_t beidou_satellites
Definition: spatial_packets.h:434
ros::Publisher
odometer_state_packet_t::speed
float speed
Definition: spatial_packets.h:590
euler_orientation_standard_deviation_packet_t::standard_deviation
float standard_deviation[3]
Definition: spatial_packets.h:384
odometer_state_packet_t::pulse_count
int32_t pulse_count
Definition: spatial_packets.h:588
satellites_packet_t
Definition: spatial_packets.h:428
PublishNorthSeekingStatus
void PublishNorthSeekingStatus(ros::Publisher &_publisher, north_seeking_status_packet_t _packet)
Definition: packet_publisher.cpp:167
north_seeking_status_packet_t
Definition: spatial_packets.h:744
system_state_packet_t::unix_time_seconds
uint32_t unix_time_seconds
Definition: spatial_packets.h:292
satellite_t
Definition: spatial_packets.h:452
north_seeking_status_packet_t::current_rotation_angle
float current_rotation_angle
Definition: spatial_packets.h:759
system_state_packet_t::latitude
double latitude
Definition: spatial_packets.h:294
tf2::Quaternion::getW
const TF2SIMD_FORCE_INLINE tf2Scalar & getW() const
PublishVelNEDTwist
void PublishVelNEDTwist(ros::Publisher &_publisher, system_state_packet_t _sysStatePack, velocity_standard_deviation_packet_t _velStdPack)
Definition: packet_publisher.cpp:775
odometer_state_packet_t::distance
float distance
Definition: spatial_packets.h:589
system_state_packet_t::b
struct system_state_packet_t::@0::@2 b
quatFromRPY
tf2::Quaternion quatFromRPY(double roll, double pitch, double yaw)
Definition: packet_publisher.cpp:38
detailed_satellites_packet_t
Definition: spatial_packets.h:476
PublishKvhOdometerState
void PublishKvhOdometerState(ros::Publisher &_publisher, odometer_state_packet_t _packet)
Definition: packet_publisher.cpp:188
tf2::Quaternion::setRPY
void setRPY(const tf2Scalar &roll, const tf2Scalar &pitch, const tf2Scalar &yaw)
raw_gnss_packet_t::tilt
float tilt
Definition: spatial_packets.h:409
PublishRawGnss
void PublishRawGnss(ros::Publisher &_publisher, raw_gnss_packet_t _packet)
Definition: packet_publisher.cpp:226
PublishRawSensors
void PublishRawSensors(ros::Publisher &_publisher, raw_sensors_packet_t _packet)
Definition: packet_publisher.cpp:201
satellite_t::number
uint8_t number
Definition: spatial_packets.h:455
satellite_t::azimuth
uint16_t azimuth
Definition: spatial_packets.h:472
BoundFromNegPiToPi
double BoundFromNegPiToPi(const double _value)
Definition: packet_publisher.cpp:8
PublishIMURaw
void PublishIMURaw(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:262
north_seeking_status_packet_t::quadrant_data_collection_progress
uint8_t quadrant_data_collection_progress[4]
Definition: spatial_packets.h:758
velocity_standard_deviation_packet_t::standard_deviation
float standard_deviation[3]
Definition: spatial_packets.h:379
odometer_state_packet_t::slip
float slip
Definition: spatial_packets.h:591
PublishUtmPosition
void PublishUtmPosition(ros::Publisher &_publisher, utm_position_packet_t _packet)
Definition: packet_publisher.cpp:144
north_seeking_status_packet_t::north_seeking_status
union north_seeking_status_packet_t::@20 north_seeking_status
raw_gnss_packet_t
Definition: spatial_packets.h:402
raw_gnss_packet_t::unix_time_seconds
uint32_t unix_time_seconds
Definition: spatial_packets.h:404
system_state_packet_t::microseconds
uint32_t microseconds
Definition: spatial_packets.h:293
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
PublishSystemState
void PublishSystemState(ros::Publisher &_publisher, system_state_packet_t _packet)
Definition: packet_publisher.cpp:48
PublishIMU_RPY_ENU
void PublishIMU_RPY_ENU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:442
satellites_packet_t::gps_satellites
uint8_t gps_satellites
Definition: spatial_packets.h:432
system_state_packet_t::body_acceleration
float body_acceleration[3]
Definition: spatial_packets.h:298
PublishLocalMagnetics
void PublishLocalMagnetics(ros::Publisher &_publisher, local_magnetics_packet_t _packet)
Definition: packet_publisher.cpp:133
odometer_state_packet_t
Definition: spatial_packets.h:586
PublishIMU_RPY_ENU_DEG
void PublishIMU_RPY_ENU_DEG(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:462
satellites_packet_t::hdop
float hdop
Definition: spatial_packets.h:430
raw_sensors_packet_t::imu_temperature
float imu_temperature
Definition: spatial_packets.h:397
utm_position_packet_t::position
double position[3]
Definition: spatial_packets.h:493
raw_gnss_packet_t::b
struct raw_gnss_packet_t::@8::@9 b
body_velocity_packet_t
Definition: spatial_packets.h:502
euler_orientation_standard_deviation_packet_t
Definition: spatial_packets.h:382
body_velocity_packet_t::velocity
float velocity[3]
Definition: spatial_packets.h:504
PublishSatellites
void PublishSatellites(ros::Publisher &_publisher, satellites_packet_t _packet)
Definition: packet_publisher.cpp:88
packet_publisher.hpp
PublishIMUSensorRaw
void PublishIMUSensorRaw(ros::Publisher &_publisher, raw_sensors_packet_t _rawSensorPack)
Definition: packet_publisher.cpp:734
local_magnetics_packet_t::magnetic_field
float magnetic_field[3]
Definition: spatial_packets.h:583
utm_position_packet_t
Definition: spatial_packets.h:491
PublishRawNavSatFix
void PublishRawNavSatFix(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, raw_gnss_packet_t _rawGnssPacket)
Definition: packet_publisher.cpp:522
PublishIMUSensorRawFLU
void PublishIMUSensorRawFLU(ros::Publisher &_publisher, raw_sensors_packet_t _rawSensorPack)
Definition: packet_publisher.cpp:756
system_state_packet_t::longitude
double longitude
Definition: spatial_packets.h:295
PublishNavSatFix
void PublishNavSatFix(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:483
satellite_t::r
uint8_t r
Definition: spatial_packets.h:458
PublishVelBodyTwistFLU
void PublishVelBodyTwistFLU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, body_velocity_packet_t _bodyVelPack, velocity_standard_deviation_packet_t _velStdPack)
Definition: packet_publisher.cpp:807
ecef_position_packet_t::position
double position[3]
Definition: spatial_packets.h:488
ecef_position_packet_t
Definition: spatial_packets.h:486
system_state_packet_t::standard_deviation
float standard_deviation[3]
Definition: spatial_packets.h:302
north_seeking_status_packet_t::r
uint16_t r
Definition: spatial_packets.h:748
raw_gnss_packet_t::velocity
float velocity[3]
Definition: spatial_packets.h:407
PublishVelBodyTwistFRD
void PublishVelBodyTwistFRD(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, body_velocity_packet_t _bodyVelPack, velocity_standard_deviation_packet_t _velStdPack)
Definition: packet_publisher.cpp:827
satellite_t::snr
uint8_t snr
Definition: spatial_packets.h:473
raw_gnss_packet_t::position_standard_deviation
float position_standard_deviation[3]
Definition: spatial_packets.h:408
PublishEcefPosition
void PublishEcefPosition(ros::Publisher &_publisher, ecef_position_packet_t _packet)
Definition: packet_publisher.cpp:156
PublishIMURawFLU
void PublishIMURawFLU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:292
satellite_t::elevation
uint8_t elevation
Definition: spatial_packets.h:471
local_magnetics_packet_t
Definition: spatial_packets.h:581
system_state_packet_t::angular_velocity
float angular_velocity[3]
Definition: spatial_packets.h:301
BoundFromZeroTo2Pi
double BoundFromZeroTo2Pi(const double _value)
Definition: packet_publisher.cpp:28
detailed_satellites_packet_t::satellites
satellite_t satellites[MAXIMUM_DETAILED_SATELLITES]
Definition: spatial_packets.h:478
system_state_packet_t::g_force
float g_force
Definition: spatial_packets.h:299
PublishSatellitesDetailed
void PublishSatellitesDetailed(ros::Publisher &_publisher, detailed_satellites_packet_t _packet)
Definition: packet_publisher.cpp:102
system_state_packet_t::orientation
float orientation[3]
Definition: spatial_packets.h:300
raw_gnss_packet_t::heading_standard_deviation
float heading_standard_deviation
Definition: spatial_packets.h:412
satellite_t::satellite_system
uint8_t satellite_system
Definition: spatial_packets.h:454
raw_gnss_packet_t::heading
float heading
Definition: spatial_packets.h:410
raw_sensors_packet_t::pressure
float pressure
Definition: spatial_packets.h:398
PublishOdomENU
void PublishOdomENU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, utm_position_packet_t _utmPosPacket, euler_orientation_standard_deviation_packet_t _eulStdPacket, body_velocity_packet_t _bodyVelPacket)
Definition: packet_publisher.cpp:623
PublishIMU_NED
void PublishIMU_NED(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, euler_orientation_standard_deviation_packet_t _eulStdDevPack)
Definition: packet_publisher.cpp:324
utm_position_packet_t::zone
char zone
Definition: spatial_packets.h:494
PublishVelENUTwist
void PublishVelENUTwist(ros::Publisher &_publisher, system_state_packet_t _sysStatePack, velocity_standard_deviation_packet_t _velStdPack)
Definition: packet_publisher.cpp:791
raw_gnss_packet_t::tilt_standard_deviation
float tilt_standard_deviation
Definition: spatial_packets.h:411
satellites_packet_t::glonass_satellites
uint8_t glonass_satellites
Definition: spatial_packets.h:433
satellites_packet_t::vdop
float vdop
Definition: spatial_packets.h:431
raw_sensors_packet_t::pressure_temperature
float pressure_temperature
Definition: spatial_packets.h:399
system_state_packet_t::height
double height
Definition: spatial_packets.h:296
north_seeking_status_packet_t::current_gyroscope_bias_solution_error
float current_gyroscope_bias_solution_error
Definition: spatial_packets.h:761
PublishMagField
void PublishMagField(ros::Publisher &_publisher, raw_sensors_packet_t _rawSensorPack)
Definition: packet_publisher.cpp:562
PublishOdomState
void PublishOdomState(ros::Publisher &_publisher, odometer_state_packet_t _odomStatePacket, double odomPulseToMeters)
Definition: packet_publisher.cpp:679
tf2::Quaternion
PublishIMU_RPY_NED_DEG
void PublishIMU_RPY_NED_DEG(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket)
Definition: packet_publisher.cpp:424
raw_gnss_packet_t::microseconds
uint32_t microseconds
Definition: spatial_packets.h:405
PublishIMU_ENU
void PublishIMU_ENU(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, euler_orientation_standard_deviation_packet_t _eulStdDevPack)
Definition: packet_publisher.cpp:366
north_seeking_status_packet_t::current_gyroscope_bias_solution
float current_gyroscope_bias_solution[3]
Definition: spatial_packets.h:760
satellite_t::frequencies
union satellite_t::@10 frequencies
raw_gnss_packet_t::flags
union raw_gnss_packet_t::@8 flags
PublishOdomNED
void PublishOdomNED(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, utm_position_packet_t _utmPosPacket, euler_orientation_standard_deviation_packet_t _eulerStdPacket, body_velocity_packet_t _bodyVelPacket)
Definition: packet_publisher.cpp:575
satellites_packet_t::sbas_satellites
uint8_t sbas_satellites
Definition: spatial_packets.h:436
system_state_packet_t::velocity
float velocity[3]
Definition: spatial_packets.h:297
PublishOdomSpeed
void PublishOdomSpeed(ros::Publisher &_publisher, system_state_packet_t _sysStatePacket, odometer_state_packet_t _odomStatePacket, double _trackWidth, double _odometerVelocityCovariance, bool _encoderOnLeft)
Definition: packet_publisher.cpp:702
raw_sensors_packet_t::accelerometers
float accelerometers[3]
Definition: spatial_packets.h:394
odometer_state_packet_t::active
uint8_t active
Definition: spatial_packets.h:592
system_state_packet_t
Definition: spatial_packets.h:246
raw_sensors_packet_t::magnetometers
float magnetometers[3]
Definition: spatial_packets.h:396
MAXIMUM_DETAILED_SATELLITES
#define MAXIMUM_DETAILED_SATELLITES
Definition: spatial_packets.h:39
ros::Time::now
static Time now()
raw_sensors_packet_t
Definition: spatial_packets.h:392


kvh_geo_fog_3d_driver
Author(s): Trevor Bostic , Zach LaCelle
autogenerated on Wed Mar 2 2022 00:28:57