ism_result_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_result_visualizerConfig.h>
28 
29 namespace VIZ
30 {
32 {
33 
34 public:
35  ISMResultVisualizerRVIZ(const ros::Publisher& publisher, const ros::NodeHandle& nh) : VisualizerRVIZ(publisher) {
36  reconfigure_server_ = new dynamic_reconfigure::Server<asr_ism_visualizations::ism_result_visualizerConfig>(nh);
37  dynamic_reconfigure::Server<asr_ism_visualizations::ism_result_visualizerConfig>::CallbackType reconf_callback = boost::bind(&ISMResultVisualizerRVIZ::dynamicReconfCallback, this, _1, _2);
38  reconfigure_server_->setCallback(reconf_callback);
39  }
40 
42  reconfigure_server_->clearCallback();
43  delete reconfigure_server_;
44  }
45 
46 
47  void dynamicReconfCallback(asr_ism_visualizations::ism_result_visualizerConfig &config, uint32_t level) {
48  ROS_DEBUG_STREAM("Result vizualizer dyn-params updated.");
49 
50  line_scale_ = config.lineScale;
51  tree_depth_size_ = config.treeDepthSize;
52  ism_marker_scale_ = config.ismMarkerScale;
53  is_pose_relative_ = config.isPoseRelative;
54  ignore_z_offset_ = config.ignoreZOffset;
55  use_scene_coloring_ = config.useSceneColoring;
56  use_z_max_ = config.ignoreZOffset;
57  marker_lifetime_ = config.markerLifetime;
58  base_frame_ = config.baseFrame;
59  }
60 
61  void setSceneCount(int scene_count){
62  scene_count_ = scene_count;
63  scene_iterator_ = 0;
64 
65  ism_to_color_map_.clear();
66  cylinder_map_.clear();
67  }
68 
69  void addVisualization(const ISM::RecognitionResultPtr recognition_result);
70 
71 private:
73 
74  std::vector<ISM::RecognitionResultPtr> traverseTree(ISM::RecognitionResultPtr result, int depth);
75 
76  visualization_msgs::MarkerArray getMarkersFromResult(const ISM::RecognitionResultPtr result);
77 
79  ISM::PosePtr getAdjustedPose(ISM::PosePtr pose, int depth, bool is_child);
80  ISM::QuaternionPtr calculateOrientation(ISM::PointPtr from_point_ptr, ISM::PointPtr to_point_ptr, bool pose_relative = false);
81  ISM::PosePtr calculateCylinderPose(const ISM::PosePtr from_pose_ptr, const ISM::PointPtr to_point_ptr, double height);
82 
86  double line_scale_;
88  std::string base_frame_;
90 
91  std::map<std::string, int> ism_to_depth_map_;
92  std::map<std::string, ISM::PosePtr> ism_to_parent_ism_map_;
93  std::map<std::string, VIZ::ColorRGBA> ism_to_color_map_;
94  std::map<std::string, std::pair<ISM::PosePtr, double>> cylinder_map_;
95 
96  double z_offset_;
97  bool use_z_max_;
101 
102  ISM::PosePtr ref_pose_;
103  ISM::PointPtr last_ref_pose_;
104 
105  dynamic_reconfigure::Server<asr_ism_visualizations::ism_result_visualizerConfig>* reconfigure_server_;
106 
107 };
109 }
110 
111 
112 
void addVisualization(const ISM::RecognitionResultPtr recognition_result)
visualization_msgs::MarkerArray genTestMarker()
std::map< std::string, ISM::PosePtr > ism_to_parent_ism_map_
std::vector< ISM::RecognitionResultPtr > traverseTree(ISM::RecognitionResultPtr result, int depth)
boost::shared_ptr< ISMResultVisualizerRVIZ > ISMResultVisualizerRVIZPtr
ISMResultVisualizerRVIZ(const ros::Publisher &publisher, const ros::NodeHandle &nh)
#define ROS_DEBUG_STREAM(args)
visualization_msgs::MarkerArray MarkerArray
ISM::PosePtr getAdjustedPose(ISM::PosePtr pose, int depth, bool is_child)
Helper method to translate a point. So we can see the tree depth objects residing in trough their cor...
dynamic_reconfigure::Server< asr_ism_visualizations::ism_result_visualizerConfig > * reconfigure_server_
ISM::QuaternionPtr calculateOrientation(ISM::PointPtr from_point_ptr, ISM::PointPtr to_point_ptr, bool pose_relative=false)
std::map< std::string, int > ism_to_depth_map_
std::map< std::string, VIZ::ColorRGBA > ism_to_color_map_
visualization_msgs::MarkerArray getMarkersFromResult(const ISM::RecognitionResultPtr result)
std::map< std::string, std::pair< ISM::PosePtr, double > > cylinder_map_
void dynamicReconfCallback(asr_ism_visualizations::ism_result_visualizerConfig &config, uint32_t level)
ISM::PosePtr calculateCylinderPose(const ISM::PosePtr from_pose_ptr, const ISM::PointPtr to_point_ptr, double height)


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