ros.h
Go to the documentation of this file.
1 /**************************************************************************/ /**
2  * @brief ROS support messages.
3  * @file
4  ******************************************************************************/
5 
6 #pragma once
7 
9 
10 namespace point_one {
11 namespace fusion_engine {
12 namespace messages {
13 namespace ros {
14 
15 // Enforce 4-byte alignment and packing of all data structures and values.
16 // Floating point values are aligned on platforms that require it. This is done
17 // with a combination of setting struct attributes, and manual alignment
18 // within the definitions. See the "Message Packing" section of the README.
19 #pragma pack(push, 1)
20 
21 /**
22  * @defgroup ros_messages ROS Support Message Definitions
23  * @brief Messages designed for direct translation to ROS.
24  * @ingroup messages
25  *
26  * The messages defined in this file are intended to be translated into their
27  * corresponding ROS message structures where ROS integration is needed.
28  *
29  * @note
30  * The messages defined here are _not_ guaranteed to be byte-compatible with ROS
31  * messages. They are designed to have the same or similar content, which can be
32  * easily copied into a ROS message.
33  *
34  * See also @ref messages.
35  */
36 
37 /**
38  * @brief ROS `Pose` message (MessageType::ROS_POSE, version 1.0).
39  * @ingroup ros_messages
40  *
41  * See http://docs.ros.org/api/geometry_msgs/html/msg/Pose.html.
42  */
44  static constexpr MessageType MESSAGE_TYPE = MessageType::ROS_POSE;
45  static constexpr uint8_t MESSAGE_VERSION = 0;
46 
47  /** The time of the message, in P1 time (beginning at power-on). */
49 
50  /**
51  * The relative change in ENU position since the time of the first @ref
52  * PoseMessage, resolved in the local ENU frame at the time of the first @ref
53  * PoseMessage.
54  *
55  * @warning
56  * The [ROS Pose message API documentation](
57  * http://docs.ros.org/api/geometry_msgs/html/msg/Pose.html)
58  * does not currently define the origin or reference frame of its position
59  * field. Using the Novatel SPAN driver as a reference
60  * (http://docs.ros.org/api/novatel_span_driver/html/publisher_8py_source.html),
61  * we have chosen to report a relative ENU position. Absolute world position
62  * is available in the @ref GPSFixMessage and @ref messages::PoseMessage
63  * classes.
64  */
65  double position_rel_m[3] = {NAN, NAN, NAN};
66 
67  /**
68  * The platform body orientation with respect to the local ENU frame,
69  * represented as a quaternion with the scalar component last (x, y, z, w).
70  */
71  double orientation[4] = {NAN, NAN, NAN, NAN};
72 };
73 
74 /**
75  * @brief ROS `GPSFix` message (MessageType::ROS_GPS_FIX, version 1.0).
76  * @ingroup ros_messages
77  *
78  * See http://docs.ros.org/api/gps_common/html/msg/GPSFix.html.
79  */
81  static constexpr MessageType MESSAGE_TYPE = MessageType::ROS_GPS_FIX;
82  static constexpr uint8_t MESSAGE_VERSION = 0;
83 
84  /**
85  * @defgroup ros_covariance_type ROS Covariance Type Values
86  * @{
87  */
88  static const uint8_t COVARIANCE_TYPE_UNKNOWN = 0;
89  static const uint8_t COVARIANCE_TYPE_APPROXIMATED = 1;
90  static const uint8_t COVARIANCE_TYPE_DIAGONAL_KNOWN = 2;
91  static const uint8_t COVARIANCE_TYPE_KNOWN = 3;
92  /** @} */
93 
94  /** The time of the message, in P1 time (beginning at power-on). */
96 
97  /**
98  * @name WGS-84 Geodetic Position
99  * @{
100  */
101 
102  /**
103  * The WGS-84 geodetic latitude (in degrees).
104  */
105  double latitude_deg = NAN;
106 
107  /**
108  * The WGS-84 geodetic longitude (in degrees).
109  */
110  double longitude_deg = NAN;
111 
112  /**
113  * The WGS-84 altitude above the ellipsoid (in meters).
114  */
115  double altitude_m = NAN;
116 
117  /** @} */
118 
119  /**
120  * @name Velocity
121  * @{
122  */
123 
124  /**
125  * The vehicle direction from north (in degrees).
126  */
127  double track_deg = NAN;
128 
129  /**
130  * The vehicle ground speed (in meters/second).
131  */
132  double speed_mps = NAN;
133 
134  /**
135  * The vehicle vertical speed (in meters/second).
136  */
137  double climb_mps = NAN;
138 
139  /** @} */
140 
141  /**
142  * @name Vehicle Orientation
143  *
144  * @warning
145  * The pitch/roll/dip field definition listed in the
146  * [ROS GPSFix message definition](http://docs.ros.org/api/gps_common/html/msg/GPSFix.html)
147  * uses non-standard terminology, and the order of the Euler angles is not
148  * explicitly defined. We do not currently support this field. See @ref
149  * PoseMessage::orientation or @ref messages::PoseMessage::ypr_deg instead.
150  *
151  * @{
152  */
153 
154  /**
155  * The platform pitch angle (in degrees).
156  */
157  double pitch_deg = NAN;
158 
159  /**
160  * The platform roll angle (in degrees).
161  */
162  double roll_deg = NAN;
163 
164  /**
165  * The platform dip angle (in degrees).
166  */
167  double dip_deg = NAN;
168 
169  /** @} */
170 
171  /** The GPS time of the message (in seconds), referenced to 1980/1/6. */
172  double gps_time = NAN;
173 
174  /**
175  * @name Dilution Of Precision
176  * @{
177  */
178 
179  double gdop = NAN; ///< Geometric (position + time) DOP.
180  double pdop = NAN; ///< Positional (3D) DOP.
181  double hdop = NAN; ///< Horizontal DOP.
182  double vdop = NAN; ///< Vertical DOP.
183  double tdop = NAN; ///< Time DOP.
184 
185  /** @} */
186 
187  /**
188  * @name Measurement Uncertainty (95% Confidence)
189  * @{
190  */
191 
192  /** Spherical position uncertainty (in meters) [epe] */
193  double err_3d_m = NAN;
194 
195  /** Horizontal position uncertainty (in meters) [eph] */
196  double err_horiz_m = NAN;
197 
198  /** Vertical position uncertainty (in meters) [epv] */
199  double err_vert_m = NAN;
200 
201  /** Track uncertainty (in degrees) [epd] */
202  double err_track_deg = NAN;
203 
204  /** Ground speed uncertainty (in meters/second) [eps] */
205  double err_speed_mps = NAN;
206 
207  /** Vertical speed uncertainty (in meters/second) [epc] */
208  double err_climb_mps = NAN;
209 
210  /** Time uncertainty (in seconds) [ept] */
211  double err_time_sec = NAN;
212 
213  /** Pitch uncertainty (in degrees) */
214  double err_pitch_deg = NAN;
215 
216  /** Roll uncertainty (in degrees) */
217  double err_roll_deg = NAN;
218 
219  /** Dip uncertainty (in degrees) */
220  double err_dip_deg = NAN;
221 
222  /** @} */
223 
224  /**
225  * @name Position Covariance
226  * @{
227  */
228 
229  /**
230  * The 3x3 position covariance matrix (in m^2), resolved in the local ENU
231  * frame. Values are stored in row-major order.
232  */
233  double position_covariance_m2[9] = {NAN};
234 
235  /**
236  * The method in which @ref position_covariance_m2 was populated. See @ref
237  * ros_covariance_type.
238  */
239  uint8_t position_covariance_type = COVARIANCE_TYPE_UNKNOWN;
240 
241  /** @} */
242 
243  uint8_t reserved[3] = {0};
244 };
245 
246 /**
247  * @brief ROS `Imu` message (MessageType::ROS_IMU, version 1.0).
248  * @ingroup ros_messages
249  *
250  * Per the ROS IMU message specification:
251  * - If the a value is known but its covariance is not, its covariance matrix
252  * will be set to 0.0
253  * - If a value is not known or not available, its covariance matrix will be set
254  * to -1.0
255  * - The value itself will be set to `NAN`, as this is not specified in the
256  * ROS message definition
257  *
258  * Note that the ROS IMU message does not use `NAN` in the covariance matrix to
259  * represent either data or covariance not known.
260  *
261  * See http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html.
262  *
263  * @note
264  * The data contained in this message has been corrected for accelerometer and
265  * gyro biases and scale factors, and has been rotated into the vehicle body
266  * frame from the original IMU orientation using the FusionEngine sensor
267  * calibration data.
268  */
270  static constexpr MessageType MESSAGE_TYPE = MessageType::ROS_IMU;
271  static constexpr uint8_t MESSAGE_VERSION = 0;
272 
273  /** The time of the message, in P1 time (beginning at power-on). */
275 
276  /**
277  * The platform body orientation with respect to the local ENU frame,
278  * represented as a quaternion with the scalar component last (x, y, z, w).
279  */
280  double orientation[4] = {NAN, NAN, NAN, NAN};
281 
282  /**
283  * Orientation covariance matrix. Set to -1 if not available.
284  */
285  double orientation_covariance[9] = {-1, -1, -1, -1, -1, -1, -1, -1, -1};
286 
287  /**
288  * Vehicle x/y/z rate of rotation (in radians/second), resolved in the body
289  * frame.
290  */
291  double angular_velocity_rps[3] = {NAN, NAN, NAN};
292 
293  /**
294  * Vehicle rate of rotation covariance matrix. Set to -1 if not available.
295  */
296  double angular_velocity_covariance[9] = {-1, -1, -1, -1, -1, -1, -1, -1, -1};
297 
298  /**
299  * Vehicle x/y/z linear acceleration (in meters/second^2), resolved in the
300  * body frame.
301  */
302  double acceleration_mps2[3] = {NAN, NAN, NAN};
303 
304  /**
305  * Vehicle x/y/z acceleration covariance matrix. Set to -1 if not available.
306  */
307  double acceleration_covariance[9] = {-1, -1, -1, -1, -1, -1, -1, -1, -1};
308 };
309 
310 #pragma pack(pop)
311 
312 } // namespace ros
313 } // namespace messages
314 } // namespace fusion_engine
315 } // namespace point_one
MessageType
Identifiers for the defined output message types.
Definition: defs.h:34
Timestamp p1_time
The time of the message, in P1 time (beginning at power-on).
Definition: ros.h:48
#define P1_ALIGNAS(N)
Definition: portability.h:57
@ ROS_GPS_FIX
ros::GPSFixMessage
@ ROS_POSE
ros::PoseMessage
ROS Imu message (MessageType::ROS_IMU, version 1.0).
Definition: ros.h:269
The base class for all message payloads.
Definition: defs.h:648
@ ROS_IMU
ros::IMUMessage
GNSS signal and frequency type definitions.
Definition: logging.h:38
Timestamp p1_time
The time of the message, in P1 time (beginning at power-on).
Definition: ros.h:274
ROS GPSFix message (MessageType::ROS_GPS_FIX, version 1.0).
Definition: ros.h:80
Timestamp p1_time
The time of the message, in P1 time (beginning at power-on).
Definition: ros.h:95
ROS Pose message (MessageType::ROS_POSE, version 1.0).
Definition: ros.h:43
Point One FusionEngine output message common definitions.
Generic timestamp representation.
Definition: defs.h:549