|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
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. |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
||||||
|
||||||
|
Re: Reading an Excel Spreadsheet on the CRIO
Quote:
Quote:
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,,,, |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||||
|
||||||
|
Re: Reading an Excel Spreadsheet on the CRIO
Quote:
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. Last edited by Joe Ross : 08-02-2014 at 01:29. |
|
#6
|
||||
|
||||
|
Re: Reading an Excel Spreadsheet on the CRIO
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)
|
|
#7
|
||||
|
||||
|
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. |
|
#8
|
||||
|
||||
|
Re: Reading an Excel Spreadsheet on the CRIO
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: 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 |
|
#9
|
||||
|
||||
|
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! |
|
#10
|
|||||
|
|||||
|
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.
|
|
#11
|
||||||
|
||||||
|
Re: Reading an Excel Spreadsheet on the CRIO
Quote:
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|