All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
msgs.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 MESSAGES_UTILITY_H
18 #define MESSAGES_UTILITY_H
19 
20 #include <string>
21 
22 #include <sdf/sdf.hh>
23 
24 #include "gazebo/msgs/MessageTypes.hh"
25 
26 #include "gazebo/math/MathTypes.hh"
27 #include "gazebo/math/Vector3.hh"
28 #include "gazebo/math/Pose.hh"
29 #include "gazebo/math/Plane.hh"
30 #include "gazebo/math/Box.hh"
31 
33 #include "gazebo/common/Color.hh"
34 #include "gazebo/common/Time.hh"
35 #include "gazebo/common/Image.hh"
36 
37 namespace gazebo
38 {
41  namespace msgs
42  {
46 
52  msgs::Request *CreateRequest(const std::string &_request,
53  const std::string &_data = "");
54 
59  void Init(google::protobuf::Message &_message, const std::string &_id ="");
60 
64  void Stamp(msgs::Header *_header);
65 
69  void Stamp(msgs::Time *_time);
70 
73  std::string Package(const std::string &type,
74  const google::protobuf::Message &message);
76 
81  msgs::Vector3d Convert(const math::Vector3 &_v);
82 
87  msgs::Quaternion Convert(const math::Quaternion &_q);
88 
93  msgs::Pose Convert(const math::Pose &_p);
94 
99  msgs::Color Convert(const common::Color &_c);
100 
105  msgs::Time Convert(const common::Time &_t);
106 
111  msgs::PlaneGeom Convert(const math::Plane &_p);
112 
117  math::Vector3 Convert(const msgs::Vector3d &_v);
118 
123  math::Quaternion Convert(const msgs::Quaternion &_q);
124 
129  math::Pose Convert(const msgs::Pose &_p);
130 
135  void Set(common::Image &_img, const msgs::Image &_msg);
136 
141  common::Color Convert(const msgs::Color &_c);
142 
147  common::Time Convert(const msgs::Time &_t);
148 
153  math::Plane Convert(const msgs::PlaneGeom &_p);
154 
159  void Set(msgs::Image *_msg, const common::Image &_i);
160 
165  void Set(msgs::Vector3d *_pt, const math::Vector3 &_v);
166 
171  void Set(msgs::Vector2d *_pt, const math::Vector2d &_v);
172 
177  void Set(msgs::Quaternion *_q, const math::Quaternion &_v);
178 
183  void Set(msgs::Pose *_p, const math::Pose &_v);
184 
189  void Set(msgs::Color *_c, const common::Color &_v);
190 
195  void Set(msgs::Time *_t, const common::Time &_v);
196 
201  void Set(msgs::SphericalCoordinates *_s,
202  const common::SphericalCoordinates &_v);
203 
208  void Set(msgs::PlaneGeom *_p, const math::Plane &_v);
209 
214  msgs::TrackVisual TrackVisualFromSDF(sdf::ElementPtr _sdf);
215 
220  msgs::GUI GUIFromSDF(sdf::ElementPtr _sdf);
221 
226  msgs::Light LightFromSDF(sdf::ElementPtr _sdf);
227 
232  msgs::MeshGeom MeshFromSDF(sdf::ElementPtr _sdf);
233 
238  msgs::Geometry GeometryFromSDF(sdf::ElementPtr _sdf);
239 
244  msgs::Visual VisualFromSDF(sdf::ElementPtr _sdf);
245 
250  msgs::Fog FogFromSDF(sdf::ElementPtr _sdf);
251 
256  msgs::Scene SceneFromSDF(sdf::ElementPtr _sdf);
257 
260  const google::protobuf::FieldDescriptor *GetFD(
261  google::protobuf::Message &message, const std::string &name);
263 
268  msgs::Header *GetHeader(google::protobuf::Message &_message);
269 
271  }
272 }
273 
274 #endif
275