ModelData.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-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 _GAZEBO_MODEL_DATA_HH_
18 #define _GAZEBO_MODEL_DATA_HH_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
26 
27 namespace boost
28 {
29  class recursive_mutex;
30 }
31 
32 namespace gazebo
33 {
34  namespace gui
35  {
36  class LinkInspector;
37  class ModelPluginInspector;
38 
40  {
43  public: static std::string GetTemplateSDFString();
44 
47  public: static double GetEditTransparency();
48 
53  public: static void UpdateRenderGroup(rendering::VisualPtr _visual);
54  };
55 
58  {
61  public: void SetName(const std::string &_name);
62 
65  public: void SetPose(const ignition::math::Pose3d &_pose);
66 
69  public: ignition::math::Pose3d Pose() const;
70 
73  public: int Depth() const;
74 
76  public: sdf::ElementPtr modelSDF;
77 
80 
82  public: std::map<std::string, rendering::VisualWeakPtr> models;
83 
85  public: std::map<std::string, rendering::VisualWeakPtr> links;
86  };
87 
90  class GZ_GUI_VISIBLE LinkData : public QObject
91  {
92  Q_OBJECT
93 
95  public: LinkData();
96 
98  public: ~LinkData();
99 
102  public: std::string GetName() const;
103 
106  public: void SetName(const std::string &_name);
107 
110  public: ignition::math::Pose3d Pose() const;
111 
114  public: void SetPose(const ignition::math::Pose3d &_pose3d);
115 
118  public: void Load(sdf::ElementPtr _sdf);
119 
122  public: ignition::math::Vector3d Scale() const;
123 
126  public: void SetScale(const ignition::math::Vector3d &_scale);
127 
130  public: void AddVisual(rendering::VisualPtr _visual);
131 
135  public: void AddCollision(rendering::VisualPtr _collisionVis,
136  const msgs::Collision *_msg = NULL);
137 
139  public: void UpdateConfig();
140 
144  public: LinkData *Clone(const std::string &_newName);
145 
147  private: void Update();
148 
151  private: bool Apply();
152 
155  private slots: void OnAccept();
156 
159  private slots: void OnApply();
160 
163  private slots: void OnAddVisual(const std::string &_name);
164 
167  private slots: void OnAddCollision(const std::string &_name);
168 
171  private slots: void OnRemoveVisual(const std::string &_name);
172 
175  private slots: void OnRemoveCollision(const std::string &_name);
176 
178  private: std::vector<event::ConnectionPtr> connections;
179 
181  private: boost::recursive_mutex *updateMutex;
182 
184  public: sdf::ElementPtr linkSDF;
185 
187  private: double mass;
188 
190  private: double inertiaIxx;
191 
193  private: double inertiaIyy;
194 
196  private: double inertiaIzz;
197 
199  public: ignition::math::Vector3d scale;
200 
203 
205  public: std::map<rendering::VisualPtr, msgs::Visual> visuals;
206 
208  public: std::vector<msgs::Visual *> visualUpdateMsgs;
209 
211  public: std::vector<msgs::Collision *> collisionUpdateMsgs;
212 
214  public: std::map<rendering::VisualPtr, msgs::Collision> collisions;
215 
218 
220  public: bool nested;
221  };
222 
224  class GZ_GUI_VISIBLE ModelPluginData : public QObject
225  {
226  Q_OBJECT
227 
229  public: ModelPluginData();
230 
232  public: ~ModelPluginData();
233 
236  public: void Load(sdf::ElementPtr _pluginElem);
237 
240 
242  public: sdf::ElementPtr modelPluginSDF;
243  };
244  }
245 }
246 
247 #endif
sdf::ElementPtr modelSDF
SDF representing the model data.
Definition: ModelData.hh:76
Definition: LinkInspector.hh:38
std::map< rendering::VisualPtr, msgs::Collision > collisions
Collisions of the link.
Definition: ModelData.hh:214
std::vector< msgs::Visual * > visualUpdateMsgs
Msgs for updating visuals.
Definition: ModelData.hh:208
rendering::VisualPtr modelVisual
Visual representing this model.
Definition: ModelData.hh:79
#define GZ_GUI_VISIBLE
Definition: system.hh:284
rendering::VisualPtr linkVisual
Visual representing this link.
Definition: ModelData.hh:202
sdf::ElementPtr linkSDF
SDF representing the link data.
Definition: ModelData.hh:184
ModelPluginInspector * inspector
Inspector for configuring model plugin properties.
Definition: ModelData.hh:239
Definition: ModelData.hh:39
LinkInspector * inspector
Inspector for configuring link properties.
Definition: ModelData.hh:217
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
bool nested
Flag set to true if this is a link of a nested model.
Definition: ModelData.hh:220
Helper class to store nested models data.
Definition: ModelData.hh:57
std::map< rendering::VisualPtr, msgs::Visual > visuals
Visuals of the link.
Definition: ModelData.hh:205
std::map< std::string, rendering::VisualWeakPtr > links
Links inside this model.
Definition: ModelData.hh:85
Inspector for model plugin properties.
Definition: ModelPluginInspector.hh:35
std::vector< msgs::Collision * > collisionUpdateMsgs
Msgs for updating collision visuals.
Definition: ModelData.hh:211
sdf::ElementPtr modelPluginSDF
SDF representing the model plugin data.
Definition: ModelData.hh:242
Helper class to store model plugin data.
Definition: ModelData.hh:224
Helper class to store link data.
Definition: ModelData.hh:90
ignition::math::Vector3d scale
Scale of link.
Definition: ModelData.hh:199
#define NULL
Definition: CommonTypes.hh:31
std::map< std::string, rendering::VisualWeakPtr > models
Models inside this model.
Definition: ModelData.hh:82