Ask Your Question
0

A ROS message that contains no data, Signal only?

asked 2021-02-02 08:28:35 -0500

nightpoison gravatar image

Hello all,

Newbie here with ROS, and I have to say I love it. Its a lot of fun and I can only imagine the possibilities. With that said.

I haven't had any luck finding anything of its kind, but does ROS (Python) have anything that resembles something like an empty argument pyqtSignal, signal-slot, but between Nodes. It seems that I could consider ROS Pub/Sub to be similar, however I would like to trigger a signal of sorts as I don't need to send any data to the node I'm communicating with.

The simple solution is what I'm currently doing which is to create a publisher using String. and don't bother defining the string. Sends an empty message and it triggers the event I want.

However, I can't imagine there isnt a simple signal that can be linked like pub/sub that doesn't require a data_class, unlike Publishers.

Does ROS have anything of this nature?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-02 10:36:00 -0500

gvdhoorn gravatar image

The simple solution is what I'm currently doing which is to create a publisher using String. and don't bother defining the string. Sends an empty message and it triggers the event I want.

There is an Empty message in std_msgs, perhaps you could use that. You'd still be publishing something, it just doesn't have any contents.

Although if you're not looking for fire-and-forget semantics, using a service may be better. There's Empty there as well, and Trigger.

However, I can't imagine there isnt a simple signal that can be linked like pub/sub that doesn't require a data_class, unlike Publishers.

I'm not entirely sure how to take this comment. Nodes can communicate in three ways:

  1. topics
  2. services
  3. actions (sort-of a hybrid, or asynchronous services with feedback)

in all cases, something will have to be exchanged. There is no other way.

And all of it is only done because the publisher or client has the intention to communicate.

Even in Qt (which I believe you're referring to in your question), there is data exchanged. It may not be visible to you at the API/application level, but it's certainly there (invoking a function / method is essentially data exchange).

Publish-subscribe can be used to implement an Observer pattern, but it's not the same thing.

edit flag offensive delete link more

Comments

@gvdhoorn. Thank you! Great information. I haven't' jumped into Services just yet. I'm mainly working with Topics right now, as I'm trying to build out a good knowledge base with topics first. In this situation I wouldn't need any type of return message for the event trigger I'm looking for. However, the "std_msgs/Empty.msg" makes sense and I'll probably switch up from string to "Empty.msg" in its place. It meets the criteria, simple, which sometimes means not creating other operations when the current ones will do the same thing. Thanks again for the support.

nightpoison gravatar image nightpoison  ( 2021-02-02 10:58:59 -0500 )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: 2021-02-02 08:28:35 -0500

Seen: 106 times

Last updated: Feb 02