LinkedPose.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package RobotStateComponent::
19  * @author ( stefan dot ulbrich at kit dot edu)
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <sstream>
28 
29 #include <Eigen/Core>
30 #include <Eigen/Geometry>
31 
34 
35 #include <RobotAPI/interface/core/LinkedPoseBase.h>
36 #include <RobotAPI/interface/core/RobotState.h>
37 
38 #include "FramedPose.h"
39 
40 namespace armarx::VariantType
41 {
42  // variant types
43  const VariantTypeId LinkedPose = Variant::addTypeName("::armarx::LinkedPoseBase");
44  const VariantTypeId LinkedDirection = Variant::addTypeName("::armarx::LinkedDirectionBase");
45 
47 } // namespace armarx::VariantType
48 
49 namespace armarx
50 {
51  class LinkedPose;
53 
54  /**
55  * @class LinkedPose
56  * @ingroup VariantsGrp
57  * @ingroup RobotAPI-FramedPose
58  * @brief The LinkedPose class
59  */
60  class LinkedPose : virtual public LinkedPoseBase, virtual public FramedPose
61  {
62  public:
63  LinkedPose();
64  LinkedPose(const LinkedPose& other);
65  LinkedPose(const FramedPose& other, const SharedRobotInterfacePrx& referenceRobot);
66  LinkedPose(const Eigen::Matrix3f& m,
67  const Eigen::Vector3f& v,
68  const std::string& frame,
69  const SharedRobotInterfacePrx& referenceRobot);
70  LinkedPose(const Eigen::Matrix4f& m,
71  const std::string& frame,
72  const SharedRobotInterfacePrx& referenceRobot);
73 
74  ~LinkedPose() override;
75 
76  VirtualRobot::LinkedCoordinate createLinkedCoordinate();
77 
78 
79  // inherited from VariantDataClass
80  Ice::ObjectPtr ice_clone() const override;
81 
82  VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override;
83 
84  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
85 
86  VariantTypeId getType(const Ice::Current& c = Ice::emptyCurrent) const override;
87 
88  bool validate(const Ice::Current& c = Ice::emptyCurrent) override;
89 
90  void changeFrame(const std::string& newFrame,
91  const Ice::Current& c = Ice::emptyCurrent) override;
92  void changeToGlobal();
93  LinkedPosePtr toGlobal() const;
94 
95  friend std::ostream&
96  operator<<(std::ostream& stream, const LinkedPose& rhs)
97  {
98  stream << "LinkedPose: " << std::endl << rhs.output() << std::endl;
99  return stream;
100  };
101 
102  void serialize(const armarx::ObjectSerializerBasePtr& serializer,
103  const ::Ice::Current& = Ice::emptyCurrent) const override;
104  void deserialize(const armarx::ObjectSerializerBasePtr& serializer,
105  const ::Ice::Current& = Ice::emptyCurrent) override;
106 
107  protected:
108  void ice_postUnmarshal() override;
109  };
110 
111  /**
112  * @class LinkedDirection is a direction vector (NOT a position vector) with an attached robotstate proxy
113  * for frame changes.
114  * @ingroup VariantsGrp
115  * @ingroup RobotAPI-FramedPose
116  * @brief The LinkedDirection class
117  */
118  class LinkedDirection : virtual public LinkedDirectionBase, virtual public FramedDirection
119  {
120  public:
121  LinkedDirection();
123  LinkedDirection(const Eigen::Vector3f& v,
124  const std::string& frame,
125  const SharedRobotInterfacePrx& referenceRobot);
126 
127  ~LinkedDirection() override;
128 
129  void changeFrame(const std::string& newFrame,
130  const Ice::Current& c = Ice::emptyCurrent) override;
131 
132  // inherited from VariantDataClass
134  ice_clone() const override
135  {
136  return this->clone();
137  }
138 
139  VariantDataClassPtr
140  clone(const Ice::Current& c = Ice::emptyCurrent) const override
141  {
142  return new LinkedDirection(*this);
143  }
144 
145  std::string
146  output(const Ice::Current& c = Ice::emptyCurrent) const override
147  {
148  std::stringstream s;
149  s << FramedDirection::toEigen() << std::endl << "reference robot: " << referenceRobot;
150  return s.str();
151  }
152 
154  getType(const Ice::Current& c = Ice::emptyCurrent) const override
155  {
157  }
158 
159  bool
160  validate(const Ice::Current& c = Ice::emptyCurrent) override
161  {
162  return true;
163  }
164 
165  friend std::ostream&
166  operator<<(std::ostream& stream, const LinkedDirection& rhs)
167  {
168  stream << "LinkedDirection: " << std::endl << rhs.output() << std::endl;
169  return stream;
170  };
171 
172  void serialize(const armarx::ObjectSerializerBasePtr& serializer,
173  const ::Ice::Current& = Ice::emptyCurrent) const override;
174  void deserialize(const armarx::ObjectSerializerBasePtr& serializer,
175  const ::Ice::Current& = Ice::emptyCurrent) override;
176 
177  protected:
178  void ice_postUnmarshal() override;
179  };
180 
182 } // namespace armarx
armarx::LinkedPose::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:141
armarx::LinkedDirection::LinkedDirection
LinkedDirection()
armarx::LinkedDirection::operator<<
friend std::ostream & operator<<(std::ostream &stream, const LinkedDirection &rhs)
Definition: LinkedPose.h:166
armarx::LinkedDirection::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: LinkedPose.cpp:300
armarx::VariantType::suppressWarningUnusedVariableForLinkedPoseAndDirection
void suppressWarningUnusedVariableForLinkedPoseAndDirection()
Definition: LinkedPose.cpp:312
armarx::LinkedDirection::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:140
armarx::FramedPose
The FramedPose class.
Definition: FramedPose.h:280
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
armarx::LinkedDirection
The LinkedDirection class.
Definition: LinkedPose.h:118
armarx::LinkedDirection::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:288
armarx::LinkedPose::operator<<
friend std::ostream & operator<<(std::ostream &stream, const LinkedPose &rhs)
Definition: LinkedPose.h:96
armarx::LinkedPose::changeFrame
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:168
armarx::LinkedPose::createLinkedCoordinate
VirtualRobot::LinkedCoordinate createLinkedCoordinate()
Definition: LinkedPose.cpp:118
AbstractObjectSerializer.h
armarx::LinkedPose::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:188
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::LinkedDirection::changeFrame
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:271
armarx::LinkedPose::LinkedPose
LinkedPose()
Definition: LinkedPose.cpp:42
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::LinkedDirection::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:154
armarx::LinkedPose::~LinkedPose
~LinkedPose() override
Definition: LinkedPose.cpp:102
FramedPose.h
armarx::LinkedDirection::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:146
armarx::LinkedDirection::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:294
armarx::VariantType
Definition: ChannelRef.h:167
armarx::LinkedPose::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LinkedPose.cpp:135
armarx::LinkedPose::changeToGlobal
void changeToGlobal()
Definition: LinkedPose.cpp:174
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:43
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::FramedDirection
FramedDirection is a 3 dimensional direction vector with a reference frame. The reference frame can b...
Definition: FramedPose.h:86
armarx::Vector3::toEigen
virtual Eigen::Vector3f toEigen() const
Definition: Pose.cpp:134
armarx::LinkedPose::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:156
IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface >
armarx::LinkedDirection::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.h:160
armarx::LinkedPose::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:197
armarx::LinkedPose::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: LinkedPose.cpp:215
armarx::LinkedPose::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:147
armarx::LinkedDirection::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LinkedPose.h:134
armarx::LinkedPose::toGlobal
LinkedPosePtr toGlobal() const
Definition: LinkedPose.cpp:180
armarx::LinkedPose
The LinkedPose class.
Definition: LinkedPose.h:60
armarx::LinkedPose::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:162
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:649
armarx::LinkedDirection::~LinkedDirection
~LinkedDirection() override
Definition: LinkedPose.cpp:255
Variant.h
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:869
armarx::VariantType::LinkedDirection
const VariantTypeId LinkedDirection
Definition: LinkedPose.h:44