Monday, June 8, 2009
Mission to Mars
In our first run we had some difficulties with the hardware, our rover was not able to drive backwards. After we repaired the mechanical part we gave it another shot. It turned out that we did not receive any coordinates, so even not 0,0. Thus there was no communication from the earth computer to our rover. This resulted in the zigzag mode, the mode which is performed when there is no communication.
For people who are interested, our code is posted here and the description is in our previous posts. Now we just have to wait for our final mark.
Download code HERE
Friday, June 5, 2009
Strategy Master Brick
The used states are:
- Communicate earth; The Brick communicates with the earth to obtain the coordinates.
- Approach lake; The rover is going to approach the lake with the obtained coordinates.
- Temperature Lake; The temperature of the lake is measured and send to the earth computer.
- Get away; We are finished at the lake so it is bypassed. from the lake after measuring
- Zig Zag; If something does not work properly the rover will start zig-zagging for a certain amount of time and will keep on trying to start again.
Lake Approach Working
(turn on your music to hear our team song!)
Thursday, June 4, 2009
Final version of our communication software
Since the beginning a lot of work has been done on the communication software, mainly because we build this part of the software from scratch on, meaning no ‘com.c’ or ‘easy’ sending of communicating with earth for coordinates and temperature. This was done so that we could completely understand what we were doing and design the software exactly as we wanted it. Furthermore there are parts in the communication software nowhere to be encountered in the rest of the code, so this was a very learning experience.
The way that sending is implemented in our code.
The communication software has been elaborated since we first started. A very schematic overview of the software is given in the figure at the bottom. Here the different lines represent dependencies on each other. The lines that run between the bricks or between a specific brick and the earth pc represent IR communication. This is done using the Lego Network Protocol (lnp.h).
Software
On the Master brick a listeninginterrupt is installed, this is a so called software interrupt routine, meaning it cannot be controlled by the user and will be called every time that there is IR communication (figure below.
Therefore no CPU intensive code can be included here, as this will result in system failure. This interrupt copys data to a specified location and will set a flag triggering the wait_event in the processing thread. This way cpu load is manageable.
Looking at the picture at the bottom, the master interrupt receives information from the earth pc as well as the Slave brick. To ensure that IR communication is not overflooded every time the brick communicates with earth, for the temperature or to receive coordinates, the Slave brick is told to stop sending by means of controlling a wait_event on the Slave brick. This can be seen in the figure looking at the com_temp and com_earth functions. These functions send out a signal controlling the SENDING variable shown in the Slave brick. This variable is the trigger for the wait_event within the Sending thread.
The Processing Thread on the Master will process all the information and will set some global variables (COORDINATES or LIGHT_ACT). Furthermore it sets a semaphore called ALIVE to the value of 1 every time it executes. Looking at the figure the Watchdog thread is also connected to this semaphore, this thread will set the value to 0 every time it runs, furthermore it runs at a set frequency and it will count the times it runs when ALIVE is 0. When more than three instances occur it will set the NO_COM variable to 1. This is the sign for the Master brick that all communication is lost and all driving is stopped.
Returning to the Slave brick there is a Backup Thread that will monitor how long the Sending Thread has been shut down. After a specified time the SENDING variable is set to 1 again, resulting in triggering the wait_event and firing up the Sending Thread. This is a built in safety to make sure that sending is reinitiated even when the START commando from the Master brick for some reason has not been received.
Figure 1: Software overview
Function usage
Within the rest of the code when include the given communication files the use can call two functions. Com_earth() will result in getting coordinates from the earth pc, returning FINISHED or NOT_FINISHED. Com_temp(value), will send the value as a temperature to the earth, also returning FINISHED or NOT_FINISHED. This way we can check whether communication is successful.
Lnp-dump
Wednesday, June 3, 2009
Approach lake
Software
The coordinates that are received from the earth computer, are used to build an array.This array contains the steering angle and direction, and the distance that has to be driven.
To calculate the steering angle, the position of the lake is compared to the center of the image. Because the distance from the rover to the lake and the distance from the lake and the deviation of the lake to the straight forward direction of the rover are known, the steering angle can be given. For example: when the deviation to the middle is 10, the steering angle for a lake at 20 is twice as large as the steering angle for the lake at 40. See the figure below for a graphical representation.
During driving the new calculated path, the rover will stop to check whether or not there are new coordinates. When there are, the rover will recalculate the path, and continue driving this new path. When there are no new coordinates, for example because there was no communication, the rover continues driving the old trajectory.
When there is an edge detected, the lake approach software gives a “not finished” command to the strategy software, which determines what to do. When the lake is detected, and when this is confirmed by triggering of the middle light sensor, the lake approach gives the command “finished”, which triggers the strategy to measure the lake temperature.
Function usage
The function lake approach is called by the strategy function, and runs by itself, using the edge detection on the slave brick and the communication with the earth. It also uses the path executer to give the steer and drive commands to the rover.
Tuesday, June 2, 2009
Edge Detection
Software
To be protected against not detecting the edges, or detecting several light deviations on the landscape as edge, some software tricks have to be implemented. To be protected, it is chosen to take the mean of the last 50 light values as the light value to be compared to. Using the mean of a array of samples, and updating this array continuously, smooth light changes in the landscape won’t be detected as an edge. The largest advantage of adapting to the surface is that the changes in light when detected an edge will be larger than the changes on the surface. An example is given in the figure below.
Function usage
The edge detection is the main part running on the slave brick. The slave brick is continuously running the edge detection with the communication to send the light value as quick as possible to the master. To send a small as possible code, the light sensors have a value assigned. In this case, the left sensor has value 1, the middle sensor value 2 and the right value 4. Now, all values between 0 (none) and 7 (all) have assigned which sensors are triggered.
Monday, June 1, 2009
The path executer
The path executer is a function that uses predefined paths that are implemented in the code. The five paths that are defined are shown in the figure below. All these paths can be travelled in forward direction, but also in reverse direction. When, for example, an edge is detected, the position in the array is stored. Knowing where the path executer has stopped, it is easy to travel back the part of the array that had been travelled. When the path executer has travelled the given array, it gives when it is finished or not. To detect edges, after executing a step of the array, the value of the edge detection is checked before executing the rest of the array. To prevent the rover from driving off the edge, each of the values in the array should not be too large.
Within the rest of the written code, a path can be executed by giving the kind of array that has to be driven and the direction. When an edge is detected, also the last executed part of the array can be given, which executes the path in reverse order to get back to the original position. A graphical overview of the code is given below.
Saturday, May 30, 2009
Off-line testing
Thursday, May 28, 2009
ZigZag
Today, the ZigZag mode, using the path executer is tested. Now, the rover is able to drive at the Mars Landscape without falling off the edge. (The movie is played at 4x speed)
To detect all the edges, the mean light value of the last 50 measured lightvalues are averaged and compared to the current light value. When the deviation between the average light value and the current lightvalue is too large, an edge is detected.
Wednesday, May 27, 2009
Data structure
Saturday, May 23, 2009
Software Tree
Thursday, May 21, 2009
Temperature Lake
Software
For measuring the temperature of the lake, the temp sensor and the temp motor have to be activated. After a certain time it is assumed that the probe measures the same temperature as the lake. If no temperature difference is detected, the probe is held in the lake for a longer time. When after five times no temperature difference is measured, the function returns to the strategy that the probe is probably besides the lake. If the measurement went well, the temperature is communicated to the earth.
Function usage
The function Temperature Lake is called by the strategy function. The function runs autonomous. If an error occurs, this is reported tot the strategy.
Tuesday, May 19, 2009
Bypass Edge using Path Executer
Thursday, May 14, 2009
Temperature sensor callibrated
Tuesday, May 12, 2009
Testing edgedetection and communication
Monday, May 11, 2009
Chess LineTracking Competition
Thursday, May 7, 2009
Tornado
Working testing version of communication
Saturday, May 2, 2009
SubVersionServer
Thursday, April 9, 2009
Line Tracking
Wednesday, April 8, 2009
Tuesday, April 7, 2009
Line tracking test
Thursday, April 2, 2009
Communication
Wednesday, April 1, 2009
Measurements with the encoder sensor
Sunday, March 29, 2009
Finite State Machine
Tuesday, March 24, 2009
Cliff Detection
Thursday, March 19, 2009
First program is running
The first communication between the mindstorm and a XP laptop is completed!
There is still a problem with communicating between a Vista laptop and the Mindstrom...
Monday, March 16, 2009
Start Embedded Motion Control
Ivo Hamersma
Geert-Jan Heldens
Wesley Ooms
Gerbert van de Ven
Jeroen Willems
This blog is to show the progression of group 4. When there is some new information available, it will be posted here.