Gazebo Msgs

API Reference

8.7.0
ignition/msgs/Utility.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_MSGS_UTILITY_HH_
18 #define IGNITION_MSGS_UTILITY_HH_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 #include <ignition/math/AxisAlignedBox.hh>
25 #include <ignition/math/Color.hh>
26 #include <ignition/math/Inertial.hh>
27 #include <ignition/math/Pose3.hh>
28 #include <ignition/math/Plane.hh>
29 #include <ignition/math/SphericalCoordinates.hh>
30 #include <ignition/math/Vector3.hh>
31 
32 #include "ignition/msgs/config.hh"
33 #include "ignition/msgs/Export.hh"
35 
39 
40 namespace ignition
41 {
42  namespace msgs
43  {
44  // Inline bracket to help doxygen filtering.
45  inline namespace IGNITION_MSGS_VERSION_NAMESPACE {
46  //
50  IGNITION_MSGS_VISIBLE
51  ignition::math::Vector3d Convert(const msgs::Vector3d &_v);
52 
56  IGNITION_MSGS_VISIBLE
57  ignition::math::Vector2d Convert(const msgs::Vector2d &_v);
58 
62  IGNITION_MSGS_VISIBLE
63  ignition::math::Quaterniond Convert(const msgs::Quaternion &_q);
64 
68  IGNITION_MSGS_VISIBLE
69  ignition::math::Pose3d Convert(const msgs::Pose &_p);
70 
74  IGNITION_MSGS_VISIBLE
75  math::Color Convert(const msgs::Color &_c);
76 
80  IGNITION_MSGS_VISIBLE
81  ignition::math::Planed Convert(const msgs::PlaneGeom &_p);
82 
86  IGNITION_MSGS_VISIBLE
87  math::Inertiald Convert(const msgs::Inertial &_i);
88 
93  IGNITION_MSGS_VISIBLE
94  math::SphericalCoordinates Convert(
95  const msgs::SphericalCoordinates &_coord);
96 
101  IGNITION_MSGS_VISIBLE
102  math::AxisAlignedBox Convert(const msgs::AxisAlignedBox &_b);
103 
108  IGNITION_MSGS_VISIBLE
109  msgs::AxisAlignedBox Convert(const math::AxisAlignedBox &_b);
110 
114  IGNITION_MSGS_VISIBLE
115  std::string Convert(const msgs::StringMsg &_m);
116 
120  IGNITION_MSGS_VISIBLE
121  bool Convert(const msgs::Boolean &_m);
122 
126  IGNITION_MSGS_VISIBLE
127  int32_t Convert(const msgs::Int32 &_m);
128 
132  IGNITION_MSGS_VISIBLE
133  uint32_t Convert(const msgs::UInt32 &_m);
134 
138  IGNITION_MSGS_VISIBLE
139  int64_t Convert(const msgs::Int64 &_m);
140 
144  IGNITION_MSGS_VISIBLE
145  uint64_t Convert(const msgs::UInt64 &_m);
146 
150  IGNITION_MSGS_VISIBLE
151  double Convert(const msgs::Double &_m);
152 
156  IGNITION_MSGS_VISIBLE
157  float Convert(const msgs::Float &_m);
158 
162  IGNITION_MSGS_VISIBLE
163  std::chrono::steady_clock::duration Convert(const msgs::Time &_time);
164 
168  IGNITION_MSGS_VISIBLE
169  msgs::Vector3d Convert(const ignition::math::Vector3d &_v);
170 
174  IGNITION_MSGS_VISIBLE
175  msgs::Vector2d Convert(const ignition::math::Vector2d &_v);
176 
180  IGNITION_MSGS_VISIBLE
181  msgs::Quaternion Convert(const ignition::math::Quaterniond &_q);
182 
186  IGNITION_MSGS_VISIBLE
187  msgs::Pose Convert(const ignition::math::Pose3d &_p);
188 
192  IGNITION_MSGS_VISIBLE
193  msgs::Color Convert(const math::Color &_c);
194 
198  IGNITION_MSGS_VISIBLE
199  msgs::Inertial Convert(const math::Inertiald &_i);
200 
204  IGNITION_MSGS_VISIBLE
205  msgs::Inertial Convert(const math::MassMatrix3d &_m);
206 
211  IGNITION_MSGS_VISIBLE
212  msgs::SphericalCoordinates Convert(
213  const math::SphericalCoordinates &_coord);
214 
218  IGNITION_MSGS_VISIBLE
219  msgs::PlaneGeom Convert(const ignition::math::Planed &_p);
220 
224  IGNITION_MSGS_VISIBLE
225  msgs::StringMsg Convert(const std::string &_s);
226 
230  IGNITION_MSGS_VISIBLE
231  msgs::Boolean Convert(const bool &_b);
232 
236  IGNITION_MSGS_VISIBLE
237  msgs::Int32 Convert(const int32_t &_i);
238 
242  IGNITION_MSGS_VISIBLE
243  msgs::UInt32 Convert(const uint32_t &_u);
244 
248  IGNITION_MSGS_VISIBLE
249  msgs::Int64 Convert(const int64_t &_i);
250 
254  IGNITION_MSGS_VISIBLE
255  msgs::UInt64 Convert(const uint64_t &_u);
256 
260  IGNITION_MSGS_VISIBLE
261  msgs::Double Convert(const double &_d);
262 
266  IGNITION_MSGS_VISIBLE
267  msgs::Float Convert(const float &_f);
268 
273  IGNITION_MSGS_VISIBLE
274  msgs::Time Convert(
275  const std::chrono::steady_clock::duration &_time_point);
276 
281  IGNITION_MSGS_VISIBLE
283 
288  IGNITION_MSGS_VISIBLE
290 
294  IGNITION_MSGS_VISIBLE
296 
300  IGNITION_MSGS_VISIBLE
302 
306  IGNITION_MSGS_VISIBLE
308 
311  // \param[in] _t PixelFormatType enum value.
313  IGNITION_MSGS_VISIBLE
315 
320  IGNITION_MSGS_VISIBLE
322 
327  IGNITION_MSGS_VISIBLE
329 
333  IGNITION_MSGS_VISIBLE
334  void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v);
335 
339  IGNITION_MSGS_VISIBLE
340  void Set(msgs::Vector2d *_pt, const ignition::math::Vector2d &_v);
341 
345  IGNITION_MSGS_VISIBLE
346  void Set(msgs::Quaternion *_q, const ignition::math::Quaterniond &_v);
347 
351  IGNITION_MSGS_VISIBLE
352  void Set(msgs::Pose *_p, const ignition::math::Pose3d &_v);
353 
357  IGNITION_MSGS_VISIBLE
358  void Set(msgs::Color *_c, const math::Color &_v);
359 
363  IGNITION_MSGS_VISIBLE
364  void Set(msgs::Inertial *_i, const math::Inertiald &_m);
365 
369  IGNITION_MSGS_VISIBLE
370  void Set(msgs::Inertial *_i, const math::MassMatrix3d &_m);
371 
376  IGNITION_MSGS_VISIBLE
377  void Set(msgs::SphericalCoordinates *_sc,
378  const math::SphericalCoordinates &_m);
379 
383  IGNITION_MSGS_VISIBLE
384  void Set(msgs::PlaneGeom *_p, const ignition::math::Planed &_v);
385 
389  IGNITION_MSGS_VISIBLE
390  void Set(msgs::StringMsg *_p, const std::string &_v);
391 
395  IGNITION_MSGS_VISIBLE
396  void Set(msgs::Boolean *_p, const bool &_v);
397 
401  IGNITION_MSGS_VISIBLE
402  void Set(msgs::Int32 *_p, const int32_t &_v);
403 
407  IGNITION_MSGS_VISIBLE
408  void Set(msgs::UInt32 *_p, const uint32_t &_v);
409 
413  IGNITION_MSGS_VISIBLE
414  void Set(msgs::Int64 *_p, const int64_t &_v);
415 
419  IGNITION_MSGS_VISIBLE
420  void Set(msgs::UInt64 *_p, const uint64_t &_v);
421 
425  IGNITION_MSGS_VISIBLE
426  void Set(msgs::Double *_p, const double &_v);
427 
431  IGNITION_MSGS_VISIBLE
432  void Set(msgs::Float *_p, const float &_v);
433 
437  IGNITION_MSGS_VISIBLE
438  void Set(msgs::AxisAlignedBox *_b, const math::AxisAlignedBox &_v);
439 
455  IGNITION_MSGS_VISIBLE
456  void InitPointCloudPacked(msgs::PointCloudPacked &_msg,
457  const std::string &_frameId, bool _memoryAligned,
460 
463  // \param[in] _t Type of the discovery message.
465  IGNITION_MSGS_VISIBLE
467 
479  IGNITION_MSGS_VISIBLE
480  bool ConvertFuelMetadata(const std::string &_modelConfigStr,
481  msgs::FuelMetadata &_meta);
482 
494  IGNITION_MSGS_VISIBLE
495  bool ConvertFuelMetadata(const msgs::FuelMetadata &_meta,
496  std::string &_modelConfigStr);
497  }
498  }
499 }
500 #endif
Geometry_Type Type
Definition: build/ignition-msgs8/include/ignition/msgs/geometry.pb.h:210
STL class.
STL class.
std::string ToString(const msgs::Discovery::Type &_t)
Convert a Discovery::Type to a string. This can be used for debugging purposes.
MassMatrix3< double > MassMatrix3d
msgs::PixelFormatType ConvertPixelFormatType(const std::string &_str)
Convert a string to a msgs::PixelFormatType enum.
void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v)
Set a msgs::Vector3d from an ignition::math::Vector3d.
msgs::Geometry::Type ConvertGeometryType(const std::string &_str)
Convert a string to a msgs::Geometry::Type enum.
msgs::Material::ShaderType ConvertShaderType(const std::string &_str)
Convert a string to a msgs::Material::ShaderType enum.
PointCloudPacked_Field_DataType DataType
Definition: build/ignition-msgs8/include/ignition/msgs/pointcloud_packed.pb.h:194
msgs::Joint::Type ConvertJointType(const std::string &_str)
Convert a string to a msgs::Joint::Type enum.
PixelFormatType
Definition: build/ignition-msgs8/include/ignition/msgs/image.pb.h:76
Inertial< double > Inertiald
Discovery_Type Type
Definition: build/ignition-msgs8/include/ignition/msgs/discovery.pb.h:982
#define IGNITION_MSGS_VERSION_NAMESPACE
Definition: build/ignition-msgs8/include/ignition/msgs/config.hh:11
ignition::math::Vector3d Convert(const msgs::Vector3d &_v)
Convert a msgs::Vector3d to an ignition::math::Vector.
bool ConvertFuelMetadata(const std::string &_modelConfigStr, msgs::FuelMetadata &_meta)
Convert the contents of a model.config file, in the form of an XML string, to a FuelMetadata message.
void InitPointCloudPacked(msgs::PointCloudPacked &_msg, const std::string &_frameId, bool _memoryAligned, const std::vector< std::pair< std::string, msgs::PointCloudPacked::Field::DataType >> &_fields)
This function will set the header and field members of a PointCloudPacked message....
Joint_Type Type
Definition: build/ignition-msgs8/include/ignition/msgs/joint.pb.h:425
Material_ShaderType ShaderType
Definition: build/ignition-msgs8/include/ignition/msgs/material.pb.h:663