At Davis, the robot went berserk during autonomous. The problem was due to
unexpected digits at the beginning of lines in the recorded autonomous files. A
partial workaround was implemented to skip those characters. We should
implement a real fix now.
writeUTF is used to write each line of the file, with different separator
characters between each pair of numbers/booleans.
Here's a short article explaining writeUTF and readUTF:
http://stackoverflow.com/questions/4009157/java-socket-writeutf-and-readutf
writeUTF encodes the string length in its output. That was the source of
unexpected characters, since readUTF was not used to read the file.
In general, you should use matching methods with matching usage when
writing/reading. If you use writeUTF to write, use readUTF to read. If you
write one line at a time, read one line at a time. If you write a single string
containing the whole file, do the same when reading.
We should also change to CSV format -- separate by commas and put a newline
("\n") at the end. Unfortunately, our version of Java doesn't have
String::split, and we can't use off-the-shelf CSV parsers, since they use other
classes we don't have. However, you should be able to extract whole substrings
using indexOf(char, startfrom) and substring(begin, end).
Original issue reported on code.google.com by briankgr...@gmail.com on 24 Mar 2013 at 10:09
Original issue reported on code.google.com by
briankgr...@gmail.com
on 24 Mar 2013 at 10:09