Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Accessing files on the driver station laptop from the robot (http://www.chiefdelphi.com/forums/showthread.php?t=148873)

GuyM142 10-06-2016 10:41

Accessing files on the driver station laptop from the robot
 
Hey everyone,
Our team is working on some off-season projects and one of them is reading parameters to the robot from a text file (possibly using config files)
We know how to process the file when it's local but we try to make it easier to edit and want to have the file stored on the driver station laptop.
What is the best way to read the config text file from the robot?

Can we use ftp VI's to copy it to the roboRIO through the FMS? (Will it work?)

We also had an idea to send the entire file as a string through Network Tables VI's and then read it on the roboRIO and save as a (.ini) file to process it. (Can the Network Tables handle such long string efficiently?)

We are looking for other teams' solutions and we will be happy if you will share your experience with us.

Thank you!

Sperkowsky 10-06-2016 12:07

Re: Accessing files on the driver station laptop from the robot
 
+1 on this our programmer wrote some xml autonomous thing and wanted to know if he could do this.

Alan Anderson 10-06-2016 12:41

Re: Accessing files on the driver station laptop from the robot
 
I suppose you could run an ftp server on the Driver Station computer and have the robot program connect and transfer the file. That does mean you will have to delay the initialization of your robot program until after there is a network connection.

If you are considering Network Tables at all, why not just use a Dashboard program to read the file and publish Network Tables variables for the configuration parameters? I think the Java SmartDashboard will do that sort of thing for you.

Why don't you want to put the file on the robot itself? I can think of a couple of ways to make doing that less of a hassle, the easiest of which might be to use a simple batch file to copy the file from the Driver Station computer to the robot filesystem after you've made changes to it.

GuyM142 10-06-2016 12:55

Re: Accessing files on the driver station laptop from the robot
 
Quote:

Originally Posted by Alan Anderson (Post 1592257)
I suppose you could run an ftp server on the Driver Station computer and have the robot program connect and transfer the file. That does mean you will have to delay the initialization of your robot program until after there is a network connection.

If you are considering Network Tables at all, why not just use a Dashboard program to read the file and publish Network Tables variables for the configuration parameters? I think the Java SmartDashboard will do that sort of thing for you.

Why don't you want to put the file on the robot itself? I can think of a couple of ways to make doing that less of a hassle, the easiest of which might be to use a simple batch file to copy the file from the Driver Station computer to the robot filesystem after you've made changes to it.

1. Is there a way I can make sure that everything that is working at home will work with field setup as well? That's my biggest concern.
2. I remember reading about a team which tried to do that and had problems (with over 100 parameters). I will search for it.
3.I didn't know it was possible, how can it be done with a batch file?

Alan Anderson 10-06-2016 14:32

Re: Accessing files on the driver station laptop from the robot
 
Quote:

Originally Posted by GuyM142 (Post 1592262)
1. Is there a way I can make sure that everything that is working at home will work with field setup as well? That's my biggest concern.

That's a legitimate concern. If you can ensure that you're only using the defined open port numbers, and if you have a good way of finding out the Driver Station's IP address, you should be fine. The communication library in the robot program definitely knows the address you need to talk to, because it's receiving data from it. I don't know if LabVIEW's built-in ftp function can be told to use a nonstandard port number, though.

Quote:

2. I remember reading about a team which tried to do that and had problems (with over 100 parameters). I will search for it.
How much run-time configuration are you trying to do?!

It might actually end up being reasonable to put a specialized web server on the roboRIO that lets you edit the configuration file in place.

Quote:

3.I didn't know it was possible, how can it be done with a batch file?
The batch file just has to invoke the command-line ftp client to copy the file from wherever you keep it on the laptop to wherever you want to put it on the roboRIO. It's just a way to make things so you don't have to type the command every time you want to run it.

Greg McKaskle 11-06-2016 10:49

Re: Accessing files on the driver station laptop from the robot
 
There was a new feature added to network tables this last year called persistence.

You can programmatically set persistence on a variable, using the Get or Update Persistence VIs (with blue floppies on the icon), or you can double-click on a variable in the dashboard to set or shift double-click to clear it.

What is persistence?
It means that the robot code will write the value to an ini-based file to keep the last known value. This is primarily for PID or pot tunings, and not as good for an auto-recipe. But if you think about it, as long as it is in network tables, it is the same on both sides. So you don't need to put the file on the robot. You can just read the file on the DB and update the variable(s) and they will show up on the robot. You can also persist them so that this is only needed when it changes.

To your original question, you can write a new program, use a command line batch file, or add code to a custom DB in order to read a file on the push of a button and send it to the robot using ftp, sftp, DAV, etc. You will need to make sure that the robot knows when to read the new file, and make sure that it is convenient to run that code.

A more manual method would be to put the file on a memory stick and insert it into the roboRIO's USB host port.

Greg McKaskle


All times are GMT -5. The time now is 20:42.

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