8 rospy.init_node(
"bbox_sample")
9 pub = rospy.Publisher(
"bbox", BoundingBoxArray)
12 while not rospy.is_shutdown():
19 box_arr = BoundingBoxArray()
20 now = rospy.Time.now()
21 box_a.header.stamp = now
22 box_b.header.stamp = now
23 box_c.header.stamp = now
24 box_arr.header.stamp = now
25 box_a.header.frame_id =
"map"
26 box_b.header.frame_id =
"map"
27 box_c.header.frame_id =
"map"
28 box_arr.header.frame_id =
"map"
29 q = quaternion_about_axis((counter % 100) * math.pi * 2 / 100.0, [0, 0, 1])
30 box_a.pose.orientation.x = q[0]
31 box_a.pose.orientation.y = q[1]
32 box_a.pose.orientation.z = q[2]
33 box_a.pose.orientation.w = q[3]
34 box_b.pose.orientation.w = 1
35 box_b.pose.position.y = 2
36 box_c.pose.position.y = 1
37 box_c.pose.position.z = -0.52
38 box_b.dimensions.x = (counter % 10 + 1) * 0.1
39 box_b.dimensions.y = ((counter + 1) % 10 + 1) * 0.1
40 box_b.dimensions.z = ((counter + 2) % 10 + 1) * 0.1
41 box_a.dimensions.x = 1
42 box_a.dimensions.y = 1
43 box_a.dimensions.z = 1
44 box_c.dimensions.x = 3
45 box_c.dimensions.y = 3
46 box_c.dimensions.z = 0.02
47 box_a.value = (counter % 100) / 100.0
48 box_b.value = 1 - (counter % 100) / 100.0
49 box_c.value = (counter % 300) / 100.0
50 box_arr.boxes.append(box_a)
51 box_arr.boxes.append(box_b)
52 box_arr.boxes.append(box_c)