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_ */
sick_scan::SickScanMarker::createMonFieldMarker
std::vector< visualization_msgs::Marker > createMonFieldMarker(const std::vector< FieldInfo > &field_info)
Definition: sick_scan_marker.cpp:242
sick_scan::SickScanMarker::m_marker_publisher
ros::Publisher m_marker_publisher
Definition: sick_scan_marker.h:88
msg
msg
ros::Publisher
sick_scan::SickScanMarker::createOutputStateLegend
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)
Definition: sick_scan_marker.cpp:450
sick_scan::SickScanMarker::FieldInfo::field_index_scan_mon
int field_index_scan_mon
Definition: sick_scan_marker.h:74
sick_scan::SickScanMarker::FieldInfo::field_name
std::string field_name
Definition: sick_scan_marker.h:77
sick_scan::SickScanMarker
Definition: sick_scan_marker.h:53
ros.h
sick_scan::SickScanMarker::SickScanMarker
SickScanMarker(ros::NodeHandle *nh=0, const std::string &marker_topic="", const std::string &marker_frame_id="")
Definition: sick_scan_marker.cpp:79
sick_scan::SickScanMarker::FieldInfo::field_result
int field_result
Definition: sick_scan_marker.h:75
sick_scan::SickScanMarker::m_frame_id
std::string m_frame_id
Definition: sick_scan_marker.h:87
sick_scan::SickScanMarker::~SickScanMarker
virtual ~SickScanMarker()
Definition: sick_scan_marker.cpp:89
sick_scan::SickScanMarker::FieldInfo::FieldInfo
FieldInfo(int idx=0, int result=0, const std::string &status="", const std::string &name="", const std_msgs::ColorRGBA &color=std_msgs::ColorRGBA())
Definition: sick_scan_marker.h:72
sick_scan::SickScanMarker::FieldInfo::field_color
std_msgs::ColorRGBA field_color
Definition: sick_scan_marker.h:78
sick_scan::SickScanMarker::m_scan_mon_fields
std::vector< sick_scan::SickScanMonField > m_scan_mon_fields
Definition: sick_scan_marker.h:90
sick_scan::SickScanMarker::m_scan_mon_field_legend
std::vector< visualization_msgs::Marker > m_scan_mon_field_legend
Definition: sick_scan_marker.h:92
sick_scan::SickScanMarker::createMonFieldLegend
std::vector< visualization_msgs::Marker > createMonFieldLegend(const std::vector< FieldInfo > &field_info)
Definition: sick_scan_marker.cpp:372
sick_scan::SickScanMarker::m_scan_fieldset_legend
std::vector< visualization_msgs::Marker > m_scan_fieldset_legend
Definition: sick_scan_marker.h:93
color
static std_msgs::ColorRGBA color(float r, float g, float b, float a=0.5f)
Definition: sick_scan_marker.cpp:44
sick_scan
Definition: abstract_parser.cpp:50
sick_scan::SickScanMarker::m_scan_outputstate_legend
std::vector< visualization_msgs::Marker > m_scan_outputstate_legend
Definition: sick_scan_marker.h:94
sick_generic_field_mon.h
sick_scan::SickScanMarker::FieldInfo::field_status
std::string field_status
Definition: sick_scan_marker.h:76
sick_scan::SickScanMarker::m_scan_mon_fieldset
int m_scan_mon_fieldset
Definition: sick_scan_marker.h:89
sick_scan::SickScanMarker::publishMarker
void publishMarker(void)
Definition: sick_scan_marker.cpp:203
sick_scan::SickScanMarker::updateMarker
void updateMarker(const std::vector< SickScanMonField > &fields, int fieldset, int eval_field_logic)
Definition: sick_scan_marker.cpp:93
sick_scan::SickScanMarker::m_scan_mon_field_marker
std::vector< visualization_msgs::Marker > m_scan_mon_field_marker
Definition: sick_scan_marker.h:91
sick_scan::SickScanMarker::FieldInfo
Definition: sick_scan_marker.h:69
sick_scan::SickScanMarker::createMonFieldsetLegend
std::vector< visualization_msgs::Marker > createMonFieldsetLegend(int fieldset)
Definition: sick_scan_marker.cpp:414
ros::NodeHandle
sick_scan::SickScanMarker::m_marker_output_legend_offset_x
float m_marker_output_legend_offset_x
Definition: sick_scan_marker.h:95


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19