Model.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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 SDF_MODEL_HH_
18 #define SDF_MODEL_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <utility>
23 #include <ignition/math/Pose3.hh>
24 #include "sdf/Element.hh"
25 #include "sdf/SemanticPose.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
34  //
35 
36  // Forward declarations.
37  class Frame;
38  class Joint;
39  class Link;
40  class ModelPrivate;
41  struct PoseRelativeToGraph;
42 
44  {
46  public: Model();
47 
50  public: Model(const Model &_model);
51 
54  public: Model(Model &&_model) noexcept;
55 
59  public: Model &operator=(Model &&_model);
60 
64  public: Model &operator=(const Model &_model);
65 
67  public: ~Model();
68 
75  public: Errors Load(ElementPtr _sdf);
76 
80  public: std::string Name() const;
81 
85  public: void SetName(const std::string &_name);
86 
91  public: bool Static() const;
92 
97  public: void SetStatic(bool _static);
98 
104  public: bool SelfCollide() const;
105 
110  public: void SetSelfCollide(bool _selfCollide);
111 
116  public: bool AllowAutoDisable() const;
117 
122  public: void SetAllowAutoDisable(bool _allowAutoDisable);
123 
128  public: bool EnableWind() const;
129 
133  public: void SetEnableWind(bool _enableWind);
134 
137  public: uint64_t LinkCount() const;
138 
144  public: const Link *LinkByIndex(const uint64_t _index) const;
145 
149  public: const Link *LinkByName(const std::string &_name) const;
150 
154  public: bool LinkNameExists(const std::string &_name) const;
155 
158  public: uint64_t JointCount() const;
159 
165  public: const Joint *JointByIndex(const uint64_t _index) const;
166 
170  public: bool JointNameExists(const std::string &_name) const;
171 
177  public: const Joint *JointByName(const std::string &_name) const;
178 
181  public: uint64_t FrameCount() const;
182 
189  public: const Frame *FrameByIndex(const uint64_t _index) const;
190 
195  public: const Frame *FrameByName(const std::string &_name) const;
196 
200  public: bool FrameNameExists(const std::string &_name) const;
201 
204  public: uint64_t ModelCount() const;
205 
211  public: const Model *ModelByIndex(const uint64_t _index) const;
212 
216  public: bool ModelNameExists(const std::string &_name) const;
217 
223  public: const Model *ModelByName(const std::string &_name) const;
224 
230  public: const ignition::math::Pose3d &RawPose() const;
231 
235  public: void SetRawPose(const ignition::math::Pose3d &_pose);
236 
239  public: const Link *CanonicalLink() const;
240 
245  public: const std::string &CanonicalLinkName() const;
246 
251  public: void SetCanonicalLinkName(const std::string &_canonicalLink);
252 
257  public: const std::string &PoseRelativeTo() const;
258 
263  public: void SetPoseRelativeTo(const std::string &_frame);
264 
269  public: sdf::ElementPtr Element() const;
270 
274  public: sdf::SemanticPose SemanticPose() const;
275 
281  private: sdf::Errors SetPoseRelativeToGraph(
282  std::weak_ptr<const PoseRelativeToGraph> _graph);
283 
288  private: std::pair<const Link *, std::string> CanonicalLinkAndRelativeName()
289  const;
290 
292  friend class World;
293 
296  friend std::pair<const Link *, std::string>
297  modelCanonicalLinkAndRelativeName(const Model *);
298 
300  private: ModelPrivate *dataPtr = nullptr;
301  };
302  }
303 }
304 #endif
Definition: World.hh:45
Definition: Joint.hh:82
Definition: Model.hh:43
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:41
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:32
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95