attention_pose_set.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import math
5 from geometry_msgs.msg import PoseStamped
6 from jsk_recognition_msgs.msg import BoundingBox, BoundingBoxArray
7 rospy.init_node("attention_pose_set")
8 pub = rospy.Publisher("/attention_clipper/input/box_array", BoundingBoxArray)
9 r = rospy.Rate(10)
10 theta = 0
11 while not rospy.is_shutdown():
12  boxes = BoundingBoxArray()
13  theta = math.fmod(theta + 0.1, math.pi * 2)
14  box = BoundingBox()
15  box.header.stamp = rospy.Time.now()
16  box.header.frame_id = "camera_link"
17  box.pose.orientation.w = 1
18  box.pose.position.x = 0.8 * math.cos(theta)
19  box.pose.position.y = 0.8 * math.sin(theta)
20  box.pose.position.z = 0.1
21  box.dimensions.x = 0.1
22  box.dimensions.y = 0.1
23  box.dimensions.z = 0.1
24  box2 = BoundingBox()
25  box2.header.stamp = rospy.Time.now()
26  box2.header.frame_id = "camera_link"
27  box2.pose.orientation.w = 1
28  box2.pose.position.x = 0.8 * math.cos(theta)
29  box2.pose.position.y = 0.8 * math.sin(theta)
30  box2.pose.position.z = -0.1
31  box2.dimensions.x = 0.1
32  box2.dimensions.y = 0.1
33  box2.dimensions.z = 0.1
34  boxes.boxes = [box, box2]
35  boxes.header.frame_id = "camera_link"
36  boxes.header.stamp = rospy.Time.now()
37  pub.publish(boxes)
38  r.sleep()


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:46