Pose6D.h
Go to the documentation of this file.
1 /*
2  * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
3  * http://octomap.github.com/
4  *
5  * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
6  * All rights reserved.
7  * License: New BSD
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the University of Freiburg nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef OCTOMATH_POSE6D_H
35 #define OCTOMATH_POSE6D_H
36 
37 #include "Vector3.h"
38 #include "Quaternion.h"
39 
40 namespace octomath {
41 
49  class Pose6D {
50  public:
51 
52  Pose6D();
53  ~Pose6D();
54 
60  Pose6D(const Vector3& trans, const Quaternion& rot);
61 
69  Pose6D(float x, float y, float z, double roll, double pitch, double yaw);
70 
71  Pose6D& operator= (const Pose6D& other);
72  bool operator==(const Pose6D& other) const;
73  bool operator!=(const Pose6D& other) const;
74 
80  inline Vector3& trans() { return translation; }
86  inline Quaternion& rot() { return rotation; }
92  const Vector3& trans() const { return translation; }
97  const Quaternion& rot() const { return rotation; }
98 
99 
100  inline float& x() { return translation(0); }
101  inline float& y() { return translation(1); }
102  inline float& z() { return translation(2); }
103  inline const float& x() const { return translation(0); }
104  inline const float& y() const { return translation(1); }
105  inline const float& z() const { return translation(2); }
106 
107  inline double roll() const {return (rotation.toEuler())(0); }
108  inline double pitch() const {return (rotation.toEuler())(1); }
109  inline double yaw() const {return (rotation.toEuler())(2); }
110 
119  Vector3 transform (const Vector3 &v) const;
120 
127  Pose6D inv() const;
128 
135  Pose6D& inv_IP();
136 
144  Pose6D operator* (const Pose6D &p) const;
152  const Pose6D& operator*= (const Pose6D &p);
153 
159  double distance(const Pose6D &other) const;
160 
167  double transLength() const;
168 
174  std::ostream& write(std::ostream &s) const;
180  std::istream& read(std::istream &s);
186  std::ostream& writeBinary(std::ostream &s) const;
192  std::istream& readBinary(std::istream &s);
193 
194  protected:
197  };
198 
200  std::ostream& operator<<(std::ostream& s, const Pose6D& p);
201 
202 }
203 
204 #endif
std::ostream & writeBinary(std::ostream &s) const
Binary output operator.
Definition: Pose6D.cpp:141
std::istream & read(std::istream &s)
Input operator.
Definition: Pose6D.cpp:119
std::ostream & operator<<(std::ostream &s, const Pose6D &p)
user friendly output in format (x y z, u x y z) which is (translation, rotation)
Definition: Pose6D.cpp:147
double distance(const Pose6D &other) const
Translational distance.
Definition: Pose6D.cpp:98
Vector3 transform(const Vector3 &v) const
Transformation of a vector.
Definition: Pose6D.cpp:80
const float & y() const
Definition: Pose6D.h:104
Pose6D & operator=(const Pose6D &other)
Definition: Pose6D.cpp:58
bool operator!=(const Pose6D &other) const
Definition: Pose6D.cpp:115
float & x()
Definition: Pose6D.h:100
Vector3 toEuler() const
Conversion to Euler angles.
Definition: Quaternion.cpp:124
double transLength() const
Translational length.
Definition: Pose6D.cpp:105
std::istream & readBinary(std::istream &s)
Binary input operator.
Definition: Pose6D.cpp:134
Pose6D operator*(const Pose6D &p) const
Concatenation.
Definition: Pose6D.cpp:86
std::ostream & write(std::ostream &s) const
Output operator.
Definition: Pose6D.cpp:126
const Vector3 & trans() const
Translational component.
Definition: Pose6D.h:92
Pose6D inv() const
Inversion.
Definition: Pose6D.cpp:65
const float & z() const
Definition: Pose6D.h:105
float & z()
Definition: Pose6D.h:102
double roll() const
Definition: Pose6D.h:107
const Pose6D & operator*=(const Pose6D &p)
In place concatenation.
Definition: Pose6D.cpp:92
const float & x() const
Definition: Pose6D.h:103
This class represents a tree-dimensional pose of an object.
Definition: Pose6D.h:49
double yaw() const
Definition: Pose6D.h:109
Vector3 & trans()
Translational component.
Definition: Pose6D.h:80
bool operator==(const Pose6D &other) const
Definition: Pose6D.cpp:110
This class represents a three-dimensional vector.
Definition: Vector3.h:50
Quaternion rotation
Definition: Pose6D.h:196
float & y()
Definition: Pose6D.h:101
double pitch() const
Definition: Pose6D.h:108
Quaternion & rot()
Rotational component.
Definition: Pose6D.h:86
Vector3 translation
Definition: Pose6D.h:195
Pose6D & inv_IP()
Inversion.
Definition: Pose6D.cpp:73
This class represents a Quaternion.
Definition: Quaternion.h:56
const Quaternion & rot() const
Rotational component.
Definition: Pose6D.h:97


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:13