Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 171

displaying a point cloud in rviz

$
0
0
For experimentation's sake I am writing a node for a turtlebot that publishes data as if it were '/camera/depth/registered_points', a PointCloud2 message. I can not get rviz to show this data. I think I'm missing a basic understanding of frames. The rviz error is :> "Transform> [sender=/turtlebot_talktest_19193_1389894558845]> For frame [/map]: Fixed Frame> [caster_front_link] does not exist" Here is some of the code that creates the point cloud. I'm hoping in the end for some colored dots on the rviz screen. For brevity I have not included my 'import' section. def make_cloud() : rospy.init_node('turtlebot_talktest', anonymous=True) # pub_cloud = rospy.Publisher("camera/depth_registered/points", PointCloud2) pcloud = PointCloud2() c_height = 6 c_width = 6 # make point cloud fields = [PointField('x',0, PointField.INT16, 1)] cloud2 = [1,2,6,1,2,6, 1,2,6,1,2,6, 1,2,6,1,2,6, 1,2,6,1,2,6, 1,2,6,1,2,6, 1,2,6,1,2,6] cloud_struct = struct.Struct(pc2._get_struct_fmt(False, fields)) buff = ctypes.create_string_buffer(cloud_struct.size * len(cloud2)) point_step, pack_into = cloud_struct.size, cloud_struct.pack_into offset = 0 for p in cloud2: pack_into(buff, offset, p) offset += point_step pcloud.header = Header() pcloud.header.stamp = rospy.Time.now() pcloud.header.frame_id = '/map' pcloud2 = PointCloud2(header=pcloud.header, height=c_height, width=c_width, is_dense=False, is_bigendian=False, fields=fields, point_step=cloud_struct.size, row_step= len(cloud2) / c_height, data=buff.raw) pub_cloud.publish(pcloud2) return I thought by changing the 'frame_id' to '/map' I was on the right track. Is there a simple change that I can make so that rviz will display these points?

Viewing all articles
Browse latest Browse all 171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>