InterfaceModel.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2021 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 
18 #ifndef SDF_INTERFACE_MODEL_HH_
19 #define SDF_INTERFACE_MODEL_HH_
20 
21 #include <functional>
22 #include <string>
23 #include <memory>
24 #include <vector>
25 
26 #include <gz/math/Pose3.hh>
27 #include <gz/utils/ImplPtr.hh>
28 
29 #include "sdf/InterfaceFrame.hh"
30 #include "sdf/InterfaceJoint.hh"
31 #include "sdf/InterfaceLink.hh"
33 #include "sdf/Types.hh"
34 
35 #include "sdf/sdf_config.h"
36 #include "sdf/system_util.hh"
37 
38 namespace sdf
39 {
40 inline namespace SDF_VERSION_NAMESPACE
41 {
42 class InterfaceModel;
43 class Model;
44 struct PoseRelativeToGraph;
45 template <typename T>
46 class ScopedGraph;
47 class World;
48 
49 using InterfaceModelPtr = std::shared_ptr<InterfaceModel>;
50 using InterfaceModelConstPtr = std::shared_ptr<const InterfaceModel>;
51 
53 using RepostureFunction =
54  std::function<void(const sdf::InterfaceModelPoseGraph &)>;
55 
58 {
71  public: InterfaceModel(const std::string &_name,
72  const sdf::RepostureFunction &_repostureFunction,
73  bool _static,
74  const std::string &_canonicalLinkName,
75  const gz::math::Pose3d &_poseInParentFrame = {});
76 
79  public: const std::string &Name() const;
80 
83  public: bool Static() const;
84 
90  public: const std::string &CanonicalLinkName() const;
91 
94  public: const gz::math::Pose3d &ModelFramePoseInParentFrame() const;
95 
98  public: void AddNestedModel(sdf::InterfaceModelConstPtr _nestedModel);
99 
101  public: const std::vector<sdf::InterfaceModelConstPtr> &NestedModels() const;
102 
106  public: void AddFrame(sdf::InterfaceFrame _frame);
107 
109  public: const std::vector<sdf::InterfaceFrame> &Frames() const;
110 
114  public: void AddJoint(sdf::InterfaceJoint _joint);
115 
117  public: const std::vector<sdf::InterfaceJoint> &Joints() const;
118 
122  public: void AddLink(sdf::InterfaceLink _link);
123 
125  public: const std::vector<sdf::InterfaceLink> &Links() const;
126 
129  public: bool ParserSupportsMergeInclude() const;
130 
133  public: void SetParserSupportsMergeInclude(bool _val);
134 
138  private: void InvokeRepostureFunction(
140  const std::optional<std::string> &_name) const;
141 
142  friend World;
143  friend Model;
145  GZ_UTILS_IMPL_PTR(dataPtr)
146 };
147 }
148 }
149 
150 #endif
InterfaceModelPoseGraph.hh
InterfaceJoint.hh
sdf::SDF_VERSION_NAMESPACE::Model
Definition: Model.hh:54
sdf::SDF_VERSION_NAMESPACE::InterfaceModel
Interface element representing a Model.
Definition: InterfaceModel.hh:57
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::SDF_VERSION_NAMESPACE::InterfaceModelPtr
std::shared_ptr< InterfaceModel > InterfaceModelPtr
Definition: InterfaceModel.hh:49
Types.hh
sdf::SDF_VERSION_NAMESPACE::InterfaceModelConstPtr
std::shared_ptr< const InterfaceModel > InterfaceModelConstPtr
Definition: InterfaceModel.hh:50
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::SDF_VERSION_NAMESPACE::InterfaceJoint
Interface element representing a Joint.
Definition: InterfaceJoint.hh:34
sdf::SDF_VERSION_NAMESPACE::RepostureFunction
std::function< void(const sdf::InterfaceModelPoseGraph &)> RepostureFunction
Function signature for the reposture callback function.
Definition: InterfaceModel.hh:54
InterfaceFrame.hh
sdf::SDF_VERSION_NAMESPACE::ScopedGraph
Definition: Collision.hh:40
system_util.hh
sdf::SDF_VERSION_NAMESPACE::InterfaceModelPoseGraph
Class used in reposture callbacks of custom parsers to resolve poses.
Definition: InterfaceModelPoseGraph.hh:44
sdf::SDF_VERSION_NAMESPACE::World
Definition: World.hh:57
sdf::SDF_VERSION_NAMESPACE::InterfaceFrame
Interface element representing an explicit frame.
Definition: InterfaceFrame.hh:34