YARP
Yet Another Robot Platform
NavSatFix.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// This is an automatically generated file.
7
8// Generated from the following "sensor_msgs/NavSatFix" msg definition:
9// # Navigation Satellite fix for any Global Navigation Satellite System
10// #
11// # Specified using the WGS 84 reference ellipsoid
12//
13// # header.stamp specifies the ROS time for this measurement (the
14// # corresponding satellite time may be reported using the
15// # sensor_msgs/TimeReference message).
16// #
17// # header.frame_id is the frame of reference reported by the satellite
18// # receiver, usually the location of the antenna. This is a
19// # Euclidean frame relative to the vehicle, not a reference
20// # ellipsoid.
21// Header header
22//
23// # satellite fix status information
24// NavSatStatus status
25//
26// # Latitude [degrees]. Positive is north of equator; negative is south.
27// float64 latitude
28//
29// # Longitude [degrees]. Positive is east of prime meridian; negative is west.
30// float64 longitude
31//
32// # Altitude [m]. Positive is above the WGS 84 ellipsoid
33// # (quiet NaN if no altitude is available).
34// float64 altitude
35//
36// # Position covariance [m^2] defined relative to a tangential plane
37// # through the reported position. The components are East, North, and
38// # Up (ENU), in row-major order.
39// #
40// # Beware: this coordinate system exhibits singularities at the poles.
41//
42// float64[9] position_covariance
43//
44// # If the covariance of the fix is known, fill it in completely. If the
45// # GPS receiver provides the variance of each measurement, put them
46// # along the diagonal. If only Dilution of Precision is available,
47// # estimate an approximate covariance from that.
48//
49// uint8 COVARIANCE_TYPE_UNKNOWN = 0
50// uint8 COVARIANCE_TYPE_APPROXIMATED = 1
51// uint8 COVARIANCE_TYPE_DIAGONAL_KNOWN = 2
52// uint8 COVARIANCE_TYPE_KNOWN = 3
53//
54// uint8 position_covariance_type
55// Instances of this class can be read and written with YARP ports,
56// using a ROS-compatible format.
57
58#ifndef YARP_ROSMSG_sensor_msgs_NavSatFix_h
59#define YARP_ROSMSG_sensor_msgs_NavSatFix_h
60
61#include <yarp/os/Wire.h>
62#include <yarp/os/Type.h>
64#include <string>
65#include <vector>
68
69namespace yarp {
70namespace rosmsg {
71namespace sensor_msgs {
72
74{
75public:
81 std::vector<yarp::conf::float64_t> position_covariance;
82 static const std::uint8_t COVARIANCE_TYPE_UNKNOWN = 0;
83 static const std::uint8_t COVARIANCE_TYPE_APPROXIMATED = 1;
84 static const std::uint8_t COVARIANCE_TYPE_DIAGONAL_KNOWN = 2;
85 static const std::uint8_t COVARIANCE_TYPE_KNOWN = 3;
87
89 header(),
90 status(),
91 latitude(0.0),
92 longitude(0.0),
93 altitude(0.0),
96 {
97 position_covariance.resize(9, 0.0);
98 }
99
100 void clear()
101 {
102 // *** header ***
103 header.clear();
104
105 // *** status ***
106 status.clear();
107
108 // *** latitude ***
109 latitude = 0.0;
110
111 // *** longitude ***
112 longitude = 0.0;
113
114 // *** altitude ***
115 altitude = 0.0;
116
117 // *** position_covariance ***
118 position_covariance.clear();
119 position_covariance.resize(9, 0.0);
120
121 // *** COVARIANCE_TYPE_UNKNOWN ***
122
123 // *** COVARIANCE_TYPE_APPROXIMATED ***
124
125 // *** COVARIANCE_TYPE_DIAGONAL_KNOWN ***
126
127 // *** COVARIANCE_TYPE_KNOWN ***
128
129 // *** position_covariance_type ***
131 }
132
133 bool readBare(yarp::os::ConnectionReader& connection) override
134 {
135 // *** header ***
136 if (!header.read(connection)) {
137 return false;
138 }
139
140 // *** status ***
141 if (!status.read(connection)) {
142 return false;
143 }
144
145 // *** latitude ***
146 latitude = connection.expectFloat64();
147
148 // *** longitude ***
149 longitude = connection.expectFloat64();
150
151 // *** altitude ***
152 altitude = connection.expectFloat64();
153
154 // *** position_covariance ***
155 int len = 9;
156 position_covariance.resize(len);
157 if (len > 0 && !connection.expectBlock((char*)&position_covariance[0], sizeof(yarp::conf::float64_t)*len)) {
158 return false;
159 }
160
161 // *** position_covariance_type ***
163
164 return !connection.isError();
165 }
166
167 bool readBottle(yarp::os::ConnectionReader& connection) override
168 {
169 connection.convertTextMode();
170 yarp::os::idl::WireReader reader(connection);
171 if (!reader.readListHeader(11)) {
172 return false;
173 }
174
175 // *** header ***
176 if (!header.read(connection)) {
177 return false;
178 }
179
180 // *** status ***
181 if (!status.read(connection)) {
182 return false;
183 }
184
185 // *** latitude ***
186 latitude = reader.expectFloat64();
187
188 // *** longitude ***
189 longitude = reader.expectFloat64();
190
191 // *** altitude ***
192 altitude = reader.expectFloat64();
193
194 // *** position_covariance ***
195 if (connection.expectInt32() != (BOTTLE_TAG_LIST|BOTTLE_TAG_FLOAT64)) {
196 return false;
197 }
198 int len = connection.expectInt32();
199 position_covariance.resize(len);
200 for (int i=0; i<len; i++) {
202 }
203
204 // *** position_covariance_type ***
206
207 return !connection.isError();
208 }
209
211 bool read(yarp::os::ConnectionReader& connection) override
212 {
213 return (connection.isBareMode() ? readBare(connection)
214 : readBottle(connection));
215 }
216
217 bool writeBare(yarp::os::ConnectionWriter& connection) const override
218 {
219 // *** header ***
220 if (!header.write(connection)) {
221 return false;
222 }
223
224 // *** status ***
225 if (!status.write(connection)) {
226 return false;
227 }
228
229 // *** latitude ***
230 connection.appendFloat64(latitude);
231
232 // *** longitude ***
233 connection.appendFloat64(longitude);
234
235 // *** altitude ***
236 connection.appendFloat64(altitude);
237
238 // *** position_covariance ***
239 if (position_covariance.size()>0) {
241 }
242
243 // *** position_covariance_type ***
245
246 return !connection.isError();
247 }
248
249 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
250 {
251 connection.appendInt32(BOTTLE_TAG_LIST);
252 connection.appendInt32(11);
253
254 // *** header ***
255 if (!header.write(connection)) {
256 return false;
257 }
258
259 // *** status ***
260 if (!status.write(connection)) {
261 return false;
262 }
263
264 // *** latitude ***
266 connection.appendFloat64(latitude);
267
268 // *** longitude ***
270 connection.appendFloat64(longitude);
271
272 // *** altitude ***
274 connection.appendFloat64(altitude);
275
276 // *** position_covariance ***
278 connection.appendInt32(position_covariance.size());
279 for (size_t i=0; i<position_covariance.size(); i++) {
280 connection.appendFloat64(position_covariance[i]);
281 }
282
283 // *** position_covariance_type ***
284 connection.appendInt32(BOTTLE_TAG_INT8);
286
287 connection.convertTextMode();
288 return !connection.isError();
289 }
290
292 bool write(yarp::os::ConnectionWriter& connection) const override
293 {
294 return (connection.isBareMode() ? writeBare(connection)
295 : writeBottle(connection));
296 }
297
298 // This class will serialize ROS style or YARP style depending on protocol.
299 // If you need to force a serialization style, use one of these classes:
302
303 // The name for this message, ROS will need this
304 static constexpr const char* typeName = "sensor_msgs/NavSatFix";
305
306 // The checksum for this message, ROS will need this
307 static constexpr const char* typeChecksum = "2d3a8cd499b9b4a0249fb98fd05cfa48";
308
309 // The source text for this message, ROS will need this
310 static constexpr const char* typeText = "\
311# Navigation Satellite fix for any Global Navigation Satellite System\n\
312#\n\
313# Specified using the WGS 84 reference ellipsoid\n\
314\n\
315# header.stamp specifies the ROS time for this measurement (the\n\
316# corresponding satellite time may be reported using the\n\
317# sensor_msgs/TimeReference message).\n\
318#\n\
319# header.frame_id is the frame of reference reported by the satellite\n\
320# receiver, usually the location of the antenna. This is a\n\
321# Euclidean frame relative to the vehicle, not a reference\n\
322# ellipsoid.\n\
323Header header\n\
324\n\
325# satellite fix status information\n\
326NavSatStatus status\n\
327\n\
328# Latitude [degrees]. Positive is north of equator; negative is south.\n\
329float64 latitude\n\
330\n\
331# Longitude [degrees]. Positive is east of prime meridian; negative is west.\n\
332float64 longitude\n\
333\n\
334# Altitude [m]. Positive is above the WGS 84 ellipsoid\n\
335# (quiet NaN if no altitude is available).\n\
336float64 altitude\n\
337\n\
338# Position covariance [m^2] defined relative to a tangential plane\n\
339# through the reported position. The components are East, North, and\n\
340# Up (ENU), in row-major order.\n\
341#\n\
342# Beware: this coordinate system exhibits singularities at the poles.\n\
343\n\
344float64[9] position_covariance\n\
345\n\
346# If the covariance of the fix is known, fill it in completely. If the\n\
347# GPS receiver provides the variance of each measurement, put them\n\
348# along the diagonal. If only Dilution of Precision is available,\n\
349# estimate an approximate covariance from that.\n\
350\n\
351uint8 COVARIANCE_TYPE_UNKNOWN = 0\n\
352uint8 COVARIANCE_TYPE_APPROXIMATED = 1\n\
353uint8 COVARIANCE_TYPE_DIAGONAL_KNOWN = 2\n\
354uint8 COVARIANCE_TYPE_KNOWN = 3\n\
355\n\
356uint8 position_covariance_type\n\
357\n\
358================================================================================\n\
359MSG: std_msgs/Header\n\
360# Standard metadata for higher-level stamped data types.\n\
361# This is generally used to communicate timestamped data \n\
362# in a particular coordinate frame.\n\
363# \n\
364# sequence ID: consecutively increasing ID \n\
365uint32 seq\n\
366#Two-integer timestamp that is expressed as:\n\
367# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
368# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
369# time-handling sugar is provided by the client library\n\
370time stamp\n\
371#Frame this data is associated with\n\
372# 0: no frame\n\
373# 1: global frame\n\
374string frame_id\n\
375\n\
376================================================================================\n\
377MSG: sensor_msgs/NavSatStatus\n\
378# Navigation Satellite fix status for any Global Navigation Satellite System\n\
379\n\
380# Whether to output an augmented fix is determined by both the fix\n\
381# type and the last time differential corrections were received. A\n\
382# fix is valid when status >= STATUS_FIX.\n\
383\n\
384int8 STATUS_NO_FIX = -1 # unable to fix position\n\
385int8 STATUS_FIX = 0 # unaugmented fix\n\
386int8 STATUS_SBAS_FIX = 1 # with satellite-based augmentation\n\
387int8 STATUS_GBAS_FIX = 2 # with ground-based augmentation\n\
388\n\
389int8 status\n\
390\n\
391# Bits defining which Global Navigation Satellite System signals were\n\
392# used by the receiver.\n\
393\n\
394uint16 SERVICE_GPS = 1\n\
395uint16 SERVICE_GLONASS = 2\n\
396uint16 SERVICE_COMPASS = 4 # includes BeiDou.\n\
397uint16 SERVICE_GALILEO = 8\n\
398\n\
399uint16 service\n\
400";
401
402 yarp::os::Type getType() const override
403 {
406 typ.addProperty("message_definition", yarp::os::Value(typeText));
407 return typ;
408 }
409};
410
411} // namespace sensor_msgs
412} // namespace rosmsg
413} // namespace yarp
414
415#endif // YARP_ROSMSG_sensor_msgs_NavSatFix_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:25
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:27
std::int8_t expectInt8()
Definition: WireReader.h:77
yarp::conf::float64_t expectFloat64()
Definition: WireReader.h:110
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::NavSatFix > bottleStyle
Definition: NavSatFix.h:301
yarp::rosmsg::std_msgs::Header header
Definition: NavSatFix.h:76
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: NavSatFix.h:217
static const std::uint8_t COVARIANCE_TYPE_APPROXIMATED
Definition: NavSatFix.h:83
static constexpr const char * typeName
Definition: NavSatFix.h:304
std::vector< yarp::conf::float64_t > position_covariance
Definition: NavSatFix.h:81
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: NavSatFix.h:211
yarp::os::Type getType() const override
Definition: NavSatFix.h:402
static const std::uint8_t COVARIANCE_TYPE_KNOWN
Definition: NavSatFix.h:85
static constexpr const char * typeText
Definition: NavSatFix.h:310
yarp::conf::float64_t latitude
Definition: NavSatFix.h:78
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: NavSatFix.h:133
static constexpr const char * typeChecksum
Definition: NavSatFix.h:307
static const std::uint8_t COVARIANCE_TYPE_UNKNOWN
Definition: NavSatFix.h:82
yarp::conf::float64_t altitude
Definition: NavSatFix.h:80
yarp::conf::float64_t longitude
Definition: NavSatFix.h:79
yarp::rosmsg::sensor_msgs::NavSatStatus status
Definition: NavSatFix.h:77
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: NavSatFix.h:292
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: NavSatFix.h:249
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::NavSatFix > rosStyle
Definition: NavSatFix.h:300
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: NavSatFix.h:167
static const std::uint8_t COVARIANCE_TYPE_DIAGONAL_KNOWN
Definition: NavSatFix.h:84
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: NavSatStatus.h:156
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: NavSatStatus.h:121
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
double float64_t
Definition: numeric.h:77
The main, catch-all namespace for YARP.
Definition: dirs.h:16