View Single Post
  #1   Spotlight this post!  
Unread 10-02-2013, 11:10
kenfox kenfox is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Ann Arbor, MI
Posts: 52
kenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of lightkenfox is a glorious beacon of light
Re: Printing to a text file

Quote:
Originally Posted by mrklempae View Post
So we may or may not be able to print data into a text file, but if so, only into the cRIO flash memory?
There's a file system on the cRIO that uses flash memory storage. We've written files over 10 MB. I'm not sure what the available storage is, but it's definitely enough for your purpose. When you open a file in robot code, you are opening a file on the cRIO file system. We use C stdio, but C++ streams should work too.

You must FTP to the cRIO to retrieve the file (or to delete it once you're done). We use both the Windows FTP client and a web browser. The FTP URL is "ftp://10.te.am.2/". If you use the FTP client, connect to the cRIO with "open 10.te.am.2" and then enter username "anonymous" password "anonymous". (Others may work, but that's just habit for me and I didn't try anything else.)

If you want to stream data back to the driver station you just have to be careful about network bandwidth. Sending 2 numbers every 1/100th sec is very low impact, but keep track of these things and disable them unless you need them in a match. Paper cuts will kill you eventually.

Smart dashboard makes streaming data incredibly easy. Replace the stream IO statements in your loop with this:

Code:
while (counter <= 1500) {
    SmartDashboard::PutNumber("right", RightDrive->Get());
    SmartDashboard::PutNumber("left", LeftDrive->Get());
    counter++;
    Wait(0.01);
}
If that number changes too fast to be understood, go into smart dashboard edit mode and change the number displays to be line plots. There's no coding required.

Smart dashboard uses WPILib network tables. If you need something fancier you could write a custom network tables client that runs on the driver station. I think smart dashboard will solve your problem though. It also has the advantage of working during a competition match through the FMS. Other solutions may not work in competition and there's no way I know of to test if something will work with the FMS.
Reply With Quote