libalmath  2.1.4.13
 All Classes Namespaces Functions Variables Typedefs Groups Pages
almath.h
1 /*
2  * Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 
8 #pragma once
9 #ifndef _LIBALMATH_ALMATH_TOOLS_ALMATH_H_
10 #define _LIBALMATH_ALMATH_TOOLS_ALMATH_H_
11 
12 #include <almath/types/alvelocity3d.h>
13 #include <almath/types/alvelocity6d.h>
14 #include <almath/types/alposition2d.h>
15 #include <almath/types/alposition3d.h>
16 #include <almath/types/alposition6d.h>
17 #include <almath/types/alrotation.h>
18 #include <almath/types/alrotation3d.h>
19 #include <almath/types/alquaternion.h>
20 #include <almath/types/alpose2d.h>
21 
22 namespace AL {
23  namespace Math {
24 
31  void modulo2PIInPlace(float& pAngle);
32 
42  float modulo2PI(float pAngle);
43 
57  bool clipData(
58  const float& pMin,
59  const float& pMax,
60  float& pData);
61 
62  bool clipData(
63  const float& pMin,
64  const float& pMax,
65  std::vector<float>& pData);
66 
67  bool clipData(
68  const float& pMin,
69  const float& pMax,
70  std::vector<std::vector<float> >& pData);
71 
73 
98  const float& pTheta,
99  const Pose2D& pPosIn,
100  Pose2D& pPosOut);
101 
109  const float& pTheta,
110  Pose2D& pPosOut);
111 
115 
124  Position6D position6DFromVelocity6D(const Velocity6D& pVel);
132 
141  const Pose2D& pPose2D,
142  Position2D& pPosition2D);
143 
147 
152  Position2D position2DFromPose2D(const Pose2D& pPose2D);
160 
164 
170  Position3D position3DFromPosition6D(const Position6D& pPosition6D);
178 
182 
198  Position3D operator*(
207  const Rotation& pRot,
208  const Position3D& pPos);
209 
219  Position3D operator*(
220  const Quaternion& pQuat,
221  const Position3D& pPos);
222 
223 
227 
236  Velocity6D operator*(
245  const float pVal,
246  const Position6D& pPos);
247 
251 
257  Velocity3D operator*(
266  const float pVal,
267  const Position3D& pPos);
268 
269 
280  const float& pTheta,
281  const Position3D& pPos);
282 
283 
291  const Pose2D& pPose2D,
292  Position6D& pPosition6D);
293 
300  Position6D position6DFromPose2D(const Pose2D& pPose2D);
301 
309  const Position3D& pPosition3D,
310  Position6D& pPosition6D);
311 
318  Position6D position6DFromPosition3D(const Position3D& pPosition3D);
319 
327  const Position6D& pPosition6D,
328  Pose2D& pPose2D);
329 
336  Pose2D pose2DFromPosition6D(const Position6D& pPosition6D);
337 
349  const Position2D& pPosition2D,
350  const float pAngle,
351  Pose2D& pPose2D);
352 
360  Pose2D pose2DFromPosition2D(const Position2D& pPosition2D,
361  const float pAngle=0.0f);
362 
366 
371  Position2D operator*(
380  const Pose2D& pVal,
381  const Position2D& pPos);
382 
391  const Rotation3D& pRot3D,
392  Quaternion& pQuaternion);
393 
394  Quaternion quaternionFromRotation3D(
395  const Rotation3D& pRot3D);
396 
404  const Quaternion& pQua,
405  Rotation& pRot);
406 
407  Rotation rotationFromQuaternion(
408  const Quaternion& pQua);
409 
418  const Quaternion& pQuaterion,
419  Rotation3D& pRot3D);
420 
421  Rotation3D rotation3DFromQuaternion(
422  const Quaternion& pQuaternion);
423 
432  const Position6D& pPos6D,
433  Quaternion& pQua,
434  Position3D& pPos3D);
435 
436  } // namespace Math
437 } // namespace AL
438 #endif // _LIBALMATH_ALMATH_TOOLS_ALMATH_H_
void position6DFromPose2DInPlace(const Pose2D &pPose2D, Position6D &pPosition6D)
Compute a Position6D from a Pose2D.
float modulo2PI(float pAngle)
Return an angle between ]-PI, PI].
void pose2DFromPosition2DInPlace(const Position2D &pPosition2D, const float pAngle, Pose2D &pPose2D)
Compute a Pose2D from a Position2D. pPose2D.x = pPosition2D.x pPose2D.y = pPosition2D.y pPose2D.theta = pAngle
void position2DFromPose2DInPlace(const Pose2D &pPose2D, Position2D &pPosition2D)
Compute a Position2D from a Pose2D. The theta member of the Pose2D is not taken into account...
void quaternionPosition3DFromPosition6D(const Position6D &pPos6D, Quaternion &pQua, Position3D &pPos3D)
Convert a Position6D to Quaternion and Position3D
Rotation rotationFromAngleDirection(const float &pTheta, const Position3D &pPos)
Creates a 3*3 Rotation Matrix from a an angle and a normalized Position3D.
Position2D position2DFromPose2D(const Pose2D &pPose2D)
Create a Position2D from a Pose2D
bool clipData(const float &pMin, const float &pMax, float &pData)
Clip an input data inside min and max limit.
Position3D position3DFromPosition6D(const Position6D &pPosition6D)
Create a Position3D from a Position6D
void position6DFromPosition3DInPlace(const Position3D &pPosition3D, Position6D &pPosition6D)
Compute a Position6D from a Position3D.
void changeReferencePose2DInPlace(const float &pTheta, Pose2D &pPosOut)
Change orientation of a Pose2D in place.
Pose2D pose2DFromPosition2D(const Position2D &pPosition2D, const float pAngle=0.0f)
Create a Pose2D from a Position2D.
void rotation3DFromQuaternion(const Quaternion &pQuaterion, Rotation3D &pRot3D)
Create a Rotation3D from a Quaternion when composed in the following order: Rz(wz) * Ry(wy) * Rx(wx) ...
void changeReferencePose2D(const float &pTheta, const Pose2D &pPosIn, Pose2D &pPosOut)
Position6D position6DFromPosition3D(const Position3D &pPosition3D)
Create a Position6D from a Position3D.
void rotationFromQuaternion(const Quaternion &pQua, Rotation &pRot)
Create a Rotation Matrix from a Quaternion
void pose2DFromPosition6DInPlace(const Position6D &pPosition6D, Pose2D &pPose2D)
Compute a Pose2D from a Position6D.
Position2D operator*(const Pose2D &pVal, const Position2D &pPos)
Overloading of operator * for Pose2D to Position2D, give a Position2D:
Position6D position6DFromPose2D(const Pose2D &pPose2D)
Create a Position6D from a Pose2D.
void modulo2PIInPlace(float &pAngle)
Set an angle between ]-PI, PI].
Pose2D pose2DFromPosition6D(const Position6D &pPosition6D)
Create a Pose2D from a Position6D.
void quaternionFromRotation3D(const Rotation3D &pRot3D, Quaternion &pQuaternion)
Create a Quaternion from a Rotation3D when composed in the following order: Rz(wz) * Ry(wy) * Rx(wx) ...
Position6D position6DFromVelocity6D(const Velocity6D &pVel)
Create a Position6D from a Velocity6D