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