... | ... | @@ -52,12 +52,21 @@ |
|
|
>Though we managed to make it balance for a few seconds it was constantly moving and shaking in it’s struggle to stay on the pivot-point. This may be due to the physical construction of the robot and will be discussed further in exercise 3.
|
|
|
>
|
|
|
>
|
|
|
>DATALOG offset værdien, så vi kan se hvor længe robotten kan holde sig tæt på værdien før den vælter.
|
|
|
While implementing the datalogger in the SejwayLight class, we learned that the standard datalogger was interfering with the robots ability to balance.
|
|
|
>While implementing the datalogger in the SejwayLight class, we learned that the standard datalogger was interfering with the robots ability to balance.
|
|
|
This was because that the standard datalogger interrupts communication to the sensor when it tries to read data from it and write the data right away. We learned that we had to rewrite the datalogger class to make it store the sensor data in the buffer and only write it to a file after the program had finished running.
|
|
|
In the datalogger class we had to replace FileOutputStream with BufferedOutputStream to do this.
|
|
|
>
|
|
|
>Code snippet, DataLogger.java:
|
|
|
>```
|
|
|
>fob = new BufferedOutputStream(new FileOutputStream(f));
|
|
|
>```
|
|
|
>
|
|
|
>We implemented the datalogger directly in the running loop of the SejwayLight program. We knew that this would get us a lot of measurements, as there is no delay in the loop .Unfortunately it also lead to the NXT running out of memory fairly quickly (within 30 seconds), so we could not get it to balance by itself before the NXT ran out of memory and crashed.
|
|
|
>
|
|
|
> ![SejwayLight measurements](http://gitlab.au.dk/uploads/group-22/lego/ea5153b6c8/SejwayLight_measurements.png)
|
|
|
> ##### Fig. 4 - SejwayLight assisted balance measurements.
|
|
|
>
|
|
|
>As can be seen in the graph in fig. ??, the light sensor oscillates just around the balance point. It is important to note that the balance point changes depending on the surrounding environment, so the best place to get the robot to balance in, is a room with no windows and a constant light level with no influence from outside.
|
|
|
>
|
|
|
>---
|
|
|
>
|
... | ... | |