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

Revision history [back]

I think I got it :

There is 2 possible problem here :

  1. You didn't close your subscriber : If you registered your subscriber (in your case : rosptopic echo /chatter) with a roscore, then you closed this roscore and open a new one, the subscriber will not receive any message from the new roscore. You can check it by :

    • Open a roscore
    • Send a message to /chatter
    • Open your subscriber to /chatter
    • Close your roscore
    • Open your roscore again
    • Send a message to /chatter, nothing will happen
  2. Your publisher didn't have the time to send the message. Ros need some time to setup the publisher/Subscriber : https://github.com/ros/ros_comm/issues/176 or https://answers.ros.org/question/11167/how-do-i-publish-exactly-one-message/

Try to properly restart your roscore and subscriber and then try to add a little wait after your rospy.Publisher() to see if this works now.