sample_point_publisher_from_pointcloud.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from geometry_msgs.msg import PointStamped
4 import rospy
5 from sensor_msgs.msg import PointCloud2
6 
7 
8 def cb(msg):
9  out_msg = PointStamped()
10  out_msg.header = msg.header
11  out_msg.point.x = pt_x
12  out_msg.point.y = pt_y
13  out_msg.point.z = pt_z
14  pub.publish(out_msg)
15 
16 
17 if __name__ == '__main__':
18  rospy.init_node('sample_point_publisher_from_pointcloud')
19  pt_x = rospy.get_param('~x', 0.0)
20  pt_y = rospy.get_param('~y', 0.0)
21  pt_z = rospy.get_param('~z', 0.0)
22  pub = rospy.Publisher('~output', PointStamped, queue_size=1)
23  sub = rospy.Subscriber('~input', PointCloud2, cb, queue_size=1)
24  rospy.spin()


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