Pose.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _GAZEBO_POSE_HH_
18 #define _GAZEBO_POSE_HH_
19 
20 #include <iostream>
21 
22 #include <ignition/math/Pose3.hh>
23 
24 #include "gazebo/math/Vector3.hh"
26 #include "gazebo/util/system.hh"
27 
28 #ifndef _WIN32
29  #pragma GCC diagnostic push
30  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
31 #endif
32 
33 namespace gazebo
34 {
35  namespace math
36  {
39 
42  class GZ_MATH_VISIBLE Pose
43  {
45  public: static const Pose Zero;
46 
48  public: Pose() GAZEBO_DEPRECATED(8.0);
49 
53  public: Pose(const Vector3 &_pos, const Quaternion &_rot)
54  GAZEBO_DEPRECATED(8.0);
55 
63  public: Pose(double _x, double _y, double _z,
64  double _roll, double _pitch, double _yaw)
65  GAZEBO_DEPRECATED(8.0);
66 
69  public: Pose(const Pose &_pose) GAZEBO_DEPRECATED(8.0);
70 
73  public: Pose(const ignition::math::Pose3d &_pose) GAZEBO_DEPRECATED(8.0);
74 
76  public: virtual ~Pose() GAZEBO_DEPRECATED(8.0);
77 
81  public: void Set(const Vector3 &_pos, const Quaternion &_rot)
82  GAZEBO_DEPRECATED(8.0);
83 
87  public: void Set(const Vector3 &_pos, const Vector3 &_rpy)
88  GAZEBO_DEPRECATED(8.0);
89 
97  public: void Set(double _x, double _y, double _z,
98  double _roll, double _pitch, double _yaw)
99  GAZEBO_DEPRECATED(8.0);
100 
102  public: bool IsFinite() const GAZEBO_DEPRECATED(8.0);
103 
105  public: inline void Correct() GAZEBO_DEPRECATED(8.0)
106  {
107  this->pos.Correct();
108  this->rot.Correct();
109  }
110 
113  public: Pose GetInverse() const GAZEBO_DEPRECATED(8.0);
114 
121  public: Pose operator+(const Pose &_pose) const GAZEBO_DEPRECATED(8.0);
122 
126  public: const Pose &operator+=(const Pose &_pose) GAZEBO_DEPRECATED(8.0);
127 
132  public: inline Pose operator-() const GAZEBO_DEPRECATED(8.0)
133  {
134  return Pose() - *this;
135  }
136 
143  public: inline Pose operator-(const Pose &_pose) const
144  GAZEBO_DEPRECATED(8.0)
145  {
146  return Pose(this->CoordPositionSub(_pose),
147  this->CoordRotationSub(_pose.rot));
148  }
149 
153  public: const Pose &operator-=(const Pose &_pose) GAZEBO_DEPRECATED(8.0);
154 
159  public: bool operator ==(const Pose &_pose) const;
160 
164  public: bool operator!=(const Pose &_pose) const GAZEBO_DEPRECATED(8.0);
165 
169  public: Pose operator*(const Pose &_pose) GAZEBO_DEPRECATED(8.0);
170 
173  public: Pose &operator=(const Pose &_pose) GAZEBO_DEPRECATED(8.0);
174 
177  public: Pose &operator=(const ignition::math::Pose3d &_pose)
178  GAZEBO_DEPRECATED(8.0);
179 
183  public: Vector3 CoordPositionAdd(const Vector3 &_pos) const
184  GAZEBO_DEPRECATED(8.0);
185 
189  public: Vector3 CoordPositionAdd(const Pose &_pose) const
190  GAZEBO_DEPRECATED(8.0);
191 
195  public: inline Vector3 CoordPositionSub(const Pose &_pose) const
196  GAZEBO_DEPRECATED(8.0)
197  {
198  Quaternion tmp(0.0,
199  this->pos.x - _pose.pos.x,
200  this->pos.y - _pose.pos.y,
201  this->pos.z - _pose.pos.z);
202 
203  tmp = _pose.rot.GetInverse() * (tmp * _pose.rot);
204  return Vector3(tmp.x, tmp.y, tmp.z);
205  }
206 
210  public: Quaternion CoordRotationAdd(const Quaternion &_rot) const
211  GAZEBO_DEPRECATED(8.0);
212 
216  public: inline Quaternion CoordRotationSub(const Quaternion &_rot) const
217  GAZEBO_DEPRECATED(8.0)
218  {
219  Quaternion result(_rot.GetInverse() * this->rot);
220  result.Normalize();
221  return result;
222  }
223 
227  public: Pose CoordPoseSolve(const Pose &_b) const GAZEBO_DEPRECATED(8.0);
228 
230  public: void Reset() GAZEBO_DEPRECATED(8.0);
231 
235  public: Pose RotatePositionAboutOrigin(const Quaternion &_rot) const
236  GAZEBO_DEPRECATED(8.0);
237 
240  public: void Round(int _precision) GAZEBO_DEPRECATED(8.0);
241 
244  public: ignition::math::Pose3d Ign() const GAZEBO_DEPRECATED(8.0);
245 
250  public: friend std::ostream &operator<<(std::ostream &_out,
251  const gazebo::math::Pose &_pose)
252  GAZEBO_DEPRECATED(8.0)
253  {
254  _out << _pose.pos << " " << _pose.rot;
255  return _out;
256  }
257 
262  public: friend std::istream &operator>>(std::istream &_in,
264  {
265  // Skip white spaces
266  _in.setf(std::ios_base::skipws);
267  _in >> _pose.pos >> _pose.rot;
268  return _in;
269  }
270 
272  public: Vector3 pos;
273 
275  public: Quaternion rot;
276  };
278  }
279 }
280 #ifndef _WIN32
281  #pragma GCC diagnostic pop
282 #endif
283 #endif
friend std::istream & operator>>(std::istream &_in, gazebo::math::Pose &_pose) GAZEBO_DEPRECATED(8.0)
Stream extraction operator.
Definition: Pose.hh:262
Quaternion rot
The rotation.
Definition: Pose.hh:275
Encapsulates a position and rotation in three space.
Definition: Pose.hh:42
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
static const double GAZEBO_DEPRECATED(8.0) MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:140
void Normalize() GAZEBO_DEPRECATED(8.0)
Normalize the quaternion.
static const Pose Zero
math::Pose(0, 0, 0, 0, 0, 0)
Definition: Pose.hh:45
double y
y value of the quaternion
Definition: Quaternion.hh:418
Pose operator-(const Pose &_pose) const GAZEBO_DEPRECATED(8.0)
Subtraction operator A is the transform from O to P in frame O B is the transform from O to Q in fram...
Definition: Pose.hh:143
Quaternion CoordRotationSub(const Quaternion &_rot) const GAZEBO_DEPRECATED(8.0)
Subtract one rotation from another: result = this->rot - rot.
Definition: Pose.hh:216
A quaternion class.
Definition: Quaternion.hh:48
Vector3 pos
The position.
Definition: Pose.hh:272
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
Vector3 CoordPositionSub(const Pose &_pose) const GAZEBO_DEPRECATED(8.0)
Subtract one position from another: result = this - pose.
Definition: Pose.hh:195
double x
x value of the quaternion
Definition: Quaternion.hh:415
Quaternion GetInverse() const GAZEBO_DEPRECATED(8.0)
Get the inverse of this quaternion.
Definition: Quaternion.hh:111
double z
z value of the quaternion
Definition: Quaternion.hh:421
bool const T & _b
Definition: Helpers.hh:258