LaserScannerObstacleDetection.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 Armar6Skills::ArmarXObjects::LaserObstacleDetection
17 * @author Christian R. G. Dreher <c.dreher@kit.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 <mutex>
29#include <string>
30
31// Eigen
32#include <Eigen/Core>
33
34// Ice
35#include <Ice/Current.h>
36
37// ArmarX
40
41// Interface
42#include <RobotComponents/interface/components/ObstacleDetection/LaserScannerObstacleDetectionInterface.h>
43
44// ObstacleAvoidance
45#include <RobotAPI/interface/components/ObstacleAvoidance/DynamicObstacleManagerInterface.h>
46
47namespace armarx
48{
49
51 virtual public Component,
52 virtual public LaserScannerObstacleDetectionInterface
53 {
54
55 public:
56 static const std::string default_name;
57
58 public:
60
61 std::string getDefaultName() const override;
62 void setEnabled(bool enable, const Ice::Current& = Ice::emptyCurrent) override;
63 void enable(const Ice::Current& = Ice::emptyCurrent) override;
64 void disable(const Ice::Current& = Ice::emptyCurrent) override;
65
66 // void reportCorrectedPose(Ice::Float, Ice::Float, Ice::Float, const Ice::Current& = Ice::Current()) override { /* nop */ };
67 // void reportPoseUncertainty(Ice::Float, Ice::Float, Ice::Float, const Ice::Current& = Ice::Current()) override { /* nop */ };
68 // void reportLaserScanPoints(const Vector2fSeq&, const Ice::Current& = Ice::Current()) override { /* nop */ };
69 // void reportExtractedEdges(const LineSegment2DSeq&, const Ice::Current& = Ice::Current()) override;
70
72 const laser_scanner_feature_extraction::LineSegment2DChainSeq& globalLineSegmentChains,
73 const Ice::Current& = Ice::Current()) override;
74
75 protected:
76 void onInitComponent() override;
77 void onConnectComponent() override;
78 void onDisconnectComponent() override;
79 void onExitComponent() override;
81
82
83 private:
84 void eval_obstacles();
85 float get_distance_from_point_to_line_segment(const Eigen::Vector2f& start,
86 const Eigen::Vector2f& end,
87 const Eigen::Vector2f& p) const;
88 float get_angle_between_vectors(const Eigen::Vector2f&, const Eigen::Vector2f&) const;
89
90 bool m_enabled;
91 int m_only_submit_first_n_results;
92 float m_max_distance_to_put_together;
93 float m_max_yaw_difference;
94
95 unsigned int m_periodic_task_interval;
96 unsigned int m_accept_lines_after;
97
98 PeriodicTask<LaserScannerObstacleDetection>::pointer_type m_eval_obstacles;
99 laser_scanner_feature_extraction::LineSegment2DChainSeq m_lines_buffer;
100 IceUtil::Time m_last_accepted_lines;
101
102 std::mutex m_lines_buffer_mutex;
103 std::mutex m_enabled_mutex;
104
105 DynamicObstacleManagerInterface::ProxyType m_obstacle_manager;
106 };
107
108} // namespace armarx
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
Definition Component.cpp:66
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
void reportExtractedLineSegments(const laser_scanner_feature_extraction::LineSegment2DChainSeq &globalLineSegmentChains, const Ice::Current &=Ice::Current()) override
void onConnectComponent() override
Pure virtual hook for the subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void enable(const Ice::Current &=Ice::emptyCurrent) override
void setEnabled(bool enable, const Ice::Current &=Ice::emptyCurrent) override
void onExitComponent() override
Hook for subclass.
void disable(const Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
The periodic task executes one thread method repeatedly using the time period specified in the constr...
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.