libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
avoidfootcollision.h
Go to the documentation of this file.
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_AVOIDFOOTCOLLISION_H_
10 #define _LIBALMATH_ALMATH_TOOLS_AVOIDFOOTCOLLISION_H_
11 
12 #include <almath/api.h>
13 #include <almath/types/alpose2d.h>
15 #include <vector>
16 
17 namespace AL
18 {
19  namespace Math
20  {
32  ALMATH_API const bool avoidFootCollision(
33  const std::vector<Position2D>& pLFootBoundingBox,
34  const std::vector<Position2D>& pRFootBoundingBox,
35  const bool& pIsLeftSupport,
36  Pose2D& pMove);
37 
38 
49  ALMATH_API const bool clipFootWithEllipse(
50  const float& pMaxFootX,
51  const float& pMaxFootY,
52  Pose2D& pMove);
53 
54  // <summary> Query if the box A and the box B are in collision. </summary>
55  // <param name="pBoxA"> vector<Position2D> of the box A. </param>
56  // <param name="pBoxB"> vector<Position2D> of the box B. </param>
57  // <returns> true if box A and the box B are in collision. </returns>
58  ALMATH_API const bool areTwoBoxesInCollision(
59  const std::vector<Position2D>& pBoxA,
60  const std::vector<Position2D>& pBoxB);
61 
62  // <summary> Compute the box point due to a move. </summary>
63  // <param name="pInitBox"> vector<Position2D> of the fixed box. </param>
64  // <param name="pMove"> Pose2D the initial move. </param>
65  // <param name> vector<Position2D> the new box. </returns>
66  ALMATH_API void computeBox(
67  const std::vector<Position2D>& pInitBox,
68  const Pose2D& pMove,
69  std::vector<Position2D>& pMovedBox);
70 
71  // <summary> Compute the best orientation of the moving box without
72  // collsion with fixed box. </summary>
73  // <param name="pFixesBox"> vector<Position2D> of the fixed box. </param>
74  // <param name="pMovingBox"> vector<Position2D> of the moving box. </param>
75  // <param name="pMove"> Pose2D of moving box respect to fix box. </param>
76  // <returns> Pose2D, the best position. </returns>
77  ALMATH_API const void dichotomie(
78  const std::vector<Position2D>& pFixedBox,
79  const std::vector<Position2D>& pMovingBox,
80  Pose2D& pMove);
81 
82  // <summary> Checks if segment A intersects segment B. </summary>
83  // <param name="pA1"> first point of segment A. </param>
84  // <param name="pA2"> second point of segment A. </param>
85  // <param name="pB1"> first point of segment B. </param>
86  // <param name="pB2"> second point of segment B. </param>
87  // <param name="pC"> computed intersection point. </param>
88  // <returns> true if the segments intersect in a single point (pC). </returns>
89  ALMATH_API bool intersectionSegment2D(
90  const Position2D &pA1,
91  const Position2D &pA2,
92  const Position2D &pB1,
93  const Position2D &pB2,
94  Position2D &pC);
95 
96  } // namespace Math
97 } // namespace AL
98 
99 #endif // _LIBALMATH_ALMATH_TOOLS_AVOIDFOOTCOLLISION_H_
100 
ALMATH_API void computeBox(const std::vector< Position2D > &pInitBox, const Pose2D &pMove, std::vector< Position2D > &pMovedBox)
ALMATH_API const bool clipFootWithEllipse(const float &pMaxFootX, const float &pMaxFootY, Pose2D &pMove)
Clip foot move with ellipsoid function
ALMATH_API const bool areTwoBoxesInCollision(const std::vector< Position2D > &pBoxA, const std::vector< Position2D > &pBoxB)
ALMATH_API const void dichotomie(const std::vector< Position2D > &pFixedBox, const std::vector< Position2D > &pMovingBox, Pose2D &pMove)
ALMATH_API bool intersectionSegment2D(const Position2D &pA1, const Position2D &pA2, const Position2D &pB1, const Position2D &pB2, Position2D &pC)
ALMATH_API const bool avoidFootCollision(const std::vector< Position2D > &pLFootBoundingBox, const std::vector< Position2D > &pRFootBoundingBox, const bool &pIsLeftSupport, Pose2D &pMove)
Compute the best position(orientation) of the foot to avoid collision.