Ask Your Question
0

Check on a rostopic programatically?

asked 2014-09-17 15:32:06 -0500

an gravatar image

updated 2014-09-17 15:32:21 -0500

I've tried searching for this but have been unsuccessful so far.

Is it possible to see a topic's value, programatically? Basically, I need the functionality of rostopic echo, but I need to add it to my code.

It's a topic that I created myself, so I can't just create a client and call a service... And I also do not want to subscribe to the topic and create a callback function. I just want to know the topic's value at a given point in my code.

Is this possible?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-09-17 15:50:06 -0500

ahendrix gravatar image

In C++, you can use ros::topic::waitForMessage() : http://docs.ros.org/indigo/api/roscpp...

Note that this will be slow, because internally it creates a subscriber, waits for it to connect, waits for the first message, and then removes the subscriber.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-09-17 15:32:06 -0500

Seen: 215 times

Last updated: Sep 17 '14