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

How can I get data in a callback function

asked 2012-09-28 13:52:44 -0600

dustsnow gravatar image

updated 2012-09-28 15:25:37 -0600

Kevin gravatar image

I have subscriber receive data from a topic. The message type is std_msgs::Bool. How can I access the data. I tried ".data" which didn't give me the content.

edit retag flag offensive close merge delete



Do you want to recieve data in a callback function? Then try bool var = msg->Data;

Peter Listov gravatar image Peter Listov  ( 2012-09-29 04:41:14 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2012-09-28 15:25:05 -0600

Kevin gravatar image

Why don't you look at the tutorials for subscribers and publishers? Also take a look at the bool message to figure it out.

edit flag offensive delete link more

Question Tools


Asked: 2012-09-28 13:52:44 -0600

Seen: 1,067 times

Last updated: Sep 28 '12