6 #include "../core/log.h" 7 #include "../render/mesh.h" 10 if (_watcher.changed(color(), cellSize(), cellCount(), lineWidth())) {
11 LOG_DEBUG(
"update grid");
13 visualization_msgs::Marker marker;
15 marker.type = visualization_msgs::Marker::LINE_LIST;
16 marker.scale.x = lineWidth();
17 marker.color.r = color().r();
18 marker.color.g = color().g();
19 marker.color.b = color().b();
20 marker.color.a = color().a();
21 double q = cellSize() * cellCount() * 0.5;
22 for (
size_t i = 0; i < cellCount() + 1; i++) {
23 double p = (i - cellCount() * 0.5) * cellSize();
24 marker.points.emplace_back();
25 marker.points.back().x = p;
26 marker.points.back().y = -q;
27 marker.points.emplace_back();
28 marker.points.back().x = p;
29 marker.points.back().y = +q;
30 marker.points.emplace_back();
31 marker.points.back().x = -q;
32 marker.points.back().y = p;
33 marker.points.emplace_back();
34 marker.points.back().x = +q;
35 marker.points.back().y = p;
40 visualization_msgs::Marker marker;
42 marker.type = visualization_msgs::Marker::POINTS;
43 marker.scale.x = lineWidth();
44 marker.color.r = color().r();
45 marker.color.g = color().g();
46 marker.color.b = color().b();
47 marker.color.a = color().a();
48 double q = cellSize() * cellCount() * 0.5;
49 marker.points.emplace_back();
50 marker.points.back().x = +q;
51 marker.points.back().y = +q;
52 marker.points.emplace_back();
53 marker.points.back().x = -q;
54 marker.points.back().y = +q;
55 marker.points.emplace_back();
56 marker.points.back().x = -q;
57 marker.points.back().y = -q;
58 marker.points.emplace_back();
59 marker.points.back().x = +q;
60 marker.points.back().y = -q;
64 MarkerFrameDisplayBase::renderSync(context);