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

Advertising new publisher after first spin in rosserial_windows

asked 2017-11-05 13:59:49 -0500

prnthp gravatar image

updated 2017-11-05 15:01:35 -0500

Apologies for the stupid question, but I'm still trying to grasp the basic concepts of rosnodes.

Is it possible to advertise a new publisher after the first spin? I'm currently using rosserial_windows and advertising a "late" publisher/topic results in a "Received message with unrecognized topic" warning and the new topic does not show in rostopic list. Is this a built-in limitation of ros nodes?

Just to be clear here's the order of execution:

  1. Initialize connection

  2. Advertise publishers/services

  3. spinOnce

  4. Publish a message + spinOnce (x 100)

  5. Advertise new publisher + spinOnce

  6. New topic does not show up, throws warning: "Received message with unrecognized topic"

Thank you!

edit retag flag offensive close merge delete

Comments

2

Not an answer, but please realise that you cannot consider anything rosserial as representative of the "basic concepts of rosnodes". rosserial implements a specialised subset, and has to deal with the restrictions of resource constrained platforms, which has led to some design decisions that ..

gvdhoorn gravatar image gvdhoorn  ( 2017-11-05 14:08:22 -0500 )edit
1

.. resulted in sometimes rather different behaviour and API.

Creating publishers and subscribers can be done at any time in 'normal ROS', but rosserial might have to do some special initialisation that requires a specific temporal ordering.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-05 14:09:37 -0500 )edit

Thank you! That clears up a lot of things.

prnthp gravatar image prnthp  ( 2017-11-05 14:18:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-11-05 14:59:19 -0500

prnthp gravatar image

updated 2017-11-05 15:00:14 -0500

To anyone who stumbles upon this question:

The node_handle class in rosserial_windows has a method called negotiateTopics() that is called only once (the first spin), not quite sure why. Simply calling the method negotiateTopics() after advertising a new publisher or subscriber tells rosserial_python's message_info_service to add the new topics!

edit flag offensive delete link more

Comments

not quite sure why

probably because it incurs some overhead which you'd want to avoid when negotiation is not needed anymore.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-06 01:17:31 -0500 )edit

What I meant was, why it is not called every time a new publisher or subscriber is created (maintaining a list, perhaps?). However, rosserial is designed for the arduino and I can see how the topics are only setup in setup() only once.

prnthp gravatar image prnthp  ( 2017-11-06 11:24:53 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-11-05 13:59:49 -0500

Seen: 222 times

Last updated: Nov 05 '17