37 #include <geometry_msgs/PolygonStamped.h>
38 #include <nav_2d_msgs/Polygon2DStamped.h>
39 #include <nav_2d_msgs/Polygon2DCollection.h>
46 nav_2d_msgs::Polygon2D
makeStar(
double base_angle,
double outer = 3.0,
double inner = 1.0,
unsigned int N = 5)
48 nav_2d_msgs::Polygon2D polygon;
49 polygon.points.resize(2 * N + 1);
51 double inc = M_PI / N;
52 for (
unsigned int i = 0 ; i < 2 * N; ++i)
54 double length = i % 2 ? outer : inner;
55 polygon.points[i].x =
length * cos(base_angle + i * inc);
56 polygon.points[i].y =
length * sin(base_angle + i * inc);
58 polygon.points[2 * N] = polygon.points[0];
64 int main(
int argc,
char** argv)
75 std::vector<color_util::ColorRGBA24> rainbow =
87 nav_2d_msgs::Polygon2DStamped polygon;
89 polygon.header.frame_id =
"map";
90 polygon.polygon.points.resize(11);
96 nav_2d_msgs::Polygon2DCollection polygons;
98 polygons.header.frame_id =
"map";
100 for (
unsigned int i = 0; i < rainbow.size(); ++i)
102 nav_2d_msgs::ComplexPolygon2D complex;
104 complex.outer =
makeStar(rad, 4.2 + w, 2.2 + w);
105 complex.inner.push_back(
makeStar(rad, 4.0 + w, 2.0 + w));
107 polygons.polygons.push_back(complex);
110 pub1.publish(polygons);
112 geometry_msgs::Pose2D pose;
113 pose.x = 5.0 * cos(rad);
114 pose.y = 5.0 * sin(rad);
116 nav_2d_msgs::Polygon2DStamped small_star;
118 small_star.header.frame_id =
"map";