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 2012 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 
32 #include "gazebo/common/Color.hh"
33 #include "gazebo/common/Time.hh"
34 
35 namespace gazebo
36 {
39  namespace msgs
40  {
44 
49  msgs::Request *CreateRequest(const std::string &_request,
50  const std::string &_data = "");
51 
55  void Init(google::protobuf::Message &_message, const std::string &_id ="");
56 
59  void Stamp(msgs::Header *_header);
60 
63  void Stamp(msgs::Time *_time);
64 
66  std::string Package(const std::string &type,
67  const google::protobuf::Message &message);
69 
73  msgs::Vector3d Convert(const math::Vector3 &_v);
74 
78  msgs::Quaternion Convert(const math::Quaternion &_q);
79 
83  msgs::Pose Convert(const math::Pose &_p);
84 
88  msgs::Color Convert(const common::Color &_c);
89 
93  msgs::Time Convert(const common::Time &_t);
94 
98  msgs::PlaneGeom Convert(const math::Plane &_p);
99 
103  math::Vector3 Convert(const msgs::Vector3d &_v);
104 
108  math::Quaternion Convert(const msgs::Quaternion &_q);
109 
113  math::Pose Convert(const msgs::Pose &_p);
114 
118  void Set(common::Image &_img, const msgs::Image &_msg);
119 
123  common::Color Convert(const msgs::Color &_c);
124 
128  common::Time Convert(const msgs::Time &_t);
129 
133  math::Plane Convert(const msgs::PlaneGeom &_p);
134 
138  void Set(msgs::Image *_msg, const common::Image &_i);
139 
143  void Set(msgs::Vector3d *_pt, const math::Vector3 &_v);
144 
148  void Set(msgs::Vector2d *_pt, const math::Vector2d &_v);
149 
153  void Set(msgs::Quaternion *_q, const math::Quaternion &_v);
154 
158  void Set(msgs::Pose *_p, const math::Pose &_v);
159 
163  void Set(msgs::Color *_c, const common::Color &_v);
164 
168  void Set(msgs::Time *_t, const common::Time &_v);
169 
173  void Set(msgs::PlaneGeom *_p, const math::Plane &_v);
174 
178  msgs::TrackVisual TrackVisualFromSDF(sdf::ElementPtr _sdf);
179 
183  msgs::GUI GUIFromSDF(sdf::ElementPtr _sdf);
184 
188  msgs::Light LightFromSDF(sdf::ElementPtr _sdf);
189 
193  msgs::MeshGeom MeshFromSDF(sdf::ElementPtr _sdf);
194 
198  msgs::Geometry GeometryFromSDF(sdf::ElementPtr _sdf);
199 
203  msgs::Visual VisualFromSDF(sdf::ElementPtr _sdf);
204 
208  msgs::Fog FogFromSDF(sdf::ElementPtr _sdf);
209 
213  msgs::Scene SceneFromSDF(sdf::ElementPtr _sdf);
214 
216  const google::protobuf::FieldDescriptor *GetFD(
217  google::protobuf::Message &message, const std::string &name);
219 
223  msgs::Header *GetHeader(google::protobuf::Message &_message);
224 
226  }
227 }
228 
229 #endif
230