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

Help with writing a subscriber node for an existing publisher

asked 2012-01-23 17:26:29 -0500

wkr101 gravatar image

I have followed the tutorials for creating a publisher and subscriber with roscpp. I also have a MicroStrain 3DM-GX3-25 working using the microstrain_3dmgx2_imu package. Following the tutorial, I can view the output data in the terminal.

I'm trying to write a subscriber to this but I'm a bit confused on where to begin since I don't even know where the code for this publisher (imu/node) exists. I'm trying to write a C++ program that will subcribe to the data being published. If anyone can point me in the right direction on this I'd very much appreciate it. Ultimately, I'd like to pass the x,y, and z values as arguments into a separate program for positioning.

I'm using diamondback on both Maverick and Natty (separate computers) and I believe I installed the imu_drivers stack using precompiled binaries.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-01-23 19:13:59 -0500

dornhege gravatar image

updated 2012-01-24 00:13:09 -0500

joq gravatar image

This: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 covers it.

You don't need to know where the code for the publisher is. That's the beauty of it.

edit flag offensive delete link more

Comments

Maybe I'm looking at that tutorial wrong (which is what prompted the initial question) but in that case I did have knowledge of the publisher. For example, how do I know about "msg->data.c_str()" from the publisher if I didn't get it from the code itself. Is this something that is always used?
wkr101 gravatar image wkr101  ( 2012-01-24 14:37:30 -0500 )edit
Usually you look at the message definition, not at the source code of the publisher. After all whoever writes the publisher also needs the knowledge.
dornhege gravatar image dornhege  ( 2012-01-24 19:41:05 -0500 )edit

Question Tools

Stats

Asked: 2012-01-23 17:26:29 -0500

Seen: 643 times

Last updated: Jan 24 '12