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

How to add new subscriber in move_base node ?

asked 2018-05-25 15:38:55 -0500

Developer gravatar image

updated 2018-05-25 19:30:33 -0500

ahendrix gravatar image

Hello,

I have integrated listener.cpp subscriber (from ROS tutorials) into the move_base node. I started move_base node and after I started talker.cpp node. But it does not work. Following steps show my process, where I am doing wrong ?

in move_base.h

ros::Subscriber listen_;

void listenCallback(const std_msgs::String::ConstPtr& msg);

in move_base.cpp

ros::NodeHandle listen_nh_;

listen_=  listen_nh_.subscribe<std_msgs::String>("chatter", 1, boost::bind(&MoveBase::listenCallback, this, _1));

void MoveBase::listenCallback(const std_msgs::String::ConstPtr& msg) {

 ROS_INFO("I heard: [%s]", msg->data.c_str());

}

So this is what I do. Do have any idea what my failure is or something forgetting ?

thanks

edit retag flag offensive close merge delete

Comments

But it does not work

What does this mean? What's happening vs what do you expect to happen?

jayess gravatar image jayess  ( 2018-05-25 16:08:09 -0500 )edit

thanks. I had written just topic name false. Now Problem is solved.

Developer gravatar image Developer  ( 2018-05-30 04:55:48 -0500 )edit

What does that mean? Are you saying that you had the wrong topic name?

jayess gravatar image jayess  ( 2018-05-30 11:31:02 -0500 )edit

I had written different topic names, I corrected it

Developer gravatar image Developer  ( 2018-05-30 14:25:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-25 15:47:50 -0500

mmmfarrell gravatar image

Did you do a catkin_make? (this would be the easiest problem to solve)

Also you shouldn't need the boost::bind ( I don't personally know what that does, but all of my nodes work without it.

Another thing to check, when you run the node, if you do rosnode info your_node_name does it say that your node is subscribing to "chatter"?

edit flag offensive delete link more

Comments

thanks for the info I have written just topic name false. Now Problem is solved.

Developer gravatar image Developer  ( 2018-05-25 16:10:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-25 15:38:55 -0500

Seen: 248 times

Last updated: May 25 '18