Ask Your Question
0

Advertising new publisher after first spin in rosserial_windows

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

prnthp gravatar image

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

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

1

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 -0600 )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 -0600 )edit

Thank you! That clears up a lot of things.

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

1 Answer

Sort by ยป oldest newest most voted
0

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

prnthp gravatar image

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

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 -0600 )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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 137 times

Last updated: Nov 05 '17