Looking for useful examples

3 posts / 0 new
Last post
Offline
Last seen: 6 years 9 months ago
Joined: 07/07/2017
Posts: 1
Looking for useful examples

I have downloaded 70 examples and have used rtiddsgen and they all seem to have a somewhat unhelpful paradigm. Produce a publisher (exe) that generates some internal data (reads the keyboard or other method for generating the data local to the publisher). It then takes the data "message" and writes it. The subscriber (separate exe) catches the message and prints the data received.

What I am looking for is an example of a DDS "component" that subscribes to a topic with a data listener that receives incoming data and "on_data_available", operates on the incoming data, then in the SAME component, has a data writer to publish the results to other "components" to consume.

This obviously has to be done all the time, otherwise you wouldn't be able to build large systems with this tool.

Adam

Organization:
Offline
Last seen: 3 months 2 weeks ago
Joined: 02/11/2016
Posts: 144

Hey Adam,

What is it that you are looking for?

An example app that processes incoming data and then outputs data accordingly?

A code example of how to implement above mentioned app?

I can say that generally speaking:

1. there are 3 common ways one can handle incoming data

1.1. querying the reader at some desired time (periodically or when something else in the application happens)

1.2. using a data listener to be notified when new data is available

1.3. using a waitset with relevant statuses

2. once you have received the data there are many ways to react to it but you should note that if you are using a data listener, you must implement a non-blocking on_data_available (as blocking it will block all other events of rti, possibly making everything work poorly),

3. when it comes to writing data

3.1. you can do it when ever new inputs are received, but make sure that you are not blocking on_data_available (for example, using a synchronous writer which is reliable is dangerous)

3.2. you can use the incoming data to update some object and send that object periodically or when something special happens

 

I'll be happy to give more concrete advice if you explain what you need.

 

Good luck,

Roy.

Gerardo Pardo's picture
Offline
Last seen: 1 month 3 days ago
Joined: 06/02/2010
Posts: 601

Hi,

If you are looking for more realistic (and complex) examples addressing common application patterns you could take a the ones here https://community.rti.com/case-and-code we call these "Case+Code".

Gerardo