4 from roslib
import message
6 from std_msgs.msg
import String
7 from std_msgs.msg
import Header
8 from geometry_msgs.msg
import Point
9 from sensor_msgs.msg
import PointCloud2, PointField
10 import geometry_msgs.msg
19 return PyKDL.Frame(PyKDL.Rotation.Quaternion(t.transform.rotation.x, t.transform.rotation.y,
20 t.transform.rotation.z, t.transform.rotation.w),
21 PyKDL.Vector(t.transform.translation.x,
22 t.transform.translation.y,
23 t.transform.translation.z))
27 res = pc2.create_cloud(cloud.header, cloud.fields, pc2.read_points(cloud))
29 for p_in, p_out
in [ pc2.read_points(cloud), pc2.read_points(res) ]:
30 p = t_kdl * PyKDL.Vector(p_in.x, p_in.y, p_in.z)
34 res.header = transform.header
36 tf2_ros.TransformRegistration().add(PointCloud2, do_transform_cloud)
39 publisher = rospy.Publisher(
'/feat_tracker/state', PointCloud2, queue_size=10)
40 rospy.init_node(
'talker', anonymous=
True)
42 fake_tracked_feats = PointCloud2()
46 cloud = [[1,2,3],[4,5,6],[7,8,9]]
48 fake_tracked_feats = pc2.create_cloud_xyz32(fake_tracked_feats.header, cloud)
50 fake_tracked_feats.header.frame_id =
'camera_rgb_optical_frame' 52 publisher.publish(fake_tracked_feats)
55 transform = geometry_msgs.msg.TransformStamped()
56 transform.transform.translation.x = 0.1
57 transform.transform.translation.y = 0.05
58 transform.transform.translation.z = 0.1
59 q = tf.transformations.quaternion_from_euler(0, 0, math.pi/2)
60 transform.transform.rotation.x = q[0]
61 transform.transform.rotation.y = q[1]
62 transform.transform.rotation.z = q[2]
63 transform.transform.rotation.w = q[3]
65 while not rospy.is_shutdown():
67 fake_tracked_feats.header.stamp = rospy.Time.now()
68 publisher.publish(fake_tracked_feats)
71 if __name__ ==
'__main__':
74 except rospy.ROSInterruptException:
def FeatureTrackerMockup()
def do_transform_cloud(cloud, transform)