publish_clicked_point_bbox.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import tf
5 
6 from jsk_recognition_msgs.msg import *
7 from geometry_msgs.msg import *
8 
9 def clicked_point_cb(msg):
10  listener.waitForTransform('odom', msg.header.frame_id, msg.header.stamp, rospy.Duration(1.0))
11  p_conv = listener.transformPoint('odom', msg)
12  bbox_array = BoundingBoxArray()
13  bbox_array.header = p_conv.header
14  bbox = BoundingBox()
15  bbox.header = p_conv.header
16  bbox.pose = Pose(position=p_conv.point)
17  bbox.dimensions.x = 1
18  bbox.dimensions.y = 1
19  bbox.dimensions.z = 1
20  bbox_array.boxes.append(bbox)
21  bbox_pub.publish(bbox_array)
22 
23 rospy.init_node('clicked_bbox')
25 point_sub = rospy.Subscriber('clicked_point', PointStamped, clicked_point_cb)
26 bbox_pub = rospy.Publisher(
27  'bbox_with_clicked_point', BoundingBoxArray, queue_size=1)
28 rospy.spin()


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