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 <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  // Forward declaration.
35  class FramePrivate;
36  struct FrameAttachedToGraph;
37  struct PoseRelativeToGraph;
38 
42  {
44  public: Frame();
45 
48  public: Frame(const Frame &_frame);
49 
52  public: Frame(Frame &&_frame);
53 
55  public: ~Frame();
56 
60  public: Frame &operator=(Frame &&_frame);
61 
65  public: Frame &operator=(const Frame &_frame);
66 
73  public: Errors Load(ElementPtr _sdf);
74 
78  public: const std::string &Name() const;
79 
83  public: void SetName(const std::string &_name) const;
84 
93  public: const std::string &AttachedTo() const;
94 
103  public: void SetAttachedTo(const std::string &_frame);
104 
110  public: const ignition::math::Pose3d &RawPose() const;
111 
116  public: void SetRawPose(const ignition::math::Pose3d &_pose);
117 
122  public: const std::string &PoseRelativeTo() const;
123 
128  public: void SetPoseRelativeTo(const std::string &_frame);
129 
133  public: sdf::ElementPtr Element() const;
134 
141  public: Errors ResolveAttachedToBody(std::string &_body) const;
142 
147 
152  private: void SetFrameAttachedToGraph(
153  std::weak_ptr<const FrameAttachedToGraph> _graph);
154 
159  private: void SetPoseRelativeToGraph(
160  std::weak_ptr<const PoseRelativeToGraph> _graph);
161 
163  friend class Model;
164  friend class World;
165 
167  private: FramePrivate *dataPtr = nullptr;
168  };
169  }
170 }
171 #endif
sdf::v9::Frame::Frame
Frame()
Default constructor.
sdf::v9::Frame::ResolveAttachedToBody
Errors ResolveAttachedToBody(std::string &_body) const
Resolve the attached-to body of this frame from the FrameAttachedToGraph.
sdf::v9::Frame::SetAttachedTo
void SetAttachedTo(const std::string &_frame)
Set the name of the coordinate frame to which this frame is attached.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v9::Frame::RawPose
const ignition::math::Pose3d & RawPose() const
Get the pose of the frame object.
sdf::v9::Frame::operator=
Frame & operator=(const Frame &_frame)
Assignment operator.
Types.hh
sdf::v9::Frame::Frame
Frame(Frame &&_frame)
Move constructor.
SemanticPose.hh
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
sdf::v9::Frame::SetName
void SetName(const std::string &_name) const
Set the name of the frame.
sdf::v9::Frame::SemanticPose
sdf::SemanticPose SemanticPose() const
Get SemanticPose object of this object to aid in resolving poses.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::World
Definition: World.hh:46
sdf::v9::Frame::PoseRelativeTo
const std::string & PoseRelativeTo() const
Get the name of the coordinate frame relative to which this frame's pose is expressed.
sdf::v9::Frame::Load
Errors Load(ElementPtr _sdf)
Load the frame based on a element pointer.
sdf::v9::Frame::SetPoseRelativeTo
void SetPoseRelativeTo(const std::string &_frame)
Set the name of the coordinate frame relative to which this frame's pose is expressed.
sdf::v9::Frame::operator=
Frame & operator=(Frame &&_frame)
Move assignment operator.
sdf::v9::Frame
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:42
sdf::v9::Frame::SetRawPose
void SetRawPose(const ignition::math::Pose3d &_pose)
Set the raw pose of the frame object.
sdf::v9::Frame::AttachedTo
const std::string & AttachedTo() const
Get the name of the coordinate frame to which this frame is attached.
sdf::v9::SemanticPose
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Model
Definition: Model.hh:44
sdf::v9::Frame::Frame
Frame(const Frame &_frame)
Copy constructor.
system_util.hh
sdf::v9::Frame::Name
const std::string & Name() const
Get the name of the frame.
sdf::v9::Frame::Element
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
Element.hh
sdf::v9::Frame::~Frame
~Frame()
Destructor.