ManagedObstacle.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package armar6_skills::ArmarXObjects::DynamicObstacleManager
17 * @author Fabian PK ( fabian dot peller-konrad at kit dot edu )
18 * @date 2020
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23
24#pragma once
25
26
27// STD/STL
28#include <array>
29#include <memory>
30#include <shared_mutex>
31#include <string>
32#include <tuple>
33#include <vector>
34
35// Eigen
36#include <Eigen/Geometry>
37
38// ArmarX
39#include <RobotAPI/interface/components/ObstacleAvoidance/ObstacleDetectionInterface.h>
40#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
41
42namespace armarx
43{
44
45 class ManagedObstacle;
46 typedef std::shared_ptr<ManagedObstacle> ManagedObstaclePtr;
47
49 {
50 public:
51 static bool
57
58 void update_position(const unsigned int);
59
60 static double calculateObstacleArea(const obstacledetection::Obstacle& o);
61
62 static bool point_ellipsis_coverage(const Eigen::Vector2f e_origin,
63 const float e_rx,
64 const float e_ry,
65 const float e_yaw,
66 const Eigen::Vector2f point);
67
68 static float ellipsis_ellipsis_coverage(const Eigen::Vector2f e1_origin,
69 const float e1_rx,
70 const float e1_ry,
71 const float e1_yaw,
72 const Eigen::Vector2f e2_origin,
73 const float e2_rx,
74 const float e2_ry,
75 const float e2_yaw);
76
77 static float line_segment_ellipsis_coverage(const Eigen::Vector2f e_origin,
78 const float e_rx,
79 const float e_ry,
80 const float e_yaw,
81 const Eigen::Vector2f line_seg_start,
82 const Eigen::Vector2f line_seg_end);
83
84
85 obstacledetection::Obstacle m_obstacle;
86 IceUtil::Time m_last_matched;
89 float m_value;
90 std::shared_mutex m_mutex;
91
92 unsigned int position_buffer_fillctr = 0;
93 unsigned int position_buffer_index = 0;
94 std::array<std::tuple<double, double, double, double, double>, 6>
95 position_buffer; //x, y, yaw, axisX, axisY
96 std::vector<Eigen::Vector2f> line_matches; // points of line segments
97
98
99 unsigned long m_input_index = 0;
100
101 protected:
102 private:
103 float normalizeYaw(float yaw) const;
104 float getAngleBetweenVectors(const Eigen::Vector2f&, const Eigen::Vector2f&) const;
105 float getXAxisAngle(const Eigen::Vector2f&) const;
106 };
107} // namespace armarx
unsigned int position_buffer_index
static double calculateObstacleArea(const obstacledetection::Obstacle &o)
std::array< std::tuple< double, double, double, double, double >, 6 > position_buffer
static float line_segment_ellipsis_coverage(const Eigen::Vector2f e_origin, const float e_rx, const float e_ry, const float e_yaw, const Eigen::Vector2f line_seg_start, const Eigen::Vector2f line_seg_end)
unsigned int position_buffer_fillctr
std::shared_mutex m_mutex
static bool point_ellipsis_coverage(const Eigen::Vector2f e_origin, const float e_rx, const float e_ry, const float e_yaw, const Eigen::Vector2f point)
static float ellipsis_ellipsis_coverage(const Eigen::Vector2f e1_origin, const float e1_rx, const float e1_ry, const float e1_yaw, const Eigen::Vector2f e2_origin, const float e2_rx, const float e2_ry, const float e2_yaw)
std::vector< Eigen::Vector2f > line_matches
static bool ComparatorDESCPrt(ManagedObstaclePtr &i, ManagedObstaclePtr &j)
obstacledetection::Obstacle m_obstacle
void update_position(const unsigned int)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< ManagedObstacle > ManagedObstaclePtr