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";
void publish(const boost::shared_ptr< M > &message) const
const ColorRGBA24 & get(const NamedColor &name)
std_msgs::ColorRGBA toMsg(const color_util::ColorRGBA &rgba)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
nav_2d_msgs::Polygon2D makeStar(double base_angle, double outer=3.0, double inner=1.0, unsigned int N=5)
int main(int argc, char **argv)
static double from_degrees(double degrees)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
TFSIMD_FORCE_INLINE const tfScalar & w() const
geometry_msgs::Polygon polygon2Dto3D(const nav_2d_msgs::Polygon2D &polygon_2d)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
nav_2d_msgs::Polygon2D movePolygonToPose(const nav_2d_msgs::Polygon2D &polygon, const geometry_msgs::Pose2D &pose)
ROSCPP_DECL void spinOnce()
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)