Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   CPP to Java (http://www.chiefdelphi.com/forums/showthread.php?t=126040)

E, Palmer 08-02-2014 10:36

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.

xXhunter47Xx 08-02-2014 10:49

Re: CPP to Java
 
Quote:

Originally Posted by E, Palmer (Post 1339581)
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".

calcmogul 08-02-2014 11:09

Re: CPP to 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.

Joe Ross 08-02-2014 11:51

Re: CPP to Java
 
Quote:

Originally Posted by mathmogul (Post 1339595)
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.

E, Palmer 08-02-2014 12:30

Re: CPP to Java
 
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.

MoosingIn3space 08-02-2014 12:33

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.

vinnie 08-02-2014 12:54

Re: CPP to Java
 
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.

Alan Anderson 08-02-2014 23:02

Re: CPP to Java
 
Where is the CPP video processing program being run?

(And what is CPP video processing?)

E, Palmer 09-02-2014 17:40

Re: CPP to Java
 
Quote:

Originally Posted by Alan Anderson (Post 1339906)
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.

Alan Anderson 09-02-2014 21:46

Re: CPP to Java
 
Quote:

Originally Posted by vinnie (Post 1339642)
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.

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


All times are GMT -5. The time now is 02:29.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi