37 vector<visualization_msgs::Marker>
createTargetMarkers( vector<ClusterPtr>& clusters , vector<ClusterPtr>& clusters_Premebida , vector<ClusterPtr>& clusters_Dietmayer, vector<ClusterPtr>& clusters_Santos, vector<ClusterPtr>& clusters_ABD ,vector<ClusterPtr>& clusters_nn , vector<ClusterPtr>& clusters_GT )
46 class_colormap colormap(
"hsv",10, 1,
false);
48 visualization_msgs::Marker marker_ids;
49 visualization_msgs::Marker marker_ids_prem;
50 visualization_msgs::Marker marker_ids_diet;
51 visualization_msgs::Marker marker_ids_santos;
52 visualization_msgs::Marker marker_ids_abd;
53 visualization_msgs::Marker marker_ids_nn;
54 visualization_msgs::Marker marker_ids_gt;
56 visualization_msgs::Marker marker_clusters;
57 visualization_msgs::Marker marker_clusters_prem;
58 visualization_msgs::Marker marker_clusters_diet;
59 visualization_msgs::Marker marker_clusters_santos;
60 visualization_msgs::Marker marker_clusters_abd;
61 visualization_msgs::Marker marker_clusters_nn;
62 visualization_msgs::Marker marker_clusters_gt;
64 marker_ids.header.frame_id =
"/my_frame";
65 marker_ids.header.stamp = ros::Time::now();
66 marker_ids_prem.header.frame_id =
"/my_frame";
67 marker_ids_prem.header.stamp = ros::Time::now();
68 marker_ids_diet.header.frame_id =
"/my_frame";
69 marker_ids_diet.header.stamp = ros::Time::now();
70 marker_ids_santos.header.frame_id =
"/my_frame";
71 marker_ids_santos.header.stamp = ros::Time::now();
72 marker_ids_abd.header.frame_id =
"/my_frame";
73 marker_ids_abd.header.stamp = ros::Time::now();
74 marker_ids_nn.header.frame_id =
"/my_frame";
75 marker_ids_nn.header.stamp = ros::Time::now();
76 marker_ids_gt.header.frame_id =
"/my_frame";
77 marker_ids_gt.header.stamp = ros::Time::now();
79 marker_clusters.header.frame_id =
"/my_frame";
80 marker_clusters.header.stamp = marker_ids.header.stamp;
81 marker_clusters_prem.header.frame_id =
"/my_frame";
82 marker_clusters_prem.header.stamp = marker_ids_prem.header.stamp;
83 marker_clusters_diet.header.frame_id =
"/my_frame";
84 marker_clusters_diet.header.stamp = marker_ids_diet.header.stamp;
85 marker_clusters_santos.header.frame_id =
"/my_frame";
86 marker_clusters_santos.header.stamp = marker_ids_santos.header.stamp;
87 marker_clusters_abd.header.frame_id =
"/my_frame";
88 marker_clusters_abd.header.stamp = marker_ids_abd.header.stamp;
89 marker_clusters_nn.header.frame_id =
"/my_frame";
90 marker_clusters_nn.header.stamp = marker_ids_nn.header.stamp;
91 marker_clusters_gt.header.frame_id =
"/my_frame";
92 marker_clusters_gt.header.stamp = marker_ids_gt.header.stamp;
94 marker_ids.ns =
"ids";
95 marker_ids.action = visualization_msgs::Marker::ADD;
96 marker_ids_prem.ns =
"ids_prem";
97 marker_ids_prem.action = visualization_msgs::Marker::ADD;
98 marker_ids_diet.ns =
"ids_diet";
99 marker_ids_diet.action = visualization_msgs::Marker::ADD;
100 marker_ids_santos.ns =
"ids_santos";
101 marker_ids_santos.action = visualization_msgs::Marker::ADD;
102 marker_ids_abd.ns =
"ids_abd";
103 marker_ids_abd.action = visualization_msgs::Marker::ADD;
104 marker_ids_nn.ns =
"ids_nn";
105 marker_ids_nn.action = visualization_msgs::Marker::ADD;
106 marker_ids_gt.ns =
"ids_gt";
107 marker_ids_gt.action = visualization_msgs::Marker::ADD;
109 marker_clusters.ns =
"clusters";
110 marker_clusters.action = visualization_msgs::Marker::ADD;
111 marker_clusters_prem.ns =
"clusters_prem";
112 marker_clusters_prem.action = visualization_msgs::Marker::ADD;
113 marker_clusters_diet.ns =
"clusters_diet";
114 marker_clusters_diet.action = visualization_msgs::Marker::ADD;
115 marker_clusters_santos.ns =
"clusters_santos";
116 marker_clusters_santos.action = visualization_msgs::Marker::ADD;
117 marker_clusters_abd.ns =
"clusters_abd";
118 marker_clusters_abd.action = visualization_msgs::Marker::ADD;
119 marker_clusters_nn.ns =
"clusters_nn";
120 marker_clusters_nn.action = visualization_msgs::Marker::ADD;
121 marker_clusters_gt.ns =
"clusters_gt";
122 marker_clusters_gt.action = visualization_msgs::Marker::ADD;
124 marker_ids.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
125 marker_ids_prem.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
126 marker_ids_diet.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
127 marker_ids_santos.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
128 marker_ids_abd.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
129 marker_ids_nn.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
130 marker_ids_gt.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
132 marker_clusters.type = visualization_msgs::Marker::SPHERE_LIST;
133 marker_clusters_prem.type = visualization_msgs::Marker::SPHERE_LIST;
134 marker_clusters_diet.type = visualization_msgs::Marker::SPHERE_LIST;
135 marker_clusters_santos.type = visualization_msgs::Marker::SPHERE_LIST;
136 marker_clusters_abd.type = visualization_msgs::Marker::SPHERE_LIST;
137 marker_clusters_nn.type = visualization_msgs::Marker::SPHERE_LIST;
138 marker_clusters_gt.type = visualization_msgs::Marker::SPHERE_LIST;
140 marker_ids.scale.x = 0.5;
141 marker_ids.scale.y = 0.5;
142 marker_ids.scale.z = 0.5;
143 marker_ids_prem.scale.x = 0.5;
144 marker_ids_prem.scale.y = 0.5;
145 marker_ids_prem.scale.z = 0.5;
146 marker_ids_diet.scale.x = 0.5;
147 marker_ids_diet.scale.y = 0.5;
148 marker_ids_diet.scale.z = 0.5;
149 marker_ids_santos.scale.x = 0.5;
150 marker_ids_santos.scale.y = 0.5;
151 marker_ids_santos.scale.z = 0.5;
152 marker_ids_abd.scale.x = 0.5;
153 marker_ids_abd.scale.y = 0.5;
154 marker_ids_abd.scale.z = 0.5;
155 marker_ids_nn.scale.x = 0.5;
156 marker_ids_nn.scale.y = 0.5;
157 marker_ids_nn.scale.z = 0.5;
158 marker_ids_gt.scale.x = 0.5;
159 marker_ids_gt.scale.y = 0.5;
160 marker_ids_gt.scale.z = 0.5;
162 marker_clusters.scale.x = 0.2;
163 marker_clusters.scale.y = 0.2;
164 marker_clusters.scale.z = 0.2;
165 marker_clusters_prem.scale.x = 0.2;
166 marker_clusters_prem.scale.y = 0.2;
167 marker_clusters_prem.scale.z = 0.2;
168 marker_clusters_diet.scale.x = 0.2;
169 marker_clusters_diet.scale.y = 0.2;
170 marker_clusters_diet.scale.z = 0.2;
171 marker_clusters_santos.scale.x = 0.2;
172 marker_clusters_santos.scale.y = 0.2;
173 marker_clusters_santos.scale.z = 0.2;
174 marker_clusters_abd.scale.x = 0.2;
175 marker_clusters_abd.scale.y = 0.2;
176 marker_clusters_abd.scale.z = 0.2;
177 marker_clusters_nn.scale.x = 0.2;
178 marker_clusters_nn.scale.y = 0.2;
179 marker_clusters_nn.scale.z = 0.2;
180 marker_clusters_gt.scale.x = 0.2;
181 marker_clusters_gt.scale.y = 0.2;
182 marker_clusters_gt.scale.z = 0.2;
184 marker_ids.color.a = 1.0;
185 marker_ids.color.r = 0.0;
186 marker_ids.color.g = 0.0;
187 marker_ids.color.b = 0.0;
188 marker_ids_prem.color.a = 1.0;
189 marker_ids_prem.color.r = 0.0;
190 marker_ids_prem.color.g = 0.0;
191 marker_ids_prem.color.b = 0.0;
192 marker_ids_diet.color.a = 1.0;
193 marker_ids_diet.color.r = 0.0;
194 marker_ids_diet.color.g = 0.0;
195 marker_ids_diet.color.b = 0.0;
196 marker_ids_santos.color.a = 1.0;
197 marker_ids_santos.color.r = 0.0;
198 marker_ids_santos.color.g = 0.0;
199 marker_ids_santos.color.b = 0.0;
200 marker_ids_abd.color.a = 1.0;
201 marker_ids_abd.color.r = 0.0;
202 marker_ids_abd.color.g = 0.0;
203 marker_ids_abd.color.b = 0.0;
204 marker_ids_nn.color.a = 1.0;
205 marker_ids_nn.color.r = 0.0;
206 marker_ids_nn.color.g = 0.0;
207 marker_ids_nn.color.b = 0.0;
208 marker_ids_gt.color.a = 1.0;
209 marker_ids_gt.color.r = 0.0;
210 marker_ids_gt.color.g = 0.0;
211 marker_ids_gt.color.b = 0.0;
214 for ( uint i = 0 ; i< clusters.size() ; i++)
218 std_msgs::ColorRGBA color = colormap.color(i);
221 for(uint h=0;h<cluster->support_points.size();h++)
223 geometry_msgs::Point pt;
224 pt.x=cluster->support_points[h]->x;
225 pt.y=cluster->support_points[h]->y;
228 marker_clusters.points.push_back(pt);
229 marker_clusters.colors.push_back(color);
232 marker_ids.pose.position.x = cluster->centroid->x;
233 marker_ids.pose.position.y = cluster->centroid->y;
234 marker_ids.pose.position.z = 0.3;
237 boost::format fm(
"%d");
240 marker_ids.text = fm.str();
241 marker_ids.id = cluster->id;
242 marker_list.
update(marker_ids);
244 marker_list.
update(marker_clusters);
249 for ( uint i = 0; i< clusters_Premebida.size() ; i++)
252 ClusterPtr cluster_prem = clusters_Premebida[i];
254 std_msgs::ColorRGBA color = colormap.color(i);
257 for(uint h=0;h<cluster_prem->support_points.size();h++)
259 geometry_msgs::Point pt;
260 pt.x=cluster_prem->support_points[h]->x;
261 pt.y=cluster_prem->support_points[h]->y;
264 marker_clusters_prem.points.push_back(pt);
265 marker_clusters_prem.colors.push_back(color);
268 marker_ids_prem.pose.position.x = cluster_prem->centroid->x;
269 marker_ids_prem.pose.position.y = cluster_prem->centroid->y;
270 marker_ids_prem.pose.position.z = 1.3;
273 boost::format fm(
"%d");
274 fm % cluster_prem->id;
276 marker_ids_prem.text = fm.str();
277 marker_ids_prem.id = cluster_prem->id;
279 marker_list.
update(marker_ids_prem);
280 marker_list.
update(marker_clusters_prem);
284 for ( uint i = 0; i< clusters_Dietmayer.size() ; i++)
286 ClusterPtr cluster_diet = clusters_Dietmayer[i];
288 std_msgs::ColorRGBA color = colormap.color(i);
291 for(uint h=0;h<cluster_diet->support_points.size();h++)
293 geometry_msgs::Point pt;
294 pt.x=cluster_diet->support_points[h]->x;
295 pt.y=cluster_diet->support_points[h]->y;
298 marker_clusters_diet.points.push_back(pt);
299 marker_clusters_diet.colors.push_back(color);
302 marker_ids_diet.pose.position.x = cluster_diet->centroid->x;
303 marker_ids_diet.pose.position.y = cluster_diet->centroid->y;
304 marker_ids_diet.pose.position.z = 2.3;
307 boost::format fm(
"%d");
308 fm % cluster_diet->id;
310 marker_ids_diet.text = fm.str();
311 marker_ids_diet.id = cluster_diet->id;
313 marker_list.
update(marker_ids_diet);
314 marker_list.
update(marker_clusters_diet);
318 for ( uint i = 0; i< clusters_Santos.size() ; i++)
320 ClusterPtr cluster_santos = clusters_Santos[i];
322 std_msgs::ColorRGBA color = colormap.color(i);
325 for(uint h=0;h<cluster_santos->support_points.size();h++)
327 geometry_msgs::Point pt;
328 pt.x=cluster_santos->support_points[h]->x;
329 pt.y=cluster_santos->support_points[h]->y;
332 marker_clusters_santos.points.push_back(pt);
333 marker_clusters_santos.colors.push_back(color);
336 marker_ids_santos.pose.position.x = cluster_santos->centroid->x;
337 marker_ids_santos.pose.position.y = cluster_santos->centroid->y;
338 marker_ids_santos.pose.position.z = 3.3;
341 boost::format fm(
"%d");
342 fm % cluster_santos->id;
344 marker_ids_santos.text = fm.str();
345 marker_ids_santos.id = cluster_santos->id;
347 marker_list.
update(marker_ids_santos);
348 marker_list.
update(marker_clusters_santos);
352 for ( uint i = 0; i< clusters_ABD.size() ; i++)
356 std_msgs::ColorRGBA color = colormap.color(i);
359 for(uint h=0;h<cluster_abd->support_points.size();h++)
361 geometry_msgs::Point pt;
362 pt.x=cluster_abd->support_points[h]->x;
363 pt.y=cluster_abd->support_points[h]->y;
366 marker_clusters_abd.points.push_back(pt);
367 marker_clusters_abd.colors.push_back(color);
370 marker_ids_abd.pose.position.x = cluster_abd->centroid->x;
371 marker_ids_abd.pose.position.y = cluster_abd->centroid->y;
372 marker_ids_abd.pose.position.z = 4.3;
375 boost::format fm(
"%d");
376 fm % cluster_abd->id;
378 marker_ids_abd.text = fm.str();
379 marker_ids_abd.id = cluster_abd->id;
381 marker_list.
update(marker_ids_abd);
382 marker_list.
update(marker_clusters_abd);
386 for ( uint i = 0; i< clusters_nn.size() ; i++)
390 std_msgs::ColorRGBA color = colormap.color(i);
393 for(uint h=0;h<cluster_nn->support_points.size();h++)
395 geometry_msgs::Point pt;
396 pt.x=cluster_nn->support_points[h]->x;
397 pt.y=cluster_nn->support_points[h]->y;
400 marker_clusters_nn.points.push_back(pt);
401 marker_clusters_nn.colors.push_back(color);
404 marker_ids_nn.pose.position.x = cluster_nn->centroid->x;
405 marker_ids_nn.pose.position.y = cluster_nn->centroid->y;
406 marker_ids_nn.pose.position.z = 5.3;
409 boost::format fm(
"%d");
412 marker_ids_nn.text = fm.str();
413 marker_ids_nn.id = cluster_nn->id;
415 marker_list.
update(marker_ids_nn);
416 marker_list.
update(marker_clusters_nn);
420 for ( uint i = 0; i< clusters_GT.size() ; i++)
424 std_msgs::ColorRGBA color = colormap.color(i);
427 for(uint h=0;h<cluster_gt->support_points.size();h++)
429 geometry_msgs::Point pt;
430 pt.x=cluster_gt->support_points[h]->x;
431 pt.y=cluster_gt->support_points[h]->y;
434 marker_clusters_gt.points.push_back(pt);
435 marker_clusters_gt.colors.push_back(color);
438 marker_ids_gt.pose.position.x = cluster_gt->centroid->x;
439 marker_ids_gt.pose.position.y = cluster_gt->centroid->y;
440 marker_ids_gt.pose.position.z = 6.3;
443 boost::format fm(
"%d");
446 marker_ids_gt.text = fm.str();
447 marker_ids_gt.id = cluster_gt->id;
449 marker_list.
update(marker_ids_gt);
450 marker_list.
update(marker_clusters_gt);
void update(visualization_msgs::Marker &marker)
Clustering related functions header.
boost::shared_ptr< Cluster > ClusterPtr
vector< visualization_msgs::Marker > createTargetMarkers(vector< ClusterPtr > &clusters, vector< ClusterPtr > &clusters_Premebida, vector< ClusterPtr > &clusters_Dietmayer, vector< ClusterPtr > &clusters_Santos, vector< ClusterPtr > &clusters_ABD, vector< ClusterPtr > &clusters_nn, vector< ClusterPtr > &clusters_GT)
Create marker form clusters This function creates a set of markers for the current clusters from the ...
vector< visualization_msgs::Marker > getOutgoingMarkers(void)
Visualization on rviz related functions header.