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 "gazebo/msgs/MessageTypes.hh"
23 #include "gazebo/sdf/sdf.hh"
24 
25 #include "gazebo/math/MathTypes.hh"
26 #include "gazebo/math/Vector3.hh"
27 #include "gazebo/math/Pose.hh"
28 #include "gazebo/math/Plane.hh"
29 #include "gazebo/math/Box.hh"
30 
31 #include "gazebo/common/Color.hh"
32 #include "gazebo/common/Time.hh"
33 
34 namespace gazebo
35 {
38  namespace msgs
39  {
43 
48  msgs::Request *CreateRequest(const std::string &_request,
49  const std::string &_data = "");
50 
54  void Init(google::protobuf::Message &_message, const std::string &_id ="");
55 
58  void Stamp(msgs::Header *_header);
59 
62  void Stamp(msgs::Time *_time);
63 
65  std::string Package(const std::string &type,
66  const google::protobuf::Message &message);
68 
72  msgs::Vector3d Convert(const math::Vector3 &_v);
73 
77  msgs::Quaternion Convert(const math::Quaternion &_q);
78 
82  msgs::Pose Convert(const math::Pose &_p);
83 
87  msgs::Color Convert(const common::Color &_c);
88 
92  msgs::Time Convert(const common::Time &_t);
93 
97  msgs::PlaneGeom Convert(const math::Plane &_p);
98 
102  math::Vector3 Convert(const msgs::Vector3d &_v);
103 
107  math::Quaternion Convert(const msgs::Quaternion &_q);
108 
112  math::Pose Convert(const msgs::Pose &_p);
113 
117  void Set(common::Image &_img, const msgs::Image &_msg);
118 
122  common::Color Convert(const msgs::Color &_c);
123 
127  common::Time Convert(const msgs::Time &_t);
128 
132  math::Plane Convert(const msgs::PlaneGeom &_p);
133 
137  void Set(msgs::Image *_msg, const common::Image &_i);
138 
142  void Set(msgs::Vector3d *_pt, const math::Vector3 &_v);
143 
147  void Set(msgs::Vector2d *_pt, const math::Vector2d &_v);
148 
152  void Set(msgs::Quaternion *_q, const math::Quaternion &_v);
153 
157  void Set(msgs::Pose *_p, const math::Pose &_v);
158 
162  void Set(msgs::Color *_c, const common::Color &_v);
163 
167  void Set(msgs::Time *_t, const common::Time &_v);
168 
172  void Set(msgs::PlaneGeom *_p, const math::Plane &_v);
173 
177  msgs::TrackVisual TrackVisualFromSDF(sdf::ElementPtr _sdf);
178 
182  msgs::GUI GUIFromSDF(sdf::ElementPtr _sdf);
183 
187  msgs::Light LightFromSDF(sdf::ElementPtr _sdf);
188 
192  msgs::MeshGeom MeshFromSDF(sdf::ElementPtr _sdf);
193 
197  msgs::Geometry GeometryFromSDF(sdf::ElementPtr _sdf);
198 
202  msgs::Visual VisualFromSDF(sdf::ElementPtr _sdf);
203 
207  msgs::Fog FogFromSDF(sdf::ElementPtr _sdf);
208 
212  msgs::Scene SceneFromSDF(sdf::ElementPtr _sdf);
213 
215  const google::protobuf::FieldDescriptor *GetFD(
216  google::protobuf::Message &message, const std::string &name);
218 
222  msgs::Header *GetHeader(google::protobuf::Message &_message);
223 
225  }
226 }
227 
228 #endif
229