Go to Post We don't do battle bots, but we play hard. - Gdeaver [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 22-01-2012, 19:47
Frky's Avatar
Frky Frky is offline
Programmers
FRC #1011 (CRUSH)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Arizona
Posts: 3
Frky is an unknown quantity at this point
Java/LabView TCP Solution

So for this year's game we were hoping to do video processing to target the backboard squares. We rewrote the Dashboard in LabView so we do all of our image processing on the Dashboard. We get coordinates of the rectangles and would like to use those numbers in Java, where we program the actual robot. After countless hours of trying various UDP and TCP combinations in both Java and LabView, we finally found a working solution!

The LabView end is pretty simple. First you need a TCP Listen.vi object, and then you need a TCP Write block inside a loop. Things on this end should be pretty clear, but if something isn't, we can post screenshots or more detailed information. We're using port 1180.

The Java end is a bit trickier. You attempt to open a connection to the port, and the LabView listener should accept the connection. Then we stream the data coming from LabView, and the InputStream reads it. We then output that data in Java. The code is from the FRC Iterative Robot Template, and we attached the main RobotTemplate.java file.

One important thing is, at the moment, the data streams faster than Java can process it. We're going to have to slow it down so we don't get a backlog of data when processing. Depending on your needs, this might be a thing to consider.

This code is free for anyone to use and it can be modified in any way. If anyone has a suggestion for improvements, please post them!

Hope this helps and good luck to all teams!!

-CRUSH 1011 Programmers

RobotTemplate.java
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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