3

I'm working on a project, which I am not at liberty to discuss the core, but I have reached a stumbling block. I need data to be transferred from C++ to some other language, preferably Java or Python, in realtime (~10ms latency).

We have a sensor that HAS to be parsed in C++. We are planning on doing a data read/output through bluetooth, most likely Java or C# (I don't quite know C#, but it seems similar to Java). C++ will not fit the bill, since I do not feel advanced enough to use it for what we need. The sensor parsing is already finished. The data transferring will be happening on the same machine.

Here are the methods I've pondered:

  • We tried using MatLab with whatever the Mex stuff is (I don't do MatLab) to access functions from our C++ program, to retrieve the data as an array. Matlab will be too slow (we read somewhere that the TX/RX will be limited to 1-20 Hz.)
  • Writing the data to a text, or other equivalent raw data, file constantly, and opening it with the other language as necessary.

I attempted to look this up, but nothing of use showed in the results.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Frowney001
  • 408
  • 5
  • 7

2 Answers2

2

It seems like you are looking for a IPC (Inter-process communication). The easiest ones to implement are the socket and Pipes. I have added links which will help you decide which one to use. I have implemented named pipes and socket to transfer data at every 1ms. I did these implementations in python, c and pascal.

Here is the descriptions of all the IPC types

What's the difference between pipes and sockets

Community
  • 1
  • 1
Altronicx
  • 161
  • 1
  • 9
1

We had same issue where we had to share sensor data between one Java app to other multiple apps including Java,Python and R.

First we tried Socket connections but socket communication were not fault tolerant. Restarting or failure in one app affected other. Then we tried RMI calls between them but again we were unhappy due to scalability.

We wanted system to be reliable, scalable, distributed and fault tolerant. So, finally we started using RabbitMQ where we created one producer and multiple consumers. It worked well for 2 years. you may consider using Apache Kafka.

You have options like Socket pipes, RMI calls, RabbitMQ, Kafka, Redis based on your system requirements now and in near future.

Amit Maniar
  • 1,126
  • 8
  • 10