0
$\begingroup$

Rosanswers logo

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.


Originally posted by wkr101 on ROS Answers with karma: 63 on 2012-01-23

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by dornhege with karma: 31395 on 2012-01-23

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by dornhege on 2012-01-24:
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.

Comment by wkr101 on 2012-01-24:
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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.