Go to Post Why climb up to the scaling rungs when you can move the entire field down to your robot's height? - marcusbernstein [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 19 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-02-2014, 22:13
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2014, 22:29
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
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
__________________
Fast, cheap or working - pick any two!
Reply With Quote
  #3   Spotlight this post!  
Unread 07-02-2014, 22:46
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Reading an Excel Spreadsheet on the CRIO

Quote:
Originally Posted by Pault View Post
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 View Post
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,,,,
Reply With Quote
  #4   Spotlight this post!  
Unread 07-02-2014, 23:03
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
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.
__________________
Fast, cheap or working - pick any two!
Reply With Quote
  #5   Spotlight this post!  
Unread 08-02-2014, 01:18
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Reading an Excel Spreadsheet on the CRIO

Quote:
Originally Posted by wireties View Post
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.

Last edited by Joe Ross : 08-02-2014 at 01:29.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-02-2014, 01:31
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Reading an Excel Spreadsheet on the CRIO

Quote:
Originally Posted by Joe Ross View Post
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)
__________________
Fast, cheap or working - pick any two!
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2014, 02:01
Alpha Beta's Avatar
Alpha Beta Alpha Beta is offline
Strategy, Scouting, and LabVIEW
AKA: Mr. Aaron Bailey
FRC #1986 (Team Titanium)
Team Role: Coach
 
Join Date: Mar 2008
Rookie Year: 2007
Location: Lee's Summit, Missouri
Posts: 763
Alpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond reputeAlpha Beta has a reputation beyond repute
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.
__________________
Regional Wins: 2016(KC), 2015(St. Louis, Queen City), 2014(Central Illinois, KC), 2013(Hub City, KC, Oklahoma City), 2012(KC, St. Louis), 2011(Colorado), 2010(North Star)
Regional Chairman's Award: 2014(Central Illinois), 2009(10,000 Lakes)
Engineering Inspiration: 2016(Smoky Mountain), 2012(Kansas City), 2011(Denver)
Dean's List Finalist 2016(Jacob S), 2014(Cameron L), 2013(Jay U), 2012(Laura S), 2011(Dominic A), 2010(Collin R)
Woodie Flowers Finalist 2013 (Aaron Bailey)
Championships: Sub-Division Champion (2016), Finalist (2013, 2010), Semifinalist (2014), Quaterfinalist (2015, 2012, 2011)
Other Official Awards: Gracious Professionalism (2013) Entrepreneurship (2013), Quality (2015, 2015, 2013), Engineering Excellence (Champs 2013, 2012), Website (2011), Industrial Design (Archimedes/Tesla 2016, 2016, 2015, Newton 2014, 2013, 2011), Innovation in Control (2014, Champs 2010, 2010, 2008, 2008), Imagery (2009), Regional Finalist (2016, 2015, 2008)
Reply With Quote
  #8   Spotlight this post!  
Unread 08-02-2014, 02:04
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
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:

Click image for larger version

Name:	Loading Scripts.PNG
Views:	52
Size:	2.1 KB
ID:	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

Name:  spreadsheet.PNG
Views: 468
Size:  1.1 KB
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote
  #9   Spotlight this post!  
Unread 17-09-2014, 08:22
jcbc's Avatar
jcbc jcbc is offline
Registered User
AKA: Julie
no team
 
Join Date: Aug 2010
Rookie Year: 2011
Location: PA
Posts: 53
jcbc is a jewel in the roughjcbc is a jewel in the roughjcbc is a jewel in the roughjcbc is a jewel in the rough
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!
Reply With Quote
  #10   Spotlight this post!  
Unread 17-09-2014, 12:11
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #11   Spotlight this post!  
Unread 17-09-2014, 12:18
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Reading an Excel Spreadsheet on the CRIO

Quote:
Originally Posted by Mark McLeod View Post
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.
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote
Reply


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 20:57.

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