sick_scan_marker.h
Go to the documentation of this file.
1 /*
2  * @brief Implementation of object markers for sick_scan
3  *
4  * Copyright (C) 2021, Ing.-Buero Dr. Michael Lehning, Hildesheim
5  * Copyright (C) 2021, SICK AG, Waldkirch
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  * * Neither the name of Osnabrück University nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * Created on: 13.01.2021
33  *
34  * Authors:
35  * Michael Lehning <michael.lehning@lehning.de>
36  *
37  */
38 
39 #ifndef SICK_SCAN_MARKER_H_
40 #define SICK_SCAN_MARKER_H_
41 
42 #include <ros/ros.h>
43 #include <std_msgs/ColorRGBA.h>
44 #include <visualization_msgs/MarkerArray.h>
45 
46 #include "sick_scan/LFErecMsg.h"
47 #include "sick_scan/LIDoutputstateMsg.h"
49 
50 
51 namespace sick_scan
52 {
54  {
55  public:
56 
57  SickScanMarker(ros::NodeHandle* nh = 0, const std::string & marker_topic = "", const std::string & marker_frame_id = "");
58 
59  virtual ~SickScanMarker();
60 
61  void updateMarker(const std::vector<SickScanMonField>& fields, int fieldset, int eval_field_logic);
62 
63  void updateMarker(sick_scan::LIDoutputstateMsg& msg, int eval_field_logic);
64 
65  void updateMarker(sick_scan::LFErecMsg& msg, int eval_field_logic);
66 
67  protected:
68 
69  class FieldInfo
70  {
71  public:
72  FieldInfo(int idx=0, int result=0, const std::string& status="", const std::string& name="", const std_msgs::ColorRGBA& color=std_msgs::ColorRGBA())
73  : field_index_scan_mon(idx), field_result(result), field_status(status), field_name(name), field_color(color) {}
74  int field_index_scan_mon; // 0 to 47
75  int field_result;// 0 = invalid = gray, 1 = free/clear = green, 2 = infringed = yellow
76  std::string field_status; // field_result as string
77  std::string field_name; // name within the field set ("1", "2" or "3")
78  std_msgs::ColorRGBA field_color; // field_result as color
79  };
80 
81  void publishMarker(void);
82  std::vector<visualization_msgs::Marker> createMonFieldMarker(const std::vector<FieldInfo>& field_info);
83  std::vector<visualization_msgs::Marker> createMonFieldLegend(const std::vector<FieldInfo>& field_info);
84  std::vector<visualization_msgs::Marker> createMonFieldsetLegend(int fieldset);
85  std::vector<visualization_msgs::Marker> createOutputStateLegend(const std::vector<std::string>& output_state, const std::vector<std::string>& output_count, const std::vector<std_msgs::ColorRGBA>& output_colors);
86 
87  std::string m_frame_id;
90  std::vector<sick_scan::SickScanMonField> m_scan_mon_fields;
91  std::vector<visualization_msgs::Marker> m_scan_mon_field_marker;
92  std::vector<visualization_msgs::Marker> m_scan_mon_field_legend;
93  std::vector<visualization_msgs::Marker> m_scan_fieldset_legend;
94  std::vector<visualization_msgs::Marker> m_scan_outputstate_legend;
96 
97  }; /* class SickScanMarker */
98 
99 } /* namespace sick_scan */
100 #endif /* SICK_SCAN_MARKER_H_ */
msg
std::vector< visualization_msgs::Marker > createMonFieldsetLegend(int fieldset)
std::vector< visualization_msgs::Marker > m_scan_outputstate_legend
SickScanMarker(ros::NodeHandle *nh=0, const std::string &marker_topic="", const std::string &marker_frame_id="")
void updateMarker(const std::vector< SickScanMonField > &fields, int fieldset, int eval_field_logic)
std::vector< visualization_msgs::Marker > m_scan_mon_field_marker
std::vector< sick_scan::SickScanMonField > m_scan_mon_fields
FieldInfo(int idx=0, int result=0, const std::string &status="", const std::string &name="", const std_msgs::ColorRGBA &color=std_msgs::ColorRGBA())
std::vector< visualization_msgs::Marker > createMonFieldLegend(const std::vector< FieldInfo > &field_info)
static std_msgs::ColorRGBA color(float r, float g, float b, float a=0.5f)
std::vector< visualization_msgs::Marker > createMonFieldMarker(const std::vector< FieldInfo > &field_info)
std::vector< visualization_msgs::Marker > createOutputStateLegend(const std::vector< std::string > &output_state, const std::vector< std::string > &output_count, const std::vector< std_msgs::ColorRGBA > &output_colors)
std::vector< visualization_msgs::Marker > m_scan_mon_field_legend
std::vector< visualization_msgs::Marker > m_scan_fieldset_legend
ros::Publisher m_marker_publisher


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Wed May 5 2021 03:05:48