ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

how to publish a topic from kinect in a node?

asked 2011-02-22 22:58:36 -0600

Monica gravatar image

updated 2016-10-24 08:59:03 -0600

ngrennan gravatar image

I want to publish 3 topics from pr2, one from kinect and one from point_cloud (kinect) in a single node and then save the data to disk

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2011-02-22 23:58:53 -0600

Chad Rockey gravatar image

Hi, you didn't leave very many details, so I'm going to do my best to parse your request one step at a time:

  • Publish 3 topics from pr2

Well, this one is the hardest. I'm not sure if you have an actual PR2 or you would like to run one in simulation. Please clarify, and I'll do my best to update this answer accordingly. For now, I'm going to assume you have your PR2 running and you can rostopic list/rostopic echo the 3 topics you'd like just fine.

  • One from kinect and one from point_cloud kinect

So when you run the openni_camera driver, it will publish the RGB image data from the kinect, as well as the depth data in PointCloud2. These should be published as /camera/rgb/image_color and /camera/depth/points2 respectively.

  • Then save the data to disk

Okay, so the final step to saving all of your topics to disk would be to use rosbag to record a bag of these 5 topics you'd like. The command line information for rosbag record will show you how to record your topics, but it should go something like this:

rosbag record /camera/rgb/image_color /camera/depth/points [YOUR PR2 TOPICS HERE]

This will record those 5 topics (and those 5 topics only, use rosbag record -a to record ALL topics currently published) to a .bag file in your current directory. Warning, since this has a camera recording, these bag files will easily reach multi-gig size if you leave it running. To playback this bagfile as topics later, just use rosbag play /home/monica/my_recorded_bag_directory/my_pr2_kinect_logs.bag. You may also want to check out rosbag compress if your bag file grows too large.

If I misinterpreted any of your requests please let me know; and please try to give a more detailed request in the future.

edit flag offensive delete link more

Comments

Probably want to add: you will want to run the rosbag command whereever the most data is being produced in order to minimize any network overhead. You may, in fact, want to run separate rosbag commands, each run on the computer where the data is being produced.
kwc gravatar image kwc  ( 2011-02-24 02:59:07 -0600 )edit

Question Tools

Stats

Asked: 2011-02-22 22:58:36 -0600

Seen: 1,403 times

Last updated: Feb 22 '11