OpenWalker Project
Documentation of the ROS Packages
vector3_ref.h
Go to the documentation of this file.
1 
34 #ifndef OPEN_WALKER_CORE_VECTOR3_REF_H
35 #define OPEN_WALKER_CORE_VECTOR3_REF_H
36 
37 #include <ow_core/conversions.h>
38 #include <ow_core/vector_ref.h>
39 
40 namespace ow_core
41 {
52 template <typename _Derived>
53 class Vector3Ref : public VectorRef<_Derived, 3>
54 {
55 public:
56  typedef _Derived Derived;
58 
59 public:
73  explicit Vector3Ref(Derived& ref, int startRow = 0, int startCol = 0) : Base(ref, startRow, startCol)
74  {
75  }
76 
80  using Base::operator=;
81 
85  void operator=(const tf::Vector3& x)
86  {
87  vector3TFToVector3Eigen(x, *this);
88  }
89 
93  void operator=(const geometry_msgs::Vector3& x)
94  {
95  vector3MsgToEigenVector3(x, *this);
96  }
97 
101  void operator=(const geometry_msgs::Point& x)
102  {
103  pointMsgToEigenVector3(x, *this);
104  }
105 
109  operator tf::Vector3() const
110  {
111  tf::Vector3 x;
112  vector3EigenToVector3TF(*this, x);
113  return x;
114  }
115 
119  operator geometry_msgs::Point() const
120  {
121  geometry_msgs::Point x;
122  vector3EigenToPointMsg(*this, x);
123  return x;
124  }
125 
129  operator geometry_msgs::Vector3() const
130  {
131  geometry_msgs::Vector3 x;
132  vector3EigenToVector3Msg(*this, x);
133  return x;
134  }
135 
139  tf::Vector3 toVectorTF() const
140  {
141  return static_cast<tf::Vector3>(*this);
142  }
143 
147  geometry_msgs::Point toPointMsg() const
148  {
149  return static_cast<geometry_msgs::Point>(*this);
150  }
151 
155  geometry_msgs::Vector3 toVector3Msg() const
156  {
157  return static_cast<geometry_msgs::Vector3>(*this);
158  }
159 
160 private:
164  Vector3Ref();
165 };
166 
167 } // namespace ow_core
168 
169 #endif // OPEN_WALKER_CORE_VECTOR3_REF_H
The VectorRef class.
Definition: vector_ref.h:51
geometry_msgs::Point toPointMsg() const
Conversion to geometry_msgs::Point.
Definition: vector3_ref.h:147
void vector3EigenToVector3TF(const Eigen::MatrixBase< _Derived > &e, tf::Vector3 &t)
Converts an Eigen::EigenBase into a tf::Vector3.
Definition: conversions.h:292
void vector3MsgToEigenVector3(const geometry_msgs::Vector3 &t, Eigen::MatrixBase< _Derived > &e)
Converts a geometry_msgs::Vector3 into an Eigen::EigenBase.
Definition: conversions.h:280
void vector3EigenToVector3Msg(const Eigen::MatrixBase< _Derived > &e, geometry_msgs::Vector3 &t)
Converts an Eigen::EigenBase to a geometry_msgs::Point.
Definition: conversions.h:247
geometry_msgs::Vector3 toVector3Msg() const
Conversion to geometry_msgs::Point.
Definition: vector3_ref.h:155
void pointMsgToEigenVector3(const geometry_msgs::Point &t, Eigen::MatrixBase< _Derived > &e)
Converts a geometry_msgs::Point into an Eigen::EigenBase.
Definition: conversions.h:263
void vector3EigenToPointMsg(const Eigen::MatrixBase< _Derived > &e, geometry_msgs::Point &t)
Converts an Eigen::EigenBase to a geometry_msgs::Point.
Definition: conversions.h:229
The Vector3Ref class.
Definition: vector3_ref.h:53
void operator=(const geometry_msgs::Vector3 &x)
Assignment of geometry_msgs::Vector3.
Definition: vector3_ref.h:93
void operator=(const tf::Vector3 &x)
Assignment of tf::Vector3.
Definition: vector3_ref.h:85
void operator=(const geometry_msgs::Point &x)
Assignment of geometry_msgs::Point.
Definition: vector3_ref.h:101
Contains global conversion functions.
tf::Vector3 toVectorTF() const
Conversion to tf::Vector3.
Definition: vector3_ref.h:139
Definition: angular_acceleration.h:39
Vector3Ref(Derived &ref, int startRow=0, int startCol=0)
Default Constructor.
Definition: vector3_ref.h:73
void vector3TFToVector3Eigen(const tf::Vector3 &t, Eigen::MatrixBase< _Derived > &e)
Converts an tf::Vector3 into Eigen::EigenBase.
Definition: conversions.h:303