vote_visualizer_rviz.cpp
Go to the documentation of this file.
1 
17 //Local include
20 
21 //ISM includes
22 #include <ISM/utility/GeometryHelper.hpp>
23 
24 namespace VIZ
25 {
26 void VoteVisualizerRVIZ::addVisualization(const std::map<ISM::ObjectPtr, std::vector<ISM::VoteSpecifierPtr>>& object_to_votes)
27 {
28  visualization_msgs::MarkerArray current_marker_array = generateVoteMarkers(object_to_votes);
29 
30  addMarker(current_marker_array);
32 }
33 
34 visualization_msgs::MarkerArray VoteVisualizerRVIZ::generateVoteMarkers(const std::map<ISM::ObjectPtr, std::vector<ISM::VoteSpecifierPtr>>& object_to_votes)
35 {
36  visualization_msgs::MarkerArray return_markers;
37 
38  int i = 0;
39  for (std::map<ISM::ObjectPtr, std::vector<ISM::VoteSpecifierPtr>>::const_iterator obj_to_votes_it = object_to_votes.begin(); obj_to_votes_it != object_to_votes.end(); ++obj_to_votes_it)
40  {
42  std::string name_space = prefix_ + obj_to_votes_it->first->type + "_" + obj_to_votes_it->first->observedId;
43  double hue_step = 360 / object_to_votes.size();
44  double hue_value = hue_step * i++;
45 
46  int id = 0;
47  for (const ISM::VoteSpecifierPtr& vote : obj_to_votes_it->second)
48  {
49  ISM::PointPtr dest = ISM::GeometryHelper::applyQuatAndRadiusToPose(obj_to_votes_it->first->pose, vote->objectToRefQuat, vote->radius);
50  marker = VizHelperRVIZ::createArrowMarkerToPoint(obj_to_votes_it->first->pose->point, dest, base_frame_, name_space + "_votes", id++, 0.0015, 0.003, 0.003, VizHelperRVIZ::hsvToRGBA(hue_value, 1.0, 1.0), 0, 0.003);
51  return_markers.markers.push_back(marker);
52  }
53  }
54 
55  return return_markers;
56 }
57 }
void addVisualization(const std::map< ISM::ObjectPtr, std::vector< ISM::VoteSpecifierPtr >> &object_to_votes)
static ColorRGBA hsvToRGBA(double hue, double saturation, double value)
visualization_msgs::Marker Marker
visualization_msgs::MarkerArray MarkerArray
static Marker createArrowMarkerToPoint(ISM::PointPtr fromPoint, ISM::PointPtr to, std::string baseFrame, std::string markerNamespace, int id, float xScale, float yScale, float zScale, ColorRGBA color, double markerLifetime)
void addMarker(visualization_msgs::Marker marker)
visualization_msgs::MarkerArray generateVoteMarkers(const std::map< ISM::ObjectPtr, std::vector< ISM::VoteSpecifierPtr >> &object_to_votes)


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