Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Reading an Excel Spreadsheet on the CRIO (http://www.chiefdelphi.com/forums/showthread.php?t=126027)

Pault 07-02-2014 22:13

Reading an Excel Spreadsheet on the CRIO
 
I am currently working on creating an autonomous scripting program for my team, and I have been having some trouble figuring out how to read the spreadsheet. I have been looking at team 1640's 2013 code to try and figure it out, but I can't seem to get access to the file. I believe that my problem is that the file is located on my computer, and I am trying to read it from the CRIO. If it helps anyone to know: even if I leave the file path unwired, LabVIEW will still give me an error instead of opening the file dialog box.

Any advice on how to tackle this problem? I am really excited about this program, and I think that it will be really nice once I can get it to work (I plan to post it on Chief Delphi next week after I have tested and documented it enough). But this has been a major stumbling block for me.

wireties 07-02-2014 22:29

Re: Reading an Excel Spreadsheet on the CRIO
 
Why use a spreadsheet format? A simple text file would be much easier - something like this for 2-ball autonomous:

BEGIN
MOVE <X> <Y> <speed>
DELAY <time>
STOP
LAUNCH
MOVE <X> <Y> <speed>
DELAY <time>
STOP
PICKUP
MOVE <X> <Y> <speed>
DELAY <time>
STOP
LAUNCH
END


Our team uses something like this. It is much easier to parse.

HTH

Joe Ross 07-02-2014 22:46

Re: Reading an Excel Spreadsheet on the CRIO
 
Quote:

Originally Posted by Pault (Post 1339460)
I am currently working on creating an autonomous scripting program for my team, and I have been having some trouble figuring out how to read the spreadsheet. I have been looking at team 1640's 2013 code to try and figure it out, but I can't seem to get access to the file. I believe that my problem is that the file is located on my computer, and I am trying to read it from the CRIO. If it helps anyone to know: even if I leave the file path unwired, LabVIEW will still give me an error instead of opening the file dialog box.

The cRIO can't open a dialog box on your computer. You need to ftp the file to the cRIO, so that it exists on the cRIO.


Quote:

Originally Posted by wireties (Post 1339469)
Why use a spreadsheet format? A simple text file would be much easier - something like this for 2-ball autonomous:

BEGIN
MOVE <X> <Y> <speed>
DELAY <time>
STOP
LAUNCH
MOVE <X> <Y> <speed>
DELAY <time>
STOP
PICKUP
MOVE <X> <Y> <speed>
DELAY <time>
STOP
LAUNCH
END


Our team uses something like this. It is much easier to parse.

The following is a spreadsheet format and is at least as easy to parse, if not easier.


Code:

BEGIN,,,,
MOVE, <X>, <Y>, <speed>,
DELAY, <time>,,,
STOP,,,,
LAUNCH,,,,
MOVE, <X>, <Y>, <speed>,
DELAY, <time>,
STOP,,,,
PICKUP,,,,
MOVE, <X>, <Y>, <speed>,
DELAY, <time>,,,
STOP,,,,
LAUNCH,,,,
END,,,,


wireties 07-02-2014 23:03

Re: Reading an Excel Spreadsheet on the CRIO
 
[quote=Joe Ross;1339473]The following is a spreadsheet format and is at least as easy to parse, if not easier.
[unquote]

With respect, that is not a spreadsheet format. It is something exported in comma-delimited ascii format (which is text just with commas instead of spaces as field delimiters). Both will work but why go to the trouble of fooling with importing and exporting files to/from a spreadsheet. Many driver stations do not have an office suite installed and they are not cheap.

Joe Ross 08-02-2014 01:18

Re: Reading an Excel Spreadsheet on the CRIO
 
Quote:

Originally Posted by wireties (Post 1339482)
With respect, that is not a spreadsheet format. It is something exported in comma-delimited ascii format (which is text just with commas instead of spaces as field delimiters). Both will work but why go to the trouble of fooling with importing and exporting files to/from a spreadsheet. Many driver stations do not have an office suite installed and they are not cheap.

Not that it is a definitive source, but wikipedia lists CSV in the category of spreadsheet file formats :-) It may be also useful to note that LabVIEW has built in libraries for reading both native excel files and csv (although the excel library is only supported on windows). There are also several free programs that will handle simple spreadsheets just fine, and our driver station (and most current laptops) come with Office Starter, which is a reduced version version of Microsoft Office, that is free.

I'm not saying that a spreadsheet is the best option in all instances, but that there are valid reasons for using it. Since the problems are related to reading a file in general, suggesting a different file format isn't going to help.

wireties 08-02-2014 01:31

Re: Reading an Excel Spreadsheet on the CRIO
 
Quote:

Originally Posted by Joe Ross (Post 1339522)
I'm not saying that a spreadsheet is the best option in all instances, but that there are valid reasons for using it. Since the problems are related to reading a file in general, suggesting a different file format isn't going to help.

Agreed - I guess I'm showing my age a little. We used CSV a long time before Excel or 123 appeared. And I dislike Windoze with a passion! ;o)

Alpha Beta 08-02-2014 02:01

Re: Reading an Excel Spreadsheet on the CRIO
 
Try using the "read from spreadsheet file.vi" in labview.

If you can't find it in the menu's (I don't remember where it is myself) try holding down control and spacebar. Then type in the name of the .vi in the quick drop that pops up.

Some nice pointers in this white paper.

wt200999 08-02-2014 02:04

Re: Reading an Excel Spreadsheet on the CRIO
 
2 Attachment(s)
To transfer files to the cRio we use FTP. In Windows 7 you can open any file browser and type ftp:\\10.xx.yy.2 into your browser when connected to the robot to upload files.

We use the following directory to store our scripts on the cRIO:

/ni-rt/LabVIEW Data/Scripts/

To read this directory we use the default data directory VI and a build path to list all the files and parse each one:

Attachment 16155

For the format we use, we basically compromised between what wireties and Joe Ross have said.

Our scripts look like what wireties showed (without the BEGIN and END)

Example:

Code:

MOVE <left %> <right %> <time>
TURN_ANGLE <angle>
DRIVE_DISTANCE <inches>
SHOOT_ON_HOT

However we parse it using the spreadsheet parse function, with SPACE as a deliminator instead of comma

Attachment 16156

jcbc 17-09-2014 08:22

Re: Reading an Excel Spreadsheet on the CRIO
 
I will probably start another thread once the team has done a couple more tests, but I wanted to see if anyone else has run into this behavior that the team has experienced intermittently throughout the 2014 season (but not during the 2013 season as far as I recall):

When reading the autonomous script CSV file from the CRIO during autonomous mode, the CRIO CPU usage spikes up to nearly 100% and the first autonomous action is delayed approximately 3 seconds.

The programmers finally nailed down the issue and reproduced it by just having a VI that reads a CSV file* on the CRIO (but not doing anything with the results of reading the file) followed in a sequence structure by activating a pneumatic actuator. The actuator does not fire for about 3 seconds after autonomous mode starts. (* We have been using Chris Hibner's VIs for autonomous scripting since the 2012 season.)

Like I said, I am just curious to know if anyone has seen this. I will gather more data and have the programmers put together a minimal robot project that reproduces the problem.

Thanks!

Mark McLeod 17-09-2014 12:11

Re: Reading an Excel Spreadsheet on the CRIO
 
I just took a quick glance at Chris's code, but he reads the CSV file in Begin where the file read doesn't make autonomous wait.

Chris Hibner 17-09-2014 12:18

Re: Reading an Excel Spreadsheet on the CRIO
 
Quote:

Originally Posted by Mark McLeod (Post 1400390)
I just took a quick glance at Chris's code, but he reads the CSV file in Begin where the file read doesn't make autonomous wait.

Correct - sort of.

It reads the first file in the folder in Begin. Then in Disabled it will read the next file in the folder if you push a joystick button. Either way, the file is never read during autonomous itself in the code I posted.


All times are GMT -5. The time now is 09:47.

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