Could anyone provide me with some psuedo code that would make a text file on the roborio? We are having a little trouble with our auto mode and my thought was to write to a text file on the roborio key points in the code, i.e. end gyro angle or end encoder positions. There wouldnt be more then a few data points written.
Thanks in advanced for your help,
P.S. We are programming in java.
P.S.S It would be even better if the file was a csv file.
If you’re only writing a few different data points, is it really necessary that you write to a text file and not just print to console? Those prints should be in the log file reported by driver station.
If you really want to write to the RoboRIO, you can do so using the Java BufferedWriter class. Keep in mind you’d probably have to SCP the file over. However, a neat trick with the RoboRIO that you can take advantage of is that any USB flash drive is automatically mounted to the U drive.
I know on the old CRio you could FTP into it. I want to be able to have the data tangible not just on the log files if that makes sense. It would be nice to write the file directly to a flash drive. I will look into BufferedWriter thanks for the suggestion.
Does anyone else have suggestions? Looking at all options since our competition is in two weeks.
We’ve been using a class we created for the past couple years called consolePrinter. It likely does what you want right out of the box.
If I remember correctly some minor changes were made to make it work with the 2018 wpilib updates.
This class allows you to register data fields (from anywhere in your code - public or private scopes - using lambda expressions) to be periodically logged to a file on the Rio and/or the smart dashboard.
Log files are saved within the /home/lvuser/Logs directory by default, if you want to go somewhere else, just change the path in code.
Text file output is in a tab delimited format, this could easily be changed to a CSV format by revising the contents of the dataToFile method where the string is built.