6 from costmap_converter.msg
import ObstacleArrayMsg, ObstacleMsg
7 from geometry_msgs.msg
import PolygonStamped, Point32
11 pub = rospy.Publisher(
'/test_optim_node/obstacles', ObstacleArrayMsg, queue_size=1)
13 rospy.init_node(
"test_obstacle_msg")
16 obstacle_msg = ObstacleArrayMsg()
17 obstacle_msg.header.stamp = rospy.Time.now()
18 obstacle_msg.header.frame_id =
"odom" 21 obstacle_msg.obstacles.append(ObstacleMsg())
22 obstacle_msg.obstacles[0].id = 0
23 obstacle_msg.obstacles[0].polygon.points = [Point32()]
24 obstacle_msg.obstacles[0].polygon.points[0].x = 1.5
25 obstacle_msg.obstacles[0].polygon.points[0].y = 0
26 obstacle_msg.obstacles[0].polygon.points[0].z = 0
30 obstacle_msg.obstacles.append(ObstacleMsg())
31 obstacle_msg.obstacles[1].id = 1
32 line_start = Point32()
40 obstacle_msg.obstacles[1].polygon.points = [line_start, line_end]
43 obstacle_msg.obstacles.append(ObstacleMsg())
44 obstacle_msg.obstacles[1].id = 2
54 obstacle_msg.obstacles[2].polygon.points = [v1, v2, v3]
59 while not rospy.is_shutdown():
62 obstacle_msg.obstacles[0].polygon.points[0].y = 1*math.sin(t)
65 pub.publish(obstacle_msg)
71 if __name__ ==
'__main__':
74 except rospy.ROSInterruptException:
def publish_obstacle_msg()