Fawkes API  Fawkes Development Version
box_filter.h
1 
2 /***************************************************************************
3  * map_filter.h - Laser map data filter
4  *
5  * Created: Fri Jul 17 20:38:14 2015
6  * Copyright 2006-2015 Tim Niemueller [www.niemueller.de]
7  * 2015 Tobias Neumann
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #ifndef _PLUGINS_LASER_FILTER_FILTERS_BOX_FILTER_H_
25 #define _PLUGINS_LASER_FILTER_FILTERS_BOX_FILTER_H_
26 
27 //#include <plugins/amcl/amcl_utils.h>
28 //#include <plugins/amcl/map/map.h>
29 
30 #include "filter.h"
31 
32 #include <aspect/blackboard.h>
33 #include <aspect/configurable.h>
34 #include <aspect/logging.h>
35 #include <aspect/tf.h>
36 #include <core/threading/thread.h>
37 #include <interfaces/LaserBoxFilterInterface.h>
38 
40 {
41 private:
42  struct Vector
43  {
44  float x = 0.0, y = 0.0;
45  };
46  struct Box
47  {
48  Vector a, b, c, d;
49  };
50 
51  fawkes::tf::Transformer *tf_listener_;
52  fawkes::Configuration * config_;
53  fawkes::Logger * logger_;
54 
55  // map_t *map_;
56  fawkes::LaserBoxFilterInterface *box_filter_if_;
57  std::string frame_map_;
58  float cfg_occupied_thresh_;
59 
60 public:
61  LaserBoxFilterDataFilter(const std::string & filter_name,
62  unsigned int in_data_size,
63  std::vector<LaserDataFilter::Buffer *> &in,
64  fawkes::tf::Transformer * tf_listener,
65  fawkes::Configuration * config,
67  fawkes::BlackBoard * blackboard);
68 
69  virtual void filter();
70 
71 private:
72  std::vector<Box> boxes_;
73  bool point_in_rectangle(float x, float y);
74  Vector d_vec(Vector p1, Vector p2);
75  inline double dot(Vector u, Vector v);
76 };
77 
78 #endif
LaserDataFilter::filter_name
std::string filter_name
Definition: filter.h:86
LaserBoxFilterDataFilter::filter
virtual void filter()
Definition: box_filter.cpp:122
fawkes::tf::Transformer
Definition: transformer.h:74
LaserDataFilter::in_data_size
unsigned int in_data_size
Definition: filter.h:88
fawkes::BlackBoard
Definition: blackboard.h:50
LaserDataFilter::in
std::vector< Buffer * > in
Definition: filter.h:89
LaserBoxFilterDataFilter
Definition: box_filter.h:39
fawkes::Configuration
Definition: config.h:70
LaserBoxFilterDataFilter::LaserBoxFilterDataFilter
LaserBoxFilterDataFilter(const std::string &filter_name, unsigned int in_data_size, std::vector< LaserDataFilter::Buffer * > &in, fawkes::tf::Transformer *tf_listener, fawkes::Configuration *config, fawkes::Logger *logger, fawkes::BlackBoard *blackboard)
Constructor.
Definition: box_filter.cpp:50
fawkes::LoggingAspect::logger
Logger * logger
Definition: logging.h:53
fawkes::Logger
Definition: logger.h:41
fawkes::LaserBoxFilterInterface
Definition: LaserBoxFilterInterface.h:39
fawkes::LoggingAspect
Definition: logging.h:38
LaserDataFilter
Definition: filter.h:32