Frame.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 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_FRAME_HH_
18 #define SDF_FRAME_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <gz/math/Pose3.hh>
23 #include <gz/utils/ImplPtr.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  // Forward declaration.
36  struct FrameAttachedToGraph;
37  struct PoseRelativeToGraph;
38  template <typename T> class ScopedGraph;
39 
43  {
45  public: Frame();
46 
53  public: Errors Load(ElementPtr _sdf);
54 
58  public: const std::string &Name() const;
59 
63  public: void SetName(const std::string &_name);
64 
73  public: const std::string &AttachedTo() const;
74 
83  public: void SetAttachedTo(const std::string &_frame);
84 
90  public: const gz::math::Pose3d &RawPose() const;
91 
96  public: void SetRawPose(const gz::math::Pose3d &_pose);
97 
102  public: const std::string &PoseRelativeTo() const;
103 
108  public: void SetPoseRelativeTo(const std::string &_frame);
109 
113  public: sdf::ElementPtr Element() const;
114 
120  public: Errors ResolveAttachedToBody(std::string &_body) const;
121 
126 
132  public: sdf::ElementPtr ToElement() const;
133 
140  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
141 
146  private: void SetFrameAttachedToGraph(
148 
153  private: void SetPoseRelativeToGraph(
155 
157  friend class Model;
158  friend class World;
159 
161  GZ_UTILS_IMPL_PTR(dataPtr)
162  };
163  }
164 }
165 #endif
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:43
sdf::SemanticPose SemanticPose() const
Get SemanticPose object of this object to aid in resolving poses.
void SetAttachedTo(const std::string &_frame)
Set the name of the coordinate frame to which this frame is attached.
const std::string & PoseRelativeTo() const
Get the name of the coordinate frame relative to which this frame's pose is expressed.
void SetRawPose(const gz::math::Pose3d &_pose)
Set the raw pose of the frame object.
void SetName(const std::string &_name)
Set the name of the frame.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetPoseRelativeTo(const std::string &_frame)
Set the name of the coordinate frame relative to which this frame's pose is expressed.
Frame()
Default constructor.
sdf::ElementPtr ToElement(sdf::Errors &_errors) const
Create and return an SDF element filled with data from this frame.
const std::string & AttachedTo() const
Get the name of the coordinate frame to which this frame is attached.
Errors Load(ElementPtr _sdf)
Load the frame based on a element pointer.
const std::string & Name() const
Get the name of the frame.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this frame.
Errors ResolveAttachedToBody(std::string &_body) const
Resolve the attached-to body of this frame from the FrameAttachedToGraph.
const gz::math::Pose3d & RawPose() const
Get the pose of the frame object.
Definition: Model.hh:55
Definition: Collision.hh:44
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:55
Definition: World.hh:59
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
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