Demo graph and message
Information storage format demo in a .txt file
The temporary GUI, when you run the program
A button drop down menu using JButton
A variable table demo using JTable (not connected to the file storage)
When we were presented with a task as open as this, we couldn't help but be slightly overwhelmed with the possibilities we could take. After discussing ideas, we settled on tackling the potential driving safety issue that could be on the rise caused by the legalization of certain drugs, and the persistently prevalent problem of drinking and driving.
As we know, driving on a highway is usually more dangerous than driving in the city, because the speed limit is a lot higher and people tend to not follow the rules as well as they would in an urban area. There are many instances of collisions caused by the vehicle in front experiencing a sudden drop in velocity, which we created a program to avoid.
SafeSpace is the software portion of the potential firmware we would create if we wanted to continue on with the project. However, due to time limit, we only coded the software portion and used simulated/assumed sensor input. We apologize but due to limited knowledge, we were not able to present you with a demo link, however we went through the back end of the program and commented on most parts of the program to explain our process and how our program would function(see carclass, graphclass, and drawclass). The other three classes are general GUI classes; for most they are just place holders due to time constriction, but can be explained if requested. A DEMO WILL BE PRESENTED TO THE JUDGES, not through submission, but during out pitch.
There were two main problems that we had the most trouble with - here's how we solved them:
- We both agreed on the idea of graphing, since it visually presents a wide range of data to the user and backs up the suggestions the program outputs. However, graphing functions are not included in the default library in Eclipse. We had to find alternatives, and found a Java chart library called JFreeChart. Learning a new library is always an exciting process, but it was also quite challenging as getting used to the syntax and the notation, learning the functions and applying them into our program was one of the most time consuming parts of our project.
- Another choice we made that lead us to a challenge was random accessing. We both agreed that using sequential writing would be way too inefficient, and we came to the conclusion of opting to use random accessing. After searching online, we obtained the knowledge and started to add the parts to our program. However, the raf(random access file) system in eclipse writes UTF-8 characters, while .txt files are written in UTF-16 characters. This gave us trouble when reading the files since some of the UTF-8 characters would turn into unknown characters. We solved this problem by using the writeChars() function instead of the writeUTF() function, but there were still more problems in our code. The writeChars() were unaffected since chars are based on ascii values, but writeChars() separates the written character with null characters - ** UTF-8 null characters**. The UTF-8 null character is "\00", while the UTF-16 null character "\x00", and since those characters do look like spaces, our replaceALL() function did not return the output we expected it to. We debugged this problem by recognizing the fact that they were actually void characters using ascii values, and then finding the character notation for null characters in UTF-8 characters
If we were to go on with this project, the first step we would work towards is to have a more presentable GUI. We were not able to create a aesthetically pleasing GUI due to time restriction, however that is definitely something we would love to work towards. Also, as described earlier, SafeSpace is only the software part of a firmware, meaning we could also hook up a sensor and some mechanical parts and do some real life testing with the product, which would be very interesting.
The process of coming up with ideas and creating the repository code for a software in a limited time was such a fun and amazing experience. It might have been stressful at times when something went wrong and we had to search through the whole program, however when we reached the point where the program was functional, the sense of accomplishment was overwhelming enough to cover all the not so pleasant experiences.