Loading...
Searching...
No Matches
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 <optional>
24#include <memory>
25#include <vector>
26
27#include <gz/math/Pose3.hh>
28#include <gz/utils/ImplPtr.hh>
29
30#include "sdf/InterfaceFrame.hh"
31#include "sdf/InterfaceJoint.hh"
32#include "sdf/InterfaceLink.hh"
34#include "sdf/Types.hh"
35
36#include "sdf/config.hh"
37#include "sdf/system_util.hh"
38
39namespace sdf
40{
41inline namespace SDF_VERSION_NAMESPACE
42{
43class InterfaceModel;
44class Model;
45struct PoseRelativeToGraph;
46template <typename T>
47class ScopedGraph;
48class World;
49
50using InterfaceModelPtr = std::shared_ptr<InterfaceModel>;
51using InterfaceModelConstPtr = std::shared_ptr<const InterfaceModel>;
52
55 std::function<void(const sdf::InterfaceModelPoseGraph &)>;
56
59{
72 public: InterfaceModel(const std::string &_name,
73 const sdf::RepostureFunction &_repostureFunction,
74 bool _static,
75 const std::string &_canonicalLinkName,
76 const gz::math::Pose3d &_poseInParentFrame = {});
77
80 public: const std::string &Name() const;
81
84 public: bool Static() const;
85
91 public: const std::string &CanonicalLinkName() const;
92
95 public: const gz::math::Pose3d &ModelFramePoseInParentFrame() const;
96
99 public: void AddNestedModel(sdf::InterfaceModelConstPtr _nestedModel);
100
102 public: const std::vector<sdf::InterfaceModelConstPtr> &NestedModels() const;
103
107 public: void AddFrame(sdf::InterfaceFrame _frame);
108
110 public: const std::vector<sdf::InterfaceFrame> &Frames() const;
111
115 public: void AddJoint(sdf::InterfaceJoint _joint);
116
118 public: const std::vector<sdf::InterfaceJoint> &Joints() const;
119
123 public: void AddLink(sdf::InterfaceLink _link);
124
126 public: const std::vector<sdf::InterfaceLink> &Links() const;
127
130 public: bool ParserSupportsMergeInclude() const;
131
134 public: void SetParserSupportsMergeInclude(bool _val);
135
139 private: void InvokeRepostureFunction(
141 const std::optional<std::string> &_name) const;
142
143 friend World;
144 friend Model;
146 GZ_UTILS_IMPL_PTR(dataPtr)
147};
148}
149}
150
151#endif
Interface element representing an explicit frame.
Definition InterfaceFrame.hh:35
Interface element representing a Joint.
Definition InterfaceJoint.hh:35
Class used in reposture callbacks of custom parsers to resolve poses.
Definition InterfaceModelPoseGraph.hh:43
Interface element representing a Model.
Definition InterfaceModel.hh:59
void SetParserSupportsMergeInclude(bool _val)
Set whether the custom parser supports merge-include.
InterfaceModel(const std::string &_name, const sdf::RepostureFunction &_repostureFunction, bool _static, const std::string &_canonicalLinkName, const gz::math::Pose3d &_poseInParentFrame={})
Constructor.
const std::vector< sdf::InterfaceFrame > & Frames() const
Gets registered frames.
void AddNestedModel(sdf::InterfaceModelConstPtr _nestedModel)
Provided so that hierarchy can still be leveraged from SDFormat.
void AddFrame(sdf::InterfaceFrame _frame)
Add an interface frame.
const std::vector< sdf::InterfaceJoint > & Joints() const
Gets registered joints.
void AddLink(sdf::InterfaceLink _link)
Add an interface link.
bool Static() const
Get whether the model is static.
const std::string & CanonicalLinkName() const
Get the canonical link name.
void AddJoint(sdf::InterfaceJoint _joint)
Add an interface joint.
bool ParserSupportsMergeInclude() const
Whether the custom parser supports merge-include.
const std::string & Name() const
Get the name of the model.
const std::vector< sdf::InterfaceModelConstPtr > & NestedModels() const
Gets registered nested models.
const gz::math::Pose3d & ModelFramePoseInParentFrame() const
Get the pose of this model in the parent frame.
const std::vector< sdf::InterfaceLink > & Links() const
Gets registered links.
Definition Model.hh:57
Definition Collision.hh:44
Definition World.hh:59
std::function< void(const sdf::InterfaceModelPoseGraph &)> RepostureFunction
Function signature for the reposture callback function.
Definition InterfaceModel.hh:55
std::shared_ptr< const InterfaceModel > InterfaceModelConstPtr
Definition InterfaceModel.hh:51
std::shared_ptr< InterfaceModel > InterfaceModelPtr
Definition InterfaceModel.hh:50
namespace for Simulation Description Format parser
Definition Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:25