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

Easiest way for non-ROS program to talk to a ROS node

asked 2017-08-03 06:58:27 -0600

pitosalas gravatar image

updated 2017-08-03 08:51:57 -0600

I have a totally ROS-independent application (the "app", say written in python, and launched from the command line) running on the same computer (i.e. the linux instance, with direct access to the same disk). The app has no ROS includes or dependencies. Note that because of this I don't have to rely on http per se.

What is the best/simplest way to have that app to talk to a ROS node? Performance is not an issue as the amount of data going back and forth would be very small. To be specific, the data could be represented in JSON file of a few hundred bytes being sent and received every few seconds.

For example, one way is to read and write a shared file which is very general and generic but not so elegant.

Is it possible to read and write ROS parameters from outside ROS?

What are better ideas?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2017-08-03 07:29:16 -0600

gvdhoorn gravatar image

updated 2017-08-03 09:38:04 -0600

You don't give us any info on what you'd like to communicate, so this is hard to answer, but: there is a similar / duplicate question from just a few hours ago. See #q267939.


But this -- and #q267939 -- are essentially duplicates of many others. Please try to use the search or Google (add site:answers.ros.org to your query).


Edit:

To be specific, the data could be represented in JSON file of a few hundred bytes being sent and received every few seconds.

That is exactly what the tools (rosbridge_suite) in the answer to #q267939 actually do: provide you with a JSON bridge to a ROS nodegraph.

I have done a ton of googling

this is probably google and my search bubble with them, but the first result for me when searching for ros json is rosbridge_suite.


Edit2: another option might be rosnodejs.


and another one rosserial, in particular rosserial_embeddedlinux. It wasn't meant for this, but could be an option. Just run client and server on the same machine.

edit flag offensive delete link more

Comments

Actually those are not essentially duplicates as I am not talking about networking. I have done a ton of googling and looking at libraries and talking to developers and the result is still open. I won't go through the results of all my research here (no room) but I will update my question.

pitosalas gravatar image pitosalas  ( 2017-08-03 07:32:05 -0600 )edit

You're asking how to exchange data with a ROS application. ROS is networked, so any interchange infrastructure is going to use networking. It's the most natural way to do it.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-03 07:34:27 -0600 )edit

@gvdhoorn I see that, but my needs are so lightweight and all the libraries I've seen seem to be pretty heavy weight so I am not quite satisfied with the options I have so far, which is why I am consulting the community!

pitosalas gravatar image pitosalas  ( 2017-08-03 08:53:40 -0600 )edit

heavy weight

on the ROS side or the non-ROS side? Working with JSON should not need too many dependencies.

And rosbridge_suite is basically two nodes?

gvdhoorn gravatar image gvdhoorn  ( 2017-08-03 09:12:00 -0600 )edit

on the ROS side, and not just in terms of my programming but on the load it would put on the on board processor which is a Pi for now. I realize that it doesn't have to be on the onboard, but for design reasons I prefer that.

pitosalas gravatar image pitosalas  ( 2017-08-03 09:34:26 -0600 )edit

Have you tried rosbridge_suite? I cannot imagine that it is resource intensive for just a few hundred bytes of json each second.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-03 09:36:04 -0600 )edit
0

answered 2017-08-03 14:10:48 -0600

allenh1 gravatar image

I've done this in the past over TCP. I'm sure you could adapt that code pretty quickly.

edit flag offensive delete link more
0

answered 2017-08-03 14:07:26 -0600

Ros User gravatar image

I had to deal with similar situation in my project where I had to communicate data back and forth between ROS and iOS app. The approach that I found the easiest was to create a TCP server-client application using Python. You can develop a ROS node which is also a TCP server (I used twisted protocol of python for this (you can refer to ( http://twistedmatrix.com/trac/)) . This server, being a ROS node can have access to all the ROS parameters. You can then create a TCP client in python which can then receive the information (which could be any message or ROS parameters which you would like to transfer) from the TCP server.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-08-03 06:58:27 -0600

Seen: 1,927 times

Last updated: Aug 03 '17