Go to Post Stacking totes on end; Gives you extra height, alas; Topples with a sneeze. - BethMo [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2013, 16:47
sjspry sjspry is offline
Registered User
FRC #1984
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Kansas
Posts: 125
sjspry has a spectacular aura aboutsjspry has a spectacular aura aboutsjspry has a spectacular aura about
Problems Accessing Robot-Side File

Using the Connector paradigm to open a FileConnection and trying to read from it, I'm encountering errors. These seem to stem from the fact that a call to available() returns 0 bytes.

Does anyone have a solution? The file I am trying to open is on the root of the cRIO's file system, so I could see file permissions being an issue (but I get no Exception to this effect, nor can I really justify this in my mind). I would try to relocate the file but have no idea what the default working directory of any code run on the robot is (nor do I really know how j2me handles things like this).
Reply With Quote
  #2   Spotlight this post!  
Unread 08-02-2013, 18:15
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Problems Accessing Robot-Side File

If you open the WPILib source code project in NetBeans and take a look at the Preferences class you can see some examples of file reading and writing. It reads the preferences file from the cRIO in the read() method from the constructor and writes to it when the save() method is called.

That should give you a pretty good idea of reading/writing text files.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2013, 16:42
sjspry sjspry is offline
Registered User
FRC #1984
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Kansas
Posts: 125
sjspry has a spectacular aura aboutsjspry has a spectacular aura aboutsjspry has a spectacular aura about
Re: Problems Accessing Robot-Side File

Yes, I am doing it exactly like that. The available() method of the InputStream returns zero. The file is being uploaded to the root of the drive via FTP.

I might try using Preferences class, but I don't like the idea of having to use NetworkTable to update the values.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2013, 11:07
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Problems Accessing Robot-Side File

Maybe that wasn't so clear. I wasn't thinking that you should necessarily use the Preference class except as an example of how to write code that does file I/O.

But if you did decide to use it as is, the network tables stuff in there is so that you can edit the preferences from the SmartDashboard. The network tables code isn't used for reading and writing the preferences on the robot.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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 10:10.

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