sending and recieving ROS messages to non-ROS machine - c++

Newbie to ROS and networking. Need some help here to understand the best approach i should take. I am trying to send Ros messages from a ROS PC to another non-ROS PC. There is a few way I researched that I can do it.
Install ROS on the non ROS machine. Connect it like a network. One will act as master with a common roscore for all
Write a ros node and recieve the ROS messages and then serialize them as UDP/TCP messages and broadcast them over the network
Through rosbridge and websockets writing json
Method 1 is probably not possible as there is a requirement is that we will have to reuse the WCF interface in the non-ROS PC.
Method 2: I wanted to get some help and insights about the tools/ packages/ libraries in ROS that can help with this. Have anyone has any template or could point me to a guide/website for some help?
Also I am puzzled to of why TCP is promoted over UDP or at least I have the impression.
Method 3: This seems a bit easier (on first look) but I have out that communicating through websockets is not so much supported(not sure if i use the right words) by WCF. Am I right?
Thanks for answering my query

What ROS topic does is wrap a series of data types (ROS messages) into a buffer and transport it through the network using either TCP or UDP protocol.
Every node publish its data on a 5-digit port on ROS network. I think you can listen to that port using plain socket-programming method and deserialize (I never checked, but I think deserialize methods are determined in genmsg package) based on the ROS message and I think you can get data out of the ROS system.

Maybe rosserial would to the job. rosserial is a protocol for wrapping standard ROS serialized messages and multiplexing multiple topics and services over a character device such as a serial port or network socket.
Video: https://youtu.be/JEwhXWKXlI0
Wiki.ros : http://wiki.ros.org/rosserial

Related

asio udp multicast sending and receiving on the same host using loopback on the same interface

I'm currently trying to implement the SOME/IP protocol which uses multicast for the service discovery. The Language is c++ and the asio library (without boost) is used in my case.
Currently the code works, but only on 2 diffrent machines. When i try multicast between the 2 apps on the same host i also receive the messages that i just send out. I understand that this is the purpose of the loopback interface, which is enabled when running on the same host but i'm wondering how you could filter out the own messages that were just send and not receive them again? As implementing the standard with that behaviour on one machine is nearly impossible.
When i bind the one programm to my ethernet interface and the other to my wifi interface a normal connection is possible without receiving the your own messaged again after sending.
Is it normal when you implement a network protocol to have 2 machines for testing or am i missing a simple settings which enables me to send / receive from 2 programms to the same multicast , on the same interface, without receiving its own send messages?
Essentially i want to send / receive with 2 programms on the same interface to the same multicast address without also receiving my own messages in each programm after sending them.
Thanks in advance for the help. If you have further question or if my explanation is not good to understand just ask please
I already tried using diffrent ports on the same machine, which resulted in no receiving of any data.

Recommended way to communicate from a C++ application to an Akka actor

I have a C++ application that needs to send structured data to an Akka actor. The best option I found (Google, stackoverflow...) is to use protocol buffer and ZeroMQ, since it looks like everyone recommends it.
However I struggled the whole day trying to make it work, having various crashes into my Scala actor code (with strange Windows socket errors). And when I take a deeper look at it, I notice that it seems zeromq disappeared from the Akka official documentation a while ago, and the most recent documentation I read about it said that ZeroMQ 3 was still not supported by zeromq-scala-bindings underneath (while the version 4 is already out).
Would it be a better option to use the Camel-netty extension and pass the information through JSON ?
Thanks !
A fairly simple way would be to write a HTTP endpoint using Spray.io. Spray has JSON support and since it is built on Akka it communicates seamlessly with other Actors. This has the advantage that the data you send to the endpoint does not have to match the message format the Actor is expecting. You can change the message the actor is expecting without changing what your C++ code sends. For bi-directional communication there is also web socket support.

Sending NS-3 packets through user-defined socket to another terminal

I wanted to know if anyone has any idea of how I can handle this scenario:
I want to have two terminals open. In one of them I want to run an NS-3 script file which generates packets and sends it through a socket to the other terminal.
The other terminal (which is only running a simple C socket program) receives the packet through the socket (and ideally displays the payload or even simpler increases a packet counter).
Any ideas appreciated...
Yes, you can make ns-3 interact with the real world.
Please read this tutorial :
http://www.nsnam.org/wiki/HOWTO_make_ns-3_interact_with_the_real_world
Especially Tap bridge. The Tap Bridge is designed to integrate “real” internet hosts (or more precisely, hosts that support Tun/Tap devices) into ns-3 simulations
http://www.nsnam.org/docs/release/3.18/models/html/tap.html

Sending data to a list of ip addresses - c++

Currently I am using enet to stream info, updated multiple times per second, to a list of
provided ip addresses / ports. I am creating a client connection for each of these
addresses (and there are server enet host connections running on those computers).
I am wondering if there is a more efficient way to send these messages(or simply a better solution to the problem)? Some way that I do not have to create
a enet host for each connection? I do need reliable delivery.
I am only using enet as it is convenient and already available in the system I am using.
A great solution for this problem is ZeroMQ.
It is a networking library with C++ bindings that specializes in the reliable delivery of messages in a variety of configurations, like the pub/sub model that looks like what you are trying to do.
ZeroMQ would effectively allow you to not even need to list the IPs of the subscribers, since they would indeed subscribe by connecting to your publisher. The publisher then would send data regardless of the number of subscribers (see http://zguide.zeromq.org/page:all#Getting-the-Message-Out).

p2p open source library tcp/udp multicast support

I have a certain application running on my computer. The same application can run on many computers on a LAN or different places in the world. I want to communicate between them. So I basically want a p2p system. But I will always know which computers(specific IP address) will be peers. I just want peers to have join and leave functionality. The single most important aim will be communication speed and time required. I assume simple UDP multicast (if anything like that exists) between peers will be fastest possible solution. I dont want to retransmit messages even if lost. Should I use an existing p2p library e.g. libjingle,etc. or just create some basic framework from scratch as my needs are pretty basic?
I think you're missing the point of UDP. It's not saving any time in a sense that a message gets faster to the destination, it's just you're posting the message and don't care if it arrives safely to the other side. On WAN - it will probably not arrive on the other side. UDP accross networks is problematic, as it can be thrown out by any router on the way which is tight on bandwidth - there's no guarantee of delivery for it.
I wouldn't suggest using UDP out of the topology under your control.
As to P2P vs directed sockets - the question is what it is that you need to move around. Do you need bi/multidirectional communication between all the peers, or you're talking to a single server from all the nodes?
You mentioned multicast - that would mean that you have some centralized source of data that transmits information and all the rest listen - in this case there's no benefit for P2P, and multicast, as a UDP protocol, may not work well accross multiple networks. But you can use TCP connections to each of the nodes, and "multicast" on your own, and not through IGMP. You can (and should) use threading and non-blocking sockets if you're concerned about sending blocking you, and of course you can use the QoS settings to "ask" routers to rush your sockets through.
You can use zeromq for support all network communication:
zeromq is a simple library encapsulate TCP and UDP for high level communication.
For P2P you can use the different mode of 0mq :
mode PGM/EPGM for discover member of P2P on your LAN (it use multicast)
mode REQ/REP for ask a question to one member
mode PULL/PUSH for duplicate one resource on the net
mode Publish/subscribe for transmission a file to all requester
Warning, zeromq is hard to install on windows...
And for HMI, use green-shoes ?
i think you should succeed using multicast,
unfortunately i do not know any library,
but still in case you have to do it from scratch
take a look at this:
http://www.tldp.org/HOWTO/Multicast-HOWTO.html
good luck :-)