maandag 6 juni 2011

Finding a lake and also measuring it

After spending a whole weekend on finding the communcation problem and errors in the file, eventually a new code is build from scratch. Every time a new function is introduced and tested untill it works fine, while RCX 2 is playing as the Earth Station and sends the coordinates.
Today the code is used on the real Mars Surface and some minor things were not working on first hand.
Eventually the code already contained the receiving of the coordinates, the sending of the coordinates, the edge detection (and avoiding) and of course the driving to the lake.
This driving to the lake function is new and currently it works like this:
It stores valid coordinates, turns until the lake is in the middle and calculates the distance to drive to the lake.
Close to the lake it again turns to the middle of the lake (because there can be a deviation due to different motor speeds) and drives until the lake is found.
To detect if a lake is found, the second brick RCX 2 needs to send to RCX 1 that the lake is found. Then the RCX 1 detects if it actually is a lake, or if it is a cliff (the other ligth sensors may detect a cliff), and sends to RCX 2 that it can start measuring the temperature. After the temperature is measured, the temperature is send to the Earth Station.

Below we see 2 examples from this code, the first one is from a close distance where it directly drives to the lake, the second is at a different lake at a longer distance, where it also corrects to the middle of the lake twice.




We also started to implement the 'random drive' function in the working code above, but it does not work the way we want yet.
The next thing to do is to implement the random drive correctly and also think about avoiding the lake after it is measured.
After that, the most important things in the code are made and some tweaking is necessary. The distance calcuation to the lake can be improved and also the edge detection should be tested more thoroughly.

Geen opmerkingen:

Een reactie posten