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 
31 namespace armarx::VariantType
32 {
33  // variant types
35  Variant::addTypeName("::armarx::FramedOrientedPointBase");
36 } // namespace armarx::VariantType
37 
38 namespace armarx
39 {
40  class FramedOrientedPoint;
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);
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);
69  FramedOrientedPointPtr toGlobal(const SharedRobotInterfacePrx& referenceRobot) const;
70  FramedOrientedPointPtr toGlobal(const VirtualRobot::RobotPtr& referenceRobot) const;
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;
75  FramedOrientedPointPtr toRootFrame(const SharedRobotInterfacePrx& referenceRobot) const;
76  FramedOrientedPointPtr toRootFrame(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
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
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
armarx::FramedOrientedPoint::getFramedPosition
FramedPosition getFramedPosition() const
Definition: FramedOrientedPoint.cpp:176
armarx::VariantType::FramedOrientedPoint
const VariantTypeId FramedOrientedPoint
Definition: FramedOrientedPoint.h:34
armarx::FramedOrientedPoint::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: FramedOrientedPoint.h:107
armarx::FramedOrientedPoint::getFrame
std::string getFrame() const
Definition: FramedOrientedPoint.cpp:77
armarx::OrientedPoint
Definition: OrientedPoint.h:42
armarx::FramedOrientedPoint::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: FramedOrientedPoint.cpp:207
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::FramedOrientedPoint::changeFrame
void changeFrame(const VirtualRobot::RobotPtr &robot, const std::string &newFrame)
Definition: FramedOrientedPoint.cpp:83
armarx::FramedOrientedPoint::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.h:101
armarx::FramedOrientedPoint
Definition: FramedOrientedPoint.h:43
armarx::FramedOrientedPoint::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.cpp:188
OrientedPoint.h
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::FramedOrientedPoint::normalToGlobalEigen
Eigen::Vector3f normalToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:120
armarx::FramedOrientedPoint::FramedOrientedPoint
FramedOrientedPoint()
armarx::FramedOrientedPoint::changeToGlobal
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
Definition: FramedOrientedPoint.cpp:101
FramedPose.h
armarx::FramedPosition
The FramedPosition class.
Definition: FramedPose.h:157
armarx::VariantType
Definition: ChannelRef.h:167
armarx::FramedOrientedPoint::getFramedNormal
FramedDirection getFramedNormal() const
Definition: FramedOrientedPoint.cpp:182
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::FramedOrientedPoint::positionToGlobalEigen
Eigen::Vector3f positionToGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:114
armarx::FramedOrientedPoint::toRootFrame
FramedOrientedPointPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:138
armarx::FramedDirection
FramedDirection is a 3 dimensional direction vector with a reference frame. The reference frame can b...
Definition: FramedPose.h:86
armarx::FramedOrientedPoint::positionToRootEigen
Eigen::Vector3f positionToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:152
IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface >
armarx::FramedOrientedPoint::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.cpp:197
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:113
armarx::FramedOrientedPoint::clone
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: FramedOrientedPoint.h:93
armarx::FramedOrientedPoint::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: FramedOrientedPoint.h:87
armarx::FramedOrientedPoint::normalToRootEigen
Eigen::Vector3f normalToRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
Definition: FramedOrientedPoint.cpp:158
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
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19