ism_voting_visualizer_rviz.hpp
Go to the documentation of this file.
1 
17 #pragma once
18 //Ilcas includes
21 #include <ISM/common_type/RecognitionResult.hpp>
22 #include <ISM/typedef.hpp>
23 
24 //ROS includes
25 #include <ros/ros.h>
26 #include <dynamic_reconfigure/server.h>
27 #include <asr_ism_visualizations/ism_voting_visualizerConfig.h>
28 
29 namespace VIZ
30 {
32 {
33 public:
34  ISMVotingVisualizerRVIZ(const ros::Publisher& publisher, double bin_size, const ros::NodeHandle& nh)
35  : VisualizerRVIZ(publisher), bin_size_(bin_size)
36  {
37  reconfigure_server_ = new dynamic_reconfigure::Server<asr_ism_visualizations::ism_voting_visualizerConfig>(nh);
38  dynamic_reconfigure::Server<asr_ism_visualizations::ism_voting_visualizerConfig>::CallbackType reconf_callback = boost::bind(&ISMVotingVisualizerRVIZ::dynamicReconfCallback, this, _1, _2);
39  reconfigure_server_->setCallback(reconf_callback);
40  }
41 
43  }
44 
45  void releaseCallback() {
46  reconfigure_server_->clearCallback();
47  delete reconfigure_server_;
48 
49  }
50 
51  void dynamicReconfCallback(asr_ism_visualizations::ism_voting_visualizerConfig &config, uint32_t level) {
52  ROS_DEBUG_STREAM("Voting vizualizer dyn-params updated.");
53 
54  line_scale_ = config.lineScale;
55  marker_lifetime_ = config.markerLifetime;
56  base_frame_ = config.baseFrame;
57  axis_scale_ = config.axisScale;
58  grid_scale_ = config.gridScale;
59  object_marker_scale_ = config.objectMarkerScale;
60  bin_opacity_ = config.binOpacity;
61  grid_opacity_ = config.gridOpacity;
62  vote_opacity_ = config.voteOpacity;
63  object_marker_opacity_ = config.objectMarkerOpacity;
64  confidence_sphere_opacity_ = config.confidenceSphereOpacity;
65  pattern_name_ = config.patternname;
66  scene_name_ = config.scenename;
67  bin_scale_ = config.binScale;
68  }
69 
70 
74  void addVisualization(const ISM::PatternNameAndVotingSpaceTuple& voting_space, std::vector<ISM::RecognitionResultPtr> results);
75 
77  std::string getPatternName(){
78  return pattern_name_;
79  }
80 
81 private:
82 
86  visualization_msgs::Marker generateGridMarker(std::tuple<int, int, int, int, int, int> grid_bb);
87 
90  visualization_msgs::MarkerArray generateBinAndGridMarker(ISM::VotingSpacePtr voting_space_ptr);
91 
94  visualization_msgs::MarkerArray generateVoteMarker(std::map<ISM::ObjectPtr, std::vector<ISM::PosePtr>> voter_to_poses_map);
95 
99  visualization_msgs::MarkerArray generateRefMarker(ISM::RecognitionResultPtr result, std::vector<ISM::PosePtr> voted_poses);
100 
104  std::map<ISM::ObjectPtr, std::vector<ISM::PosePtr>> getSortedVotedPoses(ISM::VotingSpacePtr voting_space_ptr);
105  ISM::RecognitionResultPtr getRecognitionResultPtrOfPattern(ISM::RecognitionResultPtr result);
106  visualization_msgs::Marker generateResultVoteOverlay(ISM::RecognitionResultPtr result);
107 
108  std::string base_frame_;
110 
111  std::string pattern_name_;
112  std::string scene_name_;
113  double bin_size_;
114 
115  double bin_scale_;
116  double grid_scale_;
117  double axis_scale_;
118  double line_scale_;
120  double bin_opacity_;
125 
126  dynamic_reconfigure::Server<asr_ism_visualizations::ism_voting_visualizerConfig>* reconfigure_server_;
127 
128 };
130 
131 }
visualization_msgs::Marker Marker
visualization_msgs::Marker generateGridMarker(std::tuple< int, int, int, int, int, int > grid_bb)
ISMVotingVisualizerRVIZ(const ros::Publisher &publisher, double bin_size, const ros::NodeHandle &nh)
visualization_msgs::Marker generateResultVoteOverlay(ISM::RecognitionResultPtr result)
std::map< ISM::ObjectPtr, std::vector< ISM::PosePtr > > getSortedVotedPoses(ISM::VotingSpacePtr voting_space_ptr)
ISM::RecognitionResultPtr getRecognitionResultPtrOfPattern(ISM::RecognitionResultPtr result)
dynamic_reconfigure::Server< asr_ism_visualizations::ism_voting_visualizerConfig > * reconfigure_server_
#define ROS_DEBUG_STREAM(args)
visualization_msgs::MarkerArray generateVoteMarker(std::map< ISM::ObjectPtr, std::vector< ISM::PosePtr >> voter_to_poses_map)
visualization_msgs::MarkerArray MarkerArray
visualization_msgs::MarkerArray generateRefMarker(ISM::RecognitionResultPtr result, std::vector< ISM::PosePtr > voted_poses)
void addVisualization(const ISM::PatternNameAndVotingSpaceTuple &voting_space, std::vector< ISM::RecognitionResultPtr > results)
visualization_msgs::MarkerArray generateBinAndGridMarker(ISM::VotingSpacePtr voting_space_ptr)
boost::shared_ptr< ISMVotingVisualizerRVIZ > ISMVotingVisualizerRVIZPtr
void dynamicReconfCallback(asr_ism_visualizations::ism_voting_visualizerConfig &config, uint32_t level)
std::string getPatternName()
returns Name of pattern for visualization


asr_ism_visualizations
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Meißner Pascal, Reckling Reno, Stöckle Patrick, Trautmann Jeremias
autogenerated on Fri Nov 8 2019 03:28:47