0
$\begingroup$

Rosanswers logo

The C++ program has been made in Visual C++. How can I establish a network with my program and ROS but without having ROS on Windows?, I mean a directly conexion between my program in VC++ and ROS.

I know that ROS can run on Windows, but my goal is not do a network between ROS on windows and ROS on Linux.

I have already created a Client/Server code in C++, so I think that I can implement that code in ROS (with cpp) and my program just to send/recieve messages between them. Is it possible just configure a network on ROS? I mean to set up IP, port, protocol.

I would appreciate your help with tips or example of codes.

Thanks.


Originally posted by Alfredo Rodriguez on ROS Answers with karma: 1 on 2013-01-13

Post score: 0


Original comments

Comment by Alfredo Rodriguez on 2013-01-14:
If I do that "dbworth" recomended me, can I use functions of ROS just to obtain values from a device with a ROS driver and then use the TCP connection to send that value to the VC++ program (Computer running on Windows)? I mean send that value to process it in the program in VC++.

Comment by Alfredo Rodriguez on 2013-01-14:
My goal is just send values (that are obtained from a device connected with ROS, for example a sensor) from ROS on Linux to a VC++ program on Windows and process those values in that VC++ program.

Comment by dbworth on 2013-01-14:
Of course, you can write a little node that subscribes to a topic, then in the callback it writes the data to some variable. Then in the while loop (mentioned below) it sends the current value out via non-ROS TCP socket.

Comment by Alfredo Rodriguez on 2013-01-17:
Is there a format message to subscribe to a topic? How can I do it? Thanks.

Comment by dbworth on 2013-01-17:
Okay, step 1 is to do all the ROS Tutorials. It is important. Then make a new package to read the sensor. Write the CPP code for your new node, and get it to print the sensor data to terminal window. Then you can add the code for creating a TCP socket in Linux, and output that data on a socket.

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

You can simply run a ROS Node on Linux that receives both ROS messages and messages on a standard TCP/IP socket.

Google search for TCP sockets programming for Linux, and winsock programming for VC++. You create a simple TCP socket connection and pass data back and forth. In the ROS node, you have a loop like:

while (ROS::OK) { 
   do stuff in loop 
}

So you put the sockets code in there. The system can be uni-directional (one way communication) of even bi-directional (both ways) works fine.



Originally posted by dbworth with karma: 1103 on 2013-01-13

This answer was ACCEPTED on the original site

Post score: 6

$\endgroup$
0
$\begingroup$

Rosanswers logo

What do you want to do is not too much well explained. But in any case, here you are some important hints about using a heterogeneus network for robotic applications with/without ROS:

ROS currently has only a basic and experimental support for windows: http://www.ros.org/wiki/win_ros. You will have to test the basic examples of this package. Also make sure that the ROS_MASTER_URI variable is properly set.

Of course you an alternative is interconecting processes using standar IPC mechanism: from simple sockets to complex web services. You can also use XML-RPC++. However, if you use these mechanisms you will lose the majority of the runtime ROS benefits as Distributed System: introspection, data standarization in the comunications, parameter server, services, dynamic reconfigure. It also includes the powerful publish/subscribe (topics) that ROS provides: A ROS node/process can comunicate with other process in other machines in a decoupled way. That is, without knowing neither: the IP of the machine nor the proces PID nor the underlaying socket port.

Also many of the development and deployment ROS features like roslauch/topic remaping, etc.


Originally posted by Pablo Iñigo Blasco with karma: 2982 on 2013-01-13

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Aakashp on 2020-11-29:
Sorry but I disagree with your point that "A ROS node can communicate with other process in other machines without knowing their IP, PID or port". Please correct me @gvdhoorn and @dbworth in case my understanding needs an improvement. A ROS node (say N1) gets to communicate with another node (say N2) only when N1 needs to subscribe to messages that are actually being published by the other node N2 on a particular topic. And when N1 needs to receive the messages from this particular topic, it first and foremost communicates with Master, letting him know that it (N1) is interested in receiving messages from that topic. After this, the master sends the list of publisher nodes to N1. This list contains the IP address, port details of the publisher N2. So, now N1 uses the IP address and port of N2 to negotiate the sharing of messages.

Comment by gvdhoorn on 2020-11-30:
@Aakashp: you seem to be ignoring the fact that an application (and also single nodes) always consist of multiple levels of abstraction. At many of these levels, a ROS node can communicate with others without knowing anything about the underlying network details (such as IP and port).

For all intents and purposes, those are the levels at which ROS node authors typically work: you create a subscriber by specifying a topic name and a callback. You don't enter an IP and/or port anywhere. Same for publishers.

That's what the OP of this answer describes.

If you have any further questions about this, please post a new question, as comments on questions from 2013 have almost 0 visibility.

Comment by Aakashp on 2020-11-30:
@gvdhoorn: Many thanks for throwing light on this. I agree with what you say. Actually, I was making the point that even though the details of connection-establishment are abstracted from the author of ROS node, still, a node does utilise such low-level details (such as IP and port number) of other node to communicate with it. I was ignoring abstraction while I commented earlier.

Ok, I will keep in mind of posting new question henceforth instead of commenting on such old questions. Thanks again!

$\endgroup$
0
$\begingroup$

Rosanswers logo

Rosbridge might be an answer for your case. Basically, you run the Rosbridge server within ROS environment, and implement web socket client within your windows program. For details, you could refer to ROSbridge documentation.


Originally posted by clark with karma: 393 on 2013-01-13

This answer was NOT ACCEPTED on the original site

Post score: 5


Original comments

Comment by felix k on 2013-01-14:
Which is there: http://ros.org/wiki/rosbridge

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.