5 from geometry_msgs.msg
import Polygon, PolygonStamped, Point32
6 from std_msgs.msg
import Header
7 from math
import sin, cos, pi
12 p.polygon.points = [Point32(x=1.0, y=1.0),
13 Point32(x=-1.0, y=1.0),
14 Point32(x=-1.0, y=-1.0),
15 Point32(x=1.0, y=-1.0)]
21 p.polygon.points = [Point32(x=-1.0, y=1.0, z=1.0),
22 Point32(x=-2.0, y=1.0, z=1.0),
23 Point32(x=-2.0, y=-1.0, z=1.0),
24 Point32(x=-1.0, y=-1.0, z=1.0)]
30 theta = i / 100.0 * 2.0 * pi
31 x = 1.0 * cos(theta) + 3.0
33 p.polygon.points.append(Point32(x=x, y=y))
40 p.polygon.points = [Point32(x= .0000, y= 1.0000 + 3.0),
41 Point32(x= .2245, y= .3090 + 3.0),
42 Point32(x= .9511, y= .3090 + 3.0),
43 Point32(x= .3633, y= -.1180 + 3.0),
44 Point32(x= .5878, y= -.8090 + 3.0),
45 Point32(x= .0000, y= -.3820 + 3.0),
46 Point32(x= -.5878, y= -.8090 + 3.0),
47 Point32(x= -.3633, y= -.1180 + 3.0),
48 Point32(x= -.9511, y= .3090 + 3.0),
49 Point32(x= -.2245, y= .3090 + 3.0)]
52 if __name__ ==
"__main__":
53 rospy.init_node(
"polygon_array_sample")
54 pub = rospy.Publisher(
"~output", PolygonArray)
56 while not rospy.is_shutdown():
59 header.frame_id =
"world" 60 header.stamp = rospy.Time.now()
66 msg.labels = [0, 1, 2, 3]
67 msg.likelihood = [np.random.ranf(), np.random.ranf(), np.random.ranf(), np.random.ranf()]
def SquarePolygon(header)
def CirclePolygon(header)
def RectanglePolygon(header)