Ignition Msgs

API Reference

6.4.0
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 
25 #include <ignition/math/Color.hh>
27 #include <ignition/math/Pose3.hh>
28 #include <ignition/math/Plane.hh>
29 #include <ignition/math/Vector3.hh>
30 
31 #include "ignition/msgs/config.hh"
32 #include "ignition/msgs/Export.hh"
34 
38 
39 namespace ignition
40 {
41  namespace msgs
42  {
43  // Inline bracket to help doxygen filtering.
44  inline namespace IGNITION_MSGS_VERSION_NAMESPACE {
45  //
49  IGNITION_MSGS_VISIBLE
50  ignition::math::Vector3d Convert(const msgs::Vector3d &_v);
51 
55  IGNITION_MSGS_VISIBLE
56  ignition::math::Vector2d Convert(const msgs::Vector2d &_v);
57 
61  IGNITION_MSGS_VISIBLE
62  ignition::math::Quaterniond Convert(const msgs::Quaternion &_q);
63 
67  IGNITION_MSGS_VISIBLE
68  ignition::math::Pose3d Convert(const msgs::Pose &_p);
69 
73  IGNITION_MSGS_VISIBLE
74  math::Color Convert(const msgs::Color &_c);
75 
79  IGNITION_MSGS_VISIBLE
80  ignition::math::Planed Convert(const msgs::PlaneGeom &_p);
81 
85  IGNITION_MSGS_VISIBLE
86  math::Inertiald Convert(const msgs::Inertial &_i);
87 
92  IGNITION_MSGS_VISIBLE
93  math::AxisAlignedBox Convert(const msgs::AxisAlignedBox &_b);
94 
99  IGNITION_MSGS_VISIBLE
100  msgs::AxisAlignedBox Convert(const math::AxisAlignedBox &_b);
101 
105  IGNITION_MSGS_VISIBLE
106  std::string Convert(const msgs::StringMsg &_m);
107 
111  IGNITION_MSGS_VISIBLE
112  bool Convert(const msgs::Boolean &_m);
113 
117  IGNITION_MSGS_VISIBLE
118  int32_t Convert(const msgs::Int32 &_m);
119 
123  IGNITION_MSGS_VISIBLE
124  uint32_t Convert(const msgs::UInt32 &_m);
125 
129  IGNITION_MSGS_VISIBLE
130  int64_t Convert(const msgs::Int64 &_m);
131 
135  IGNITION_MSGS_VISIBLE
136  uint64_t Convert(const msgs::UInt64 &_m);
137 
141  IGNITION_MSGS_VISIBLE
142  double Convert(const msgs::Double &_m);
143 
147  IGNITION_MSGS_VISIBLE
148  float Convert(const msgs::Float &_m);
149 
153  IGNITION_MSGS_VISIBLE
154  std::chrono::steady_clock::duration Convert(const msgs::Time &_time);
155 
159  IGNITION_MSGS_VISIBLE
160  msgs::Vector3d Convert(const ignition::math::Vector3d &_v);
161 
165  IGNITION_MSGS_VISIBLE
166  msgs::Vector2d Convert(const ignition::math::Vector2d &_v);
167 
171  IGNITION_MSGS_VISIBLE
172  msgs::Quaternion Convert(const ignition::math::Quaterniond &_q);
173 
177  IGNITION_MSGS_VISIBLE
178  msgs::Pose Convert(const ignition::math::Pose3d &_p);
179 
183  IGNITION_MSGS_VISIBLE
184  msgs::Color Convert(const math::Color &_c);
185 
189  IGNITION_MSGS_VISIBLE
190  msgs::Inertial Convert(const math::Inertiald &_i);
191 
195  IGNITION_MSGS_VISIBLE
196  msgs::Inertial Convert(const math::MassMatrix3d &_m);
197 
201  IGNITION_MSGS_VISIBLE
202  msgs::PlaneGeom Convert(const ignition::math::Planed &_p);
203 
207  IGNITION_MSGS_VISIBLE
208  msgs::StringMsg Convert(const std::string &_s);
209 
213  IGNITION_MSGS_VISIBLE
214  msgs::Boolean Convert(const bool &_b);
215 
219  IGNITION_MSGS_VISIBLE
220  msgs::Int32 Convert(const int32_t &_i);
221 
225  IGNITION_MSGS_VISIBLE
226  msgs::UInt32 Convert(const uint32_t &_u);
227 
231  IGNITION_MSGS_VISIBLE
232  msgs::Int64 Convert(const int64_t &_i);
233 
237  IGNITION_MSGS_VISIBLE
238  msgs::UInt64 Convert(const uint64_t &_u);
239 
243  IGNITION_MSGS_VISIBLE
244  msgs::Double Convert(const double &_d);
245 
249  IGNITION_MSGS_VISIBLE
250  msgs::Float Convert(const float &_f);
251 
256  IGNITION_MSGS_VISIBLE
257  msgs::Time Convert(
258  const std::chrono::steady_clock::duration &_time_point);
259 
264  IGNITION_MSGS_VISIBLE
266 
271  IGNITION_MSGS_VISIBLE
273 
277  IGNITION_MSGS_VISIBLE
279 
283  IGNITION_MSGS_VISIBLE
285 
289  IGNITION_MSGS_VISIBLE
291 
294  // \param[in] _t PixelFormatType enum value.
296  IGNITION_MSGS_VISIBLE
298 
303  IGNITION_MSGS_VISIBLE
305 
310  IGNITION_MSGS_VISIBLE
312 
316  IGNITION_MSGS_VISIBLE
317  void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v);
318 
322  IGNITION_MSGS_VISIBLE
323  void Set(msgs::Vector2d *_pt, const ignition::math::Vector2d &_v);
324 
328  IGNITION_MSGS_VISIBLE
329  void Set(msgs::Quaternion *_q, const ignition::math::Quaterniond &_v);
330 
334  IGNITION_MSGS_VISIBLE
335  void Set(msgs::Pose *_p, const ignition::math::Pose3d &_v);
336 
340  IGNITION_MSGS_VISIBLE
341  void Set(msgs::Color *_c, const math::Color &_v);
342 
346  IGNITION_MSGS_VISIBLE
347  void Set(msgs::Inertial *_i, const math::Inertiald &_m);
348 
352  IGNITION_MSGS_VISIBLE
353  void Set(msgs::Inertial *_i, const math::MassMatrix3d &_m);
354 
358  IGNITION_MSGS_VISIBLE
359  void Set(msgs::PlaneGeom *_p, const ignition::math::Planed &_v);
360 
364  IGNITION_MSGS_VISIBLE
365  void Set(msgs::StringMsg *_p, const std::string &_v);
366 
370  IGNITION_MSGS_VISIBLE
371  void Set(msgs::Boolean *_p, const bool &_v);
372 
376  IGNITION_MSGS_VISIBLE
377  void Set(msgs::Int32 *_p, const int32_t &_v);
378 
382  IGNITION_MSGS_VISIBLE
383  void Set(msgs::UInt32 *_p, const uint32_t &_v);
384 
388  IGNITION_MSGS_VISIBLE
389  void Set(msgs::Int64 *_p, const int64_t &_v);
390 
394  IGNITION_MSGS_VISIBLE
395  void Set(msgs::UInt64 *_p, const uint64_t &_v);
396 
400  IGNITION_MSGS_VISIBLE
401  void Set(msgs::Double *_p, const double &_v);
402 
406  IGNITION_MSGS_VISIBLE
407  void Set(msgs::Float *_p, const float &_v);
408 
412  IGNITION_MSGS_VISIBLE
413  void Set(msgs::AxisAlignedBox *_b, const math::AxisAlignedBox &_v);
414 
430  IGNITION_MSGS_VISIBLE
431  void InitPointCloudPacked(msgs::PointCloudPacked &_msg,
432  const std::string &_frameId, bool _memoryAligned,
435 
438  // \param[in] _t Type of the discovery message.
440  IGNITION_MSGS_VISIBLE
442 
454  IGNITION_MSGS_VISIBLE
455  bool ConvertFuelMetadata(const std::string &_modelConfigStr,
456  msgs::FuelMetadata &_meta);
457 
469  IGNITION_MSGS_VISIBLE
470  bool ConvertFuelMetadata(const msgs::FuelMetadata &_meta,
471  std::string &_modelConfigStr);
472  }
473  }
474 }
475 #endif
#define IGNITION_MSGS_VERSION_NAMESPACE
Definition: config.hh:11
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. This will clear existing values in the PointCloudPacked field and header.
msgs::Joint::Type ConvertJointType(const std::string &_str)
Convert a string to a msgs::Joint::Type enum.
PixelFormatType
Definition: image.pb.h:55
Joint_Type Type
Definition: joint.pb.h:326
PointCloudPacked_Field_DataType DataType
Definition: pointcloud_packed.pb.h:143
STL class.
Material_ShaderType ShaderType
Definition: material.pb.h:509
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...
Discovery_Type Type
Definition: discovery.pb.h:778
Geometry_Type Type
Definition: geometry.pb.h:158
msgs::Material::ShaderType ConvertShaderType(const std::string &_str)
Convert a string to a msgs::Material::ShaderType enum.
std::string ToString(const msgs::Discovery::Type &_t)
Convert a Discovery::Type to a string. This can be used for debugging purposes.
msgs::Geometry::Type ConvertGeometryType(const std::string &_str)
Convert a string to a msgs::Geometry::Type enum.
STL class.
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.
ignition::math::Vector3d Convert(const msgs::Vector3d &_v)
Convert a msgs::Vector3d to an ignition::math::Vector.
Inertial< double > Inertiald
MassMatrix3< double > MassMatrix3d