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 <ignition/math/Pose3.hh>
23 #include "sdf/Element.hh"
24 #include "sdf/SemanticPose.hh"
25 #include "sdf/Types.hh"
26 #include "sdf/sdf_config.h"
27 #include "sdf/system_util.hh"
28 
29 namespace sdf
30 {
31  // Inline bracket to help doxygen filtering.
32  inline namespace SDF_VERSION_NAMESPACE {
33  //
34 
35  // Forward declarations.
36  class Frame;
37  class Joint;
38  class Link;
39  class ModelPrivate;
40  struct PoseRelativeToGraph;
41 
43  {
45  public: Model();
46 
49  public: Model(const Model &_model);
50 
53  public: Model(Model &&_model) noexcept;
54 
58  public: Model &operator=(Model &&_model);
59 
63  public: Model &operator=(const Model &_model);
64 
66  public: ~Model();
67 
74  public: Errors Load(ElementPtr _sdf);
75 
79  public: std::string Name() const;
80 
84  public: void SetName(const std::string &_name);
85 
90  public: bool Static() const;
91 
96  public: void SetStatic(bool _static);
97 
103  public: bool SelfCollide() const;
104 
109  public: void SetSelfCollide(bool _selfCollide);
110 
115  public: bool AllowAutoDisable() const;
116 
121  public: void SetAllowAutoDisable(bool _allowAutoDisable);
122 
127  public: bool EnableWind() const;
128 
132  public: void SetEnableWind(bool _enableWind);
133 
136  public: uint64_t LinkCount() const;
137 
143  public: const Link *LinkByIndex(const uint64_t _index) const;
144 
148  public: const Link *LinkByName(const std::string &_name) const;
149 
153  public: bool LinkNameExists(const std::string &_name) const;
154 
157  public: uint64_t JointCount() const;
158 
164  public: const Joint *JointByIndex(const uint64_t _index) const;
165 
169  public: bool JointNameExists(const std::string &_name) const;
170 
176  public: const Joint *JointByName(const std::string &_name) const;
177 
180  public: uint64_t FrameCount() const;
181 
188  public: const Frame *FrameByIndex(const uint64_t _index) const;
189 
194  public: const Frame *FrameByName(const std::string &_name) const;
195 
199  public: bool FrameNameExists(const std::string &_name) const;
200 
207  public: const ignition::math::Pose3d &Pose() const
208  SDF_DEPRECATED(9.0);
209 
214  public: void SetPose(const ignition::math::Pose3d &_pose)
215  SDF_DEPRECATED(9.0);
216 
222  public: const ignition::math::Pose3d &RawPose() const;
223 
227  public: void SetRawPose(const ignition::math::Pose3d &_pose);
228 
231  public: const Link *CanonicalLink() const;
232 
236  public: const std::string &CanonicalLinkName() const;
237 
241  public: void SetCanonicalLinkName(const std::string &_canonicalLink);
242 
247  public: const std::string &PoseRelativeTo() const;
248 
253  public: void SetPoseRelativeTo(const std::string &_frame);
254 
260  public: const std::string &PoseFrame() const
261  SDF_DEPRECATED(9.0);
262 
268  public: void SetPoseFrame(const std::string &_frame)
269  SDF_DEPRECATED(9.0);
270 
275  public: sdf::ElementPtr Element() const;
276 
280  public: sdf::SemanticPose SemanticPose() const;
281 
286  private: void SetPoseRelativeToGraph(
287  std::weak_ptr<const PoseRelativeToGraph> _graph);
288 
290  friend class World;
291 
293  private: ModelPrivate *dataPtr = nullptr;
294  };
295  }
296 }
297 #endif
Definition: Model.hh:42
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
Definition: World.hh:45
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:41
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
Definition: Joint.hh:82
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:32
#define SDF_DEPRECATED(version)
Definition: Types.hh:38