Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Labview on PC -> C++ on cRIO (http://www.chiefdelphi.com/forums/showthread.php?t=102077)

WizenedEE 06-02-2012 01:56

Labview on PC -> C++ on cRIO
 
Hello!
I have a pretty basic question that I cannot seem to find the answer for. Our team is going to do the vision processing on the PC running the driver station (since we're sending back the image anyway) using labview (since more vision functions are available there). We are also using C++ on the robot (because our programmers like it better).

So, what we are trying to do is send back the x-coordinate of the target (a float) to the robot. What is the recommended way of doing this? I've read about the NetworkTable class for C++, but I assume that it requires a specific interface that I would have to recreate in labview. Is there already a corrsponding vi? Is there another completely different way to do it?

Thank you!

Greg McKaskle 06-02-2012 08:15

Re: Labview on PC -> C++ on cRIO
 
If you are interested in beta testing a LabVIEW version of Network Tables, post as much. It doesn't do transactions yet, and I need to test performance and a few other things.

Greg McKaskle

WizenedEE 07-02-2012 02:01

Re: Labview on PC -> C++ on cRIO
 
Well I was trying to come up with a ready made solution or common practice (like using the udp functions), and I don't think I have enough time with labview this year to beta test it. Isn't sending data from the dashboard to the robot a common problem?

Greg McKaskle 07-02-2012 07:31

Re: Labview on PC -> C++ on cRIO
 
A few years ago, I'd say it was very uncommon, but from what I've seen on the forums, it is becoming common enough to improve the level where it is programmed -- to put more support into WPILib. The four slot work pushed off most other work, so it is just now being wrapped up.

I posted on some other forum with some UDP snippets that will accomplish this. I hope to have the Network Tables up in a few days, but I was looking for a few teams who were doing the cross-language stuff, since that has not been easy for me to get to.

Greg McKaskle

naibla 07-02-2012 20:10

Re: Labview on PC -> C++ on cRIO
 
Hi,
My team has been trying to do the exact same thing as WizenedEE. We would be happy to do any beta testing if you need it.

jesusrambo 08-02-2012 20:44

Re: Labview on PC -> C++ on cRIO
 
1 Attachment(s)
I'm just opening a TCP connection in the labview on port 1140, one of the open ones. I take all my values, TCP Write them, and then outside of the dashboard loop I close the TCP connection.

I'm using Java, so I can't exactly help you step by step through the cRIO side, but all you need to do is read from the TCP stream. Make sure to include some tokens in your output string in Labview so you can sort it out in the C++.

If anybody wants to look at my java or labview for the TCP send/recieve code, you can look at all of our Java on our github repository. I'm attaching my TCP loop that handles connection on the Dashboard side in the Labview as well. I can attach the transmitting part too but it gets kinda nasty with all my other blocks. It's my first time doing labview and things aren't always pretty.

Hjelstrom 09-02-2012 02:44

Re: Labview on PC -> C++ on cRIO
 
Since you are using c++, you could switch to the smart dashboard which can send data to the robot. There is already an API for sending and recording data called networktables.

jesusrambo 09-02-2012 03:10

Quote:

Originally Posted by Hjelstrom (Post 1122947)
Since you are using c++, you could switch to the smart dashboard which can send data to the robot. There is already an API for sending and recording data called networktables.

Yes, this is a very good point.

I didn't use networktables in my Java code because the Java implementation is... terribly done. There are methods documented that don't actually exist, etc, etc.

Thad House 12-02-2012 04:13

Re: Labview on PC -> C++ on cRIO
 
Would I be able to get a copy of the Network Tables for labview. We have our dashboard written in labview, and are trying to get the data sent back to our C++ robot code.

Thanks

Greg McKaskle 12-02-2012 08:59

Re: Labview on PC -> C++ on cRIO
 
The LabVIEW implementation of Network Tables is on FIRSTForge in File Releases/Network Tables. Eight downloads have already happened, and I haven't heard any explosions, so I guess it is stable enough. But I do need to say that it was built from the spec and tested against the SmartDashboard and LabVIEW running on the other side. I didn't have enough time or tools to test it thoroughly. Also, I'm redoing some of it for performance and need to get transactions in. A few examples are needed as well.

Please let me hear any questions or issues.

Greg McKaskle

Thad House 13-02-2012 19:41

Re: Labview on PC -> C++ on cRIO
 
We have been trying to set this up, and dont know exactly what functions to call on the driverstation and the CRIO. currently on the dashboard we have a loop which writes an int. we then on the crio we dont know exactly what code we need to init to read the table. would anyone be able to help us?

Greg McKaskle 13-02-2012 20:55

Re: Labview on PC -> C++ on cRIO
 
Be sure to place the Client in parallel with the other dashboard code and to wire the robot's IP to the client VI. I don't believe any of the other inputs are needed.

Greg McKaskle

Thad House 13-02-2012 23:01

Re: Labview on PC -> C++ on cRIO
 
Quote:

Originally Posted by Greg McKaskle (Post 1126027)
Be sure to place the Client in parallel with the other dashboard code and to wire the robot's IP to the client VI. I don't believe any of the other inputs are needed.

Greg McKaskle

In the labview code do we use the server vi or the client vi. We are going to be using the dashboard to send the data over to the CRIO. On the crio we are running c++. The CRIO says we dont have a connection, and the value never changes when we are running the code

Greg McKaskle 14-02-2012 08:02

Re: Labview on PC -> C++ on cRIO
 
The robot is the server. The dashboard is the client. So be sure to run the client on the dashboard, give it the robot IP address and make sure that it does the auto-restart. You may want to run interactively at first to see if they are connecting. Also, the default to sync is a table called SmartDashboard. If you need to sync others, add them to the list.

Greg McKaskle

nmg49 15-02-2012 22:35

Re: Labview on PC -> C++ on cRIO
 
Hi Greg, I'm a programmer working on the project in question. We tried to write up a simple test program to see if we could get data from the Dashboard to the Crio (running in C++). I don't have the Labview code handy, but here is the C code that's suppose to receive the data:

bool myBoolean;
Safety->Feed();
NetworkTable *myNetworkTable = new NetworkTable;
myNetworkTable->BeginTransaction();
myNetworkTable->GetTable("Robot");
myBoolean = myNetworkTable->GetBoolean("Test");
myNetworkTable->EndTransaction();
printf("%d, MyValue: \n", myBoolean);
Wait(1);
delete myNetworkTable;

Should this code be working? Are we doing anything wrong, at least on the receiving end?

Also, I was looking through the libraries a bit and I realized that the C++ and Labview functionality are different. For example, C++ doesn't have a function to create a Network Table (at least not one that's accessible from the NetworkTable class).

Any help you could give us on this would be amazing. Thanks.


All times are GMT -5. The time now is 00:52.

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