OpenWalker Project
Documentation of the ROS Packages
homogeneous_transformation.h
Go to the documentation of this file.
1 
34 #ifndef OPEN_WALKER_CORE_HOMOGENEOUS_TRANSFORMATION_H
35 #define OPEN_WALKER_CORE_HOMOGENEOUS_TRANSFORMATION_H
36 
37 #include <ow_core/rotation3_ref.h>
39 
40 namespace ow_core
41 {
54 template <typename _Scalar>
56  public Eigen::Transform<_Scalar, 3, Eigen::Affine>
57 {
58 public:
59  typedef _Scalar Scalar;
60  typedef Eigen::Transform<_Scalar, 3, Eigen::Affine> Base;
61  typedef typename Eigen::Transform<_Scalar, 3, Eigen::Affine>::MatrixType Matrix;
62 
69  {
70  static const HomogeneousTransformation v = Matrix::Identity().matrix();
71  return v;
72  }
73 
74 public:
79  Base(Default())
80  {
81  }
82 
88  HomogeneousTransformation(const Base& other) :
89  Base(other)
90  {
91  }
92 
99  template <typename OtherDerived>
100  HomogeneousTransformation(const Eigen::EigenBase<OtherDerived>& other) :
101  Base(other.derived())
102  {
103  }
104 
109  explicit HomogeneousTransformation(const typename Base::TranslationType& other) :
110  Base(other)
111  {
112  }
113 
118  template <typename OtherDerived>
119  explicit HomogeneousTransformation(const Eigen::RotationBase<OtherDerived, 3>& other) :
120  Base(other)
121  {
122  }
123 
128  explicit HomogeneousTransformation(const tf::Transform& other)
129  {
130  operator=(other);
131  }
132 
137  explicit HomogeneousTransformation(const geometry_msgs::Pose& other)
138  {
139  operator=(other);
140  }
141 
145  using Base::operator=;
146 
150  void operator=(const tf::Transform& other)
151  {
152  position() = other.getOrigin();
153  orientation() = other.getRotation();
154  }
155 
159  void operator=(const geometry_msgs::Pose& other)
160  {
161  position() = other.position;
162  orientation() = other.orientation;
163  }
164 
170  operator tf::Transform() const
171  {
172  return tf::Transform(orientation().toQuaternionTF(), position());
173  }
174 
180  operator geometry_msgs::Pose() const
181  {
182  geometry_msgs::Pose X;
183  X.position = position();
184  X.orientation = orientation();
185  return X;
186  }
187 
193  tf::Transform toTransformTf()
194  {
195  return static_cast<tf::Transform>(*this);
196  }
197 
203  geometry_msgs::Pose toPoseMsg()
204  {
205  return static_cast<geometry_msgs::Pose>(*this);
206  }
207 
212  {
213  return LinearPositionRef<Matrix>(this->matrix(),0,3);
214  }
215 
220  {
221  return LinearPositionRef<const Matrix>(this->matrix(),0,3);
222  }
223 
228  {
229  return Rotation3Ref<Matrix>(this->matrix());
230  }
231 
236  {
237  return Rotation3Ref<const Matrix>(this->matrix());
238  }
239 
243  std::string toString() const
244  {
245  std::ostringstream out;
246  out << this->matrix();
247  return out.str();
248  }
249 };
250 
251 } // namespace ow_core
252 
253 #endif // OPEN_WALKER_CORE_HOMOGENEOUS_TRANSFORMATION_H
HomogeneousTransformation()
Default Constructor.
Definition: homogeneous_transformation.h:78
Rotation3Ref< Matrix > orientation()
access to orientation part
Definition: homogeneous_transformation.h:227
LinearPositionRef< Matrix > position()
access to position part
Definition: homogeneous_transformation.h:211
HomogeneousTransformation(const Base &other)
Copy constructor from Eigen::Affine.
Definition: homogeneous_transformation.h:88
void operator=(const geometry_msgs::Pose &other)
Assignment form geometry_msgs::Pose.
Definition: homogeneous_transformation.h:159
std::string toString() const
Conversion to std::string.
Definition: homogeneous_transformation.h:243
The LinearPositionRef class.
Definition: linear_position_ref.h:52
HomogeneousTransformation(const tf::Transform &other)
Copy constructor from tf::Transform.
Definition: homogeneous_transformation.h:128
HomogeneousTransformation(const geometry_msgs::Pose &other)
Copy constructor from geometry_msgs::Pose.
Definition: homogeneous_transformation.h:137
void operator=(const tf::Transform &other)
Assignment form tf::Transform.
Definition: homogeneous_transformation.h:150
LinearPositionRef< const Matrix > position() const
const access to position part
Definition: homogeneous_transformation.h:219
tf::Transform toTransformTf()
Conversion to tf::Transform.
Definition: homogeneous_transformation.h:193
Rotation3Ref< const Matrix > orientation() const
const access to orientation part
Definition: homogeneous_transformation.h:235
Definition: angular_acceleration.h:39
The Rotation3Ref class.
Definition: rotation3_ref.h:53
The HomogeneousTransformation class.
Definition: homogeneous_transformation.h:55
static const HomogeneousTransformation< Scalar > & Default()
Default constructor.
Definition: homogeneous_transformation.h:68
HomogeneousTransformation(const Eigen::RotationBase< OtherDerived, 3 > &other)
Copy constructor from Eigen::RotationBase.
Definition: homogeneous_transformation.h:119
HomogeneousTransformation(const Eigen::EigenBase< OtherDerived > &other)
Copy constructor OtherDerived.
Definition: homogeneous_transformation.h:100
geometry_msgs::Pose toPoseMsg()
Conversion to geometry_msgs::Pose.
Definition: homogeneous_transformation.h:203
HomogeneousTransformation(const typename Base::TranslationType &other)
Copy constructor from Eigen::Transform::Translation.
Definition: homogeneous_transformation.h:109