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
40namespace 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
49namespace 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:
122 LinkedDirection(const LinkedDirection& source);
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
133 Ice::ObjectPtr
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
constexpr T c
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition LinkedPose.h:154
void ice_postUnmarshal() override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition LinkedPose.h:146
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition LinkedPose.h:140
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition LinkedPose.h:160
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
friend std::ostream & operator<<(std::ostream &stream, const LinkedDirection &rhs)
Definition LinkedPose.h:166
Ice::ObjectPtr ice_clone() const override
Definition LinkedPose.h:134
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
The LinkedPose class.
Definition LinkedPose.h:61
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
void ice_postUnmarshal() override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
void changeFrame(const std::string &newFrame, const Ice::Current &c=Ice::emptyCurrent) override
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
VirtualRobot::LinkedCoordinate createLinkedCoordinate()
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
LinkedPosePtr toGlobal() const
friend std::ostream & operator<<(std::ostream &stream, const LinkedPose &rhs)
Definition LinkedPose.h:96
Ice::ObjectPtr ice_clone() const override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
~LinkedPose() override
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition Variant.cpp:869
virtual Eigen::Vector3f toEigen() const
Definition Pose.cpp:134
const VariantTypeId LinkedDirection
Definition LinkedPose.h:44
void suppressWarningUnusedVariableForLinkedPoseAndDirection()
const VariantTypeId LinkedPose
Definition LinkedPose.h:43
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< LinkedPose > LinkedPosePtr
Definition LinkedPose.h:52
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
Definition FramedPose.h:59
Ice::Int VariantTypeId
Definition Variant.h:43
IceInternal::Handle< LinkedDirection > LinkedDirectionPtr
Definition LinkedPose.h:181