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 "OrientedPoint.h"
25 
26 #include <VirtualRobot/Robot.h>
27 #include <VirtualRobot/LinkedCoordinate.h>
28 #include <VirtualRobot/LinkedCoordinate.h>
29 #include <VirtualRobot/VirtualRobot.h>
30 
31 #include <RobotAPI/interface/core/RobotState.h>
32 #include "FramedPose.h"
33 
34 namespace armarx::VariantType
35 {
36  // variant types
37  const VariantTypeId FramedOrientedPoint = Variant::addTypeName("::armarx::FramedOrientedPointBase");
38 }
39 
40 namespace armarx
41 {
42  class FramedOrientedPoint;
44 
46  virtual public FramedOrientedPointBase,
47  virtual public OrientedPoint
48  {
49  public:
52  FramedOrientedPoint(const Eigen::Vector3f& position, const Eigen::Vector3f& normal, const std::string& frame, const std::string& agent);
53  FramedOrientedPoint(const OrientedPoint& pointWithNormal, const std::string& frame, const std::string& agent);
54  FramedOrientedPoint(Ice::Float px, ::Ice::Float py, ::Ice::Float pz, Ice::Float nx, ::Ice::Float ny, ::Ice::Float nz, const std::string& frame, const std::string& agent);
55 
56  std::string getFrame() const;
57  void changeFrame(const VirtualRobot::RobotPtr& robot, const std::string& newFrame);
58 
59  void changeToGlobal(const SharedRobotInterfacePrx& referenceRobot);
60  void changeToGlobal(const VirtualRobot::RobotPtr& referenceRobot);
61  FramedOrientedPointPtr toGlobal(const SharedRobotInterfacePrx& referenceRobot) const;
62  FramedOrientedPointPtr toGlobal(const VirtualRobot::RobotPtr& referenceRobot) const;
63  Eigen::Vector3f positionToGlobalEigen(const SharedRobotInterfacePrx& referenceRobot) const;
64  Eigen::Vector3f normalToGlobalEigen(const SharedRobotInterfacePrx& referenceRobot) const;
65  Eigen::Vector3f positionToGlobalEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
66  Eigen::Vector3f normalToGlobalEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
67  FramedOrientedPointPtr toRootFrame(const SharedRobotInterfacePrx& referenceRobot) const;
68  FramedOrientedPointPtr toRootFrame(const VirtualRobot::RobotPtr& referenceRobot) const;
69  Eigen::Vector3f positionToRootEigen(const SharedRobotInterfacePrx& referenceRobot) const;
70  Eigen::Vector3f normalToRootEigen(const SharedRobotInterfacePrx& referenceRobot) const;
71  Eigen::Vector3f positionToRootEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
72  Eigen::Vector3f normalToRootEigen(const VirtualRobot::RobotPtr& referenceRobot) const;
73 
76 
77  // inherited from VariantDataClass
78  Ice::ObjectPtr ice_clone() const override
79  {
80  return this->clone();
81  }
82  VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override
83  {
84  return new FramedOrientedPoint(*this);
85  }
86  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override;
87  VariantTypeId getType(const Ice::Current& c = Ice::emptyCurrent) const override
88  {
90  }
91  bool validate(const Ice::Current& c = Ice::emptyCurrent) override
92  {
93  return true;
94  }
95 
96  friend std::ostream& operator<<(std::ostream& stream, const FramedOrientedPoint& rhs)
97  {
98  stream << "FramedOrientedPoint: " << std::endl << rhs.output() << std::endl;
99  return stream;
100  }
101 
102  public: // serialization
103  void serialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) const override;
104  void deserialize(const armarx::ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent) override;
105 
106  };
107 }
108 
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:918
armarx::FramedOrientedPoint::getFramedPosition
FramedPosition getFramedPosition() const
Definition: FramedOrientedPoint.cpp:148
armarx::VariantType::FramedOrientedPoint
const VariantTypeId FramedOrientedPoint
Definition: FramedOrientedPoint.h:37
armarx::FramedOrientedPoint::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: FramedOrientedPoint.h:91
armarx::FramedOrientedPoint::getFrame
std::string getFrame() const
Definition: FramedOrientedPoint.cpp:64
armarx::OrientedPoint
Definition: OrientedPoint.h:41
armarx::FramedOrientedPoint::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: FramedOrientedPoint.cpp:176
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::FramedOrientedPoint::changeFrame
void changeFrame(const VirtualRobot::RobotPtr &robot, const std::string &newFrame)
Definition: FramedOrientedPoint.cpp:70
armarx::FramedOrientedPoint::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.h:87
armarx::FramedOrientedPoint
Definition: FramedOrientedPoint.h:45
armarx::FramedOrientedPoint::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.cpp:159
OrientedPoint.h
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::FramedOrientedPoint::normalToGlobalEigen
Eigen::Vector3f normalToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:102
armarx::FramedOrientedPoint::FramedOrientedPoint
FramedOrientedPoint()
armarx::FramedOrientedPoint::changeToGlobal
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
Definition: FramedOrientedPoint.cpp:86
FramedPose.h
armarx::FramedPosition
The FramedPosition class.
Definition: FramedPose.h:142
armarx::VariantType
Definition: ChannelRef.h:160
armarx::FramedOrientedPoint::getFramedNormal
FramedDirection getFramedNormal() const
Definition: FramedOrientedPoint.cpp:153
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::FramedOrientedPoint::positionToGlobalEigen
Eigen::Vector3f positionToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:97
armarx::FramedOrientedPoint::toRootFrame
FramedOrientedPointPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:118
armarx::FramedDirection
FramedDirection is a 3 dimensional direction vector with a reference frame. The reference frame can b...
Definition: FramedPose.h:83
armarx::FramedOrientedPoint::positionToRootEigen
Eigen::Vector3f positionToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:128
IceInternal::ProxyHandle< ::IceProxy::armarx::SharedRobotInterface >
armarx::FramedOrientedPoint::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.cpp:167
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx::FramedOrientedPoint::toGlobal
FramedOrientedPointPtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
armarx::FramedOrientedPoint::operator<<
friend std::ostream & operator<<(std::ostream &stream, const FramedOrientedPoint &rhs)
Definition: FramedOrientedPoint.h:96
armarx::FramedOrientedPoint::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.h:82
armarx::FramedOrientedPoint::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: FramedOrientedPoint.h:78
armarx::FramedOrientedPoint::normalToRootEigen
Eigen::Vector3f normalToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:133
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
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18