CPP to Java

My issue is that my programming team has written our video processing program in CPP. However our robot and smartdashboard are written in java.

We need to send a Boolean from our video processing to our autonomous program. I do not know how to convert the CPP Boolean to a java program. Any help would be awesome.

What do you mean smartdashboard is written in Java?
You can always reimage the cRIO to C if that is what you mean by “robot written in java”.

The chunk of data which is the boolean doesn’t have to be converted to a “Java program”. For sending some data from the Driver Station to the robot, one could use sockets.

Basically, one opens a UDP socket on the Driver Station side and sends the data through. The robot side should have a UDP socket open and bound to some port like 1130 to which the Driver Station app is sending. I would recommend sending a character for something like that rather than a boolean since there isn’t a defined format for booleans.

The JVM used for java on the cRIO doesn’t support UDP, so TCP would have to be used for this approach.

Sorry if I was unclear. All of our dive code/autonomous is in Java so the crio is flashed to java. We are using the Java smartdashboard.

Our autonomous program needs to know if the goal is hot or not. The video processing will tell us that . So I need to send a Boolean between the CPP video processing to the Java autonomous telling whether the goal is hot or not.

Look at Boost.Asio for sending data. Use a threaded socket communication layer to keep a connection open continuously so you can receive TCP messages from the C++ program.

A “low-tech” solution if you are running something like a Raspberry Pi on the robot you could just use a digital output connected to the digital sidecar and the cRIO could just read that.

Where is the CPP video processing program being run?

(And what is CPP video processing?)

To answer your first question the CPP video processing is run on a raspberry pi.

To answer the second question CPP video processing is really opencv video processing.

If all you really want is a yes/no signal, this sounds like a perfect way to satisfy the requirement.