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 2011 Nate Koenig
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 "msgs/MessageTypes.hh"
23 #include "sdf/sdf.hh"
24 
25 #include "math/MathTypes.hh"
26 #include "math/Vector3.hh"
27 #include "math/Pose.hh"
28 #include "math/Plane.hh"
29 #include "math/Box.hh"
30 
31 #include "common/Color.hh"
32 #include "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 
179 
183  msgs::GUI GUIFromSDF(sdf::ElementPtr _sdf);
184 
188  msgs::Light LightFromSDF(sdf::ElementPtr _sdf);
189 
193  msgs::Visual VisualFromSDF(sdf::ElementPtr _sdf);
194 
198  msgs::Fog FogFromSDF(sdf::ElementPtr _sdf);
199 
203  msgs::Scene SceneFromSDF(sdf::ElementPtr _sdf);
204 
206  const google::protobuf::FieldDescriptor *GetFD(
207  google::protobuf::Message &message, const std::string &name);
209 
213  msgs::Header *GetHeader(google::protobuf::Message &_message);
214 
216  }
217 }
218 
219 #endif
220