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 <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
38namespace sdf
39{
40inline namespace SDF_VERSION_NAMESPACE
41{
42class InterfaceModel;
43class Model;
44struct PoseRelativeToGraph;
45template <typename T>
46class ScopedGraph;
47class World;
48
49using InterfaceModelPtr = std::shared_ptr<InterfaceModel>;
50using InterfaceModelConstPtr = std::shared_ptr<const InterfaceModel>;
51
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
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:45
Interface element representing a Model.
Definition InterfaceModel.hh:58
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:55
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:54
std::shared_ptr< const InterfaceModel > InterfaceModelConstPtr
Definition InterfaceModel.hh:50
std::shared_ptr< InterfaceModel > InterfaceModelPtr
Definition InterfaceModel.hh:49
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