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 "FramedPose.h"
28 
29 #include <RobotAPI/interface/core/LinkedPoseBase.h>
30 #include <RobotAPI/interface/core/RobotState.h>
31 
34 
35 #include <Eigen/Core>
36 #include <Eigen/Geometry>
37 
38 #include <sstream>
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 }
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 :
61  virtual public LinkedPoseBase,
62  virtual public FramedPose
63  {
64  public:
65  LinkedPose();
66  LinkedPose(const LinkedPose& other);
67  LinkedPose(const FramedPose& other, const SharedRobotInterfacePrx& referenceRobot);
68  LinkedPose(const Eigen::Matrix3f& m, const Eigen::Vector3f& v, const std::string& frame, const SharedRobotInterfacePrx& referenceRobot);
69  LinkedPose(const Eigen::Matrix4f& m, const std::string& frame, const SharedRobotInterfacePrx& referenceRobot);
70 
71  ~LinkedPose() override;
72 
73  VirtualRobot::LinkedCoordinate createLinkedCoordinate();
74 
75 
76  // inherited from VariantDataClass
77  Ice::ObjectPtr ice_clone() const override;
78 
79  VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override;
80 
81  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
82 
83  VariantTypeId getType(const Ice::Current& c = Ice::emptyCurrent) const override;
84 
85  bool validate(const Ice::Current& c = Ice::emptyCurrent) override;
86 
87  void changeFrame(const std::string& newFrame, const Ice::Current& c = Ice::emptyCurrent) override;
88  void changeToGlobal();
89  LinkedPosePtr toGlobal() const;
90 
91  friend std::ostream& operator<<(std::ostream& stream, const LinkedPose& rhs)
92  {
93  stream << "LinkedPose: " << std::endl << rhs.output() << std::endl;
94  return stream;
95  };
96 
97  void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) const override;
98  void deserialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) override;
99  protected:
100 
101  void ice_postUnmarshal() override;
102  };
103 
104 
105 
106  /**
107  * @class LinkedDirection is a direction vector (NOT a position vector) with an attached robotstate proxy
108  * for frame changes.
109  * @ingroup VariantsGrp
110  * @ingroup RobotAPI-FramedPose
111  * @brief The LinkedDirection class
112  */
114  virtual public LinkedDirectionBase,
115  virtual public FramedDirection
116  {
117  public:
118  LinkedDirection();
120  LinkedDirection(const Eigen::Vector3f& v, const std::string& frame, const SharedRobotInterfacePrx& referenceRobot);
121 
122  ~LinkedDirection() override;
123 
124  void changeFrame(const std::string& newFrame, const Ice::Current& c = Ice::emptyCurrent) override;
125 
126  // inherited from VariantDataClass
127  Ice::ObjectPtr ice_clone() const override
128  {
129  return this->clone();
130  }
131 
132  VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override
133  {
134  return new LinkedDirection(*this);
135  }
136 
137  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override
138  {
139  std::stringstream s;
140  s << FramedDirection::toEigen() << std::endl << "reference robot: " << referenceRobot;
141  return s.str();
142  }
143 
144  VariantTypeId getType(const Ice::Current& c = Ice::emptyCurrent) const override
145  {
147  }
148 
149  bool validate(const Ice::Current& c = Ice::emptyCurrent) override
150  {
151  return true;
152  }
153 
154 
155  friend std::ostream& operator<<(std::ostream& stream, const LinkedDirection& rhs)
156  {
157  stream << "LinkedDirection: " << std::endl << rhs.output() << std::endl;
158  return stream;
159  };
160 
161  void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) const override;
162  void deserialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) override;
163 
164  protected:
165 
166  void ice_postUnmarshal() override;
167 
168 
169  };
171 }
172 
armarx::LinkedPose::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:140
armarx::LinkedDirection::LinkedDirection
LinkedDirection()
armarx::LinkedDirection::operator<<
friend std::ostream & operator<<(std::ostream &stream, const LinkedDirection &rhs)
Definition: LinkedPose.h:155
armarx::LinkedDirection::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: LinkedPose.cpp:285
armarx::VariantType::suppressWarningUnusedVariableForLinkedPoseAndDirection
void suppressWarningUnusedVariableForLinkedPoseAndDirection()
Definition: LinkedPose.cpp:297
armarx::LinkedDirection::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:132
armarx::FramedPose
The FramedPose class.
Definition: FramedPose.h:258
armarx::LinkedDirection
The LinkedDirection class.
Definition: LinkedPose.h:113
armarx::LinkedDirection::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:275
armarx::LinkedPose::operator<<
friend std::ostream & operator<<(std::ostream &stream, const LinkedPose &rhs)
Definition: LinkedPose.h:91
armarx::LinkedPose::changeFrame
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:162
armarx::LinkedPose::createLinkedCoordinate
VirtualRobot::LinkedCoordinate createLinkedCoordinate()
Definition: LinkedPose.cpp:119
AbstractObjectSerializer.h
armarx::LinkedPose::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:180
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::LinkedDirection::changeFrame
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:258
armarx::LinkedPose::LinkedPose
LinkedPose()
Definition: LinkedPose.cpp:43
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::LinkedDirection::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:144
armarx::LinkedPose::~LinkedPose
~LinkedPose() override
Definition: LinkedPose.cpp:103
FramedPose.h
armarx::LinkedDirection::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.h:137
armarx::LinkedDirection::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:280
armarx::VariantType
Definition: ChannelRef.h:160
armarx::LinkedPose::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LinkedPose.cpp:135
armarx::LinkedPose::changeToGlobal
void changeToGlobal()
Definition: LinkedPose.cpp:167
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::FramedDirection
FramedDirection is a 3 dimensional direction vector with a reference frame. The reference frame can b...
Definition: FramedPose.h:83
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:152
IceInternal::ProxyHandle< ::IceProxy::armarx::SharedRobotInterface >
armarx::LinkedDirection::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.h:149
armarx::LinkedPose::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:188
armarx::LinkedPose::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: LinkedPose.cpp:203
armarx::LinkedPose::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LinkedPose.cpp:145
armarx::LinkedDirection::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LinkedPose.h:127
armarx::LinkedPose::toGlobal
LinkedPosePtr toGlobal() const
Definition: LinkedPose.cpp:172
armarx::LinkedPose
The LinkedPose class.
Definition: LinkedPose.h:60
armarx::LinkedPose::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LinkedPose.cpp:157
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::LinkedDirection::~LinkedDirection
~LinkedDirection() override
Definition: LinkedPose.cpp:243
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:28
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:751
armarx::VariantType::LinkedDirection
const VariantTypeId LinkedDirection
Definition: LinkedPose.h:44