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

can we change the topic name to something else other than chatter when publishing and subscribing messages?

asked 2014-01-17 06:25:12 -0500

uzair gravatar image

updated 2014-01-17 06:30:43 -0500

I created a publisher in python and a listener in rosjava. I sent hello world under topic "chatter" from talker.py to listener.java. But when I changed the topic from "chatter" to "uic", the publisher publishes the message but the listener doesnot receive anything. I can see the following in my terminal and see that the listener is still subscribing to the chatter topic even after i changed it in listener.java code.

INFO: Response<success, subscribed="" to="" [="" chatter],="" []&gt;="" jan="" 17,="" 2014="" 11:55:35="" am="" org.ros.internal.node.topic.defaultsubscriber$1="" onmasterregistrationsuccess="" info:="" subscriber="" registered:="" subscriber<topic<topicidentifier<="" chatter="">, TopicDescription<std_msgs string,="" 992ce8a1687cec8c8bd883ec73ca41d1="">>>

Why is my listener still subscribing to topic chatter even after i changed it in the code?

I edited this line in the code where I changed chatter to uic:

Subscriber<std_msgs.string> subscriber =
connectedNode.newSubscriber("uic", std_msgs.String._TYPE);

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-01-17 07:04:05 -0500

ahendrix gravatar image

It looks like you've updated the code correctly.

Java is a compiled language; did you recompile your listener after you changed it?

edit flag offensive delete link more

Comments

1

My fault. Forgot to compile..it works fine now..thanks!

uzair gravatar image uzair  ( 2014-01-17 11:29:10 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-01-17 06:25:12 -0500

Seen: 376 times

Last updated: Jan 17 '14