FramedOrientedPoint.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @author Martin Miller (martin dot miller at student dot kit dot edu)
17* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
18* GNU General Public License
19*/
20
21#pragma once
22
23
24#include <VirtualRobot/VirtualRobot.h>
25
26#include <RobotAPI/interface/core/RobotState.h>
27
28#include "FramedPose.h"
29#include "OrientedPoint.h"
30
31namespace armarx::VariantType
32{
33 // variant types
35 Variant::addTypeName("::armarx::FramedOrientedPointBase");
36} // namespace armarx::VariantType
37
38namespace armarx
39{
42
43 class FramedOrientedPoint : virtual public FramedOrientedPointBase, virtual public OrientedPoint
44 {
45 public:
48 FramedOrientedPoint(const Eigen::Vector3f& position,
49 const Eigen::Vector3f& normal,
50 const std::string& frame,
51 const std::string& agent);
52 FramedOrientedPoint(const OrientedPoint& pointWithNormal,
53 const std::string& frame,
54 const std::string& agent);
55 FramedOrientedPoint(Ice::Float px,
56 ::Ice::Float py,
57 ::Ice::Float pz,
58 Ice::Float nx,
59 ::Ice::Float ny,
60 ::Ice::Float nz,
61 const std::string& frame,
62 const std::string& agent);
63
64 std::string getFrame() const;
65 void changeFrame(const VirtualRobot::RobotPtr& robot, const std::string& newFrame);
66
67 void changeToGlobal(const SharedRobotInterfacePrx& referenceRobot);
68 void changeToGlobal(const VirtualRobot::RobotPtr& referenceRobot);
71 Eigen::Vector3f positionToGlobalEigen(const SharedRobotInterfacePrx& referenceRobot) const;
72 Eigen::Vector3f normalToGlobalEigen(const SharedRobotInterfacePrx& referenceRobot) const;
73 Eigen::Vector3f positionToGlobalEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
74 Eigen::Vector3f normalToGlobalEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
77 Eigen::Vector3f positionToRootEigen(const SharedRobotInterfacePrx& referenceRobot) const;
78 Eigen::Vector3f normalToRootEigen(const SharedRobotInterfacePrx& referenceRobot) const;
79 Eigen::Vector3f positionToRootEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
80 Eigen::Vector3f normalToRootEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
81
84
85 // inherited from VariantDataClass
86 Ice::ObjectPtr
87 ice_clone() const override
88 {
89 return this->clone();
90 }
91
92 VariantDataClassPtr
93 clone(const Ice::Current& c = Ice::emptyCurrent) const override
94 {
95 return new FramedOrientedPoint(*this);
96 }
97
98 std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
99
101 getType(const Ice::Current& c = Ice::emptyCurrent) const override
102 {
104 }
105
106 bool
107 validate(const Ice::Current& c = Ice::emptyCurrent) override
108 {
109 return true;
110 }
111
112 friend std::ostream&
113 operator<<(std::ostream& stream, const FramedOrientedPoint& rhs)
114 {
115 stream << "FramedOrientedPoint: " << std::endl << rhs.output() << std::endl;
116 return stream;
117 }
118
119 public: // serialization
120 void serialize(const armarx::ObjectSerializerBasePtr& serializer,
121 const ::Ice::Current& = Ice::emptyCurrent) const override;
122 void deserialize(const armarx::ObjectSerializerBasePtr& serializer,
123 const ::Ice::Current& = Ice::emptyCurrent) override;
124 };
125} // namespace armarx
constexpr T c
FramedDirection is a 3 dimensional direction vector with a reference frame.
Definition FramedPose.h:87
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Eigen::Vector3f positionToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
FramedPosition getFramedPosition() const
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
FramedOrientedPointPtr toGlobal(const VirtualRobot::RobotPtr &referenceRobot) const
FramedDirection getFramedNormal() const
Eigen::Vector3f normalToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
FramedOrientedPointPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Eigen::Vector3f normalToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
FramedOrientedPointPtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
friend std::ostream & operator<<(std::ostream &stream, const FramedOrientedPoint &rhs)
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
Eigen::Vector3f positionToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
Ice::ObjectPtr ice_clone() const override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
void changeFrame(const VirtualRobot::RobotPtr &robot, const std::string &newFrame)
The FramedPosition class.
Definition FramedPose.h:158
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition Variant.cpp:869
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
const VariantTypeId FramedOrientedPoint
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
Definition FramedPose.h:59
Ice::Int VariantTypeId
Definition Variant.h:43
IceInternal::Handle< FramedOrientedPoint > FramedOrientedPointPtr