Today I found some time to play with the Lego NXT, and I wrote the matlab version of the random light finder. The matlab program is shown below. It works quite well. With matlab I can now easily implement more sophisticated algorithm.
The robot can now effectively avoid obstacles, and I don't need to help it get out of somewhere from time to time. The program can also plot the light sensor data while the robot moves around. It is very slow to find the light because it's a random walker just like the Euglena.
The code is here.
Most of the code are straight forward, there is only one line I need to put some more words.
abs(lightdata(step)-lightdata(step-1))<5 means the light intensity almost unchanged compare to the last step. This could because the Robot get stuck somewhere and can't move forward. It also could because it goes to a dark regime where the light is always very low therefore hardly changes. The robot should avoid both the situations, so I let the robot go backwards a little bit in these two cases.
Showing posts with label Euglena. Show all posts
Showing posts with label Euglena. Show all posts
April 23, 2011
October 31, 2010
Memo v1
"Memo" is the program which will save light intensity value and compare the current light intensity with the saved one to make decision what to do next. The program is here.
When I program this version I also realized how difficult to program with NXT-G for a more complicated program. Therefore from now on I will use matlab to program NXT.
When I program this version I also realized how difficult to program with NXT-G for a more complicated program. Therefore from now on I will use matlab to program NXT.
October 24, 2010
Random Light Finder v3
In this version I add the function to use the ultrasonic sensor to detect approaching objects and let the NXT to avoid it. It works, though there are still some "bugs" partly because the limitation of the sensor (Can't detect object which doesn't reflect ultrasonic wave well and can't detect if the object is too close).
Flowing are the photos to show how to build the Random Light Finder v3 and the setup up.
Not that the facing direction (look up/down) of the ultrasonic sensor can be controlled by Motor B. I don't alter the direction in this version, but I will probably explore the possibility in the future version.
The program can be downloaded here.
Flowing are the photos to show how to build the Random Light Finder v3 and the setup up.
Not that the facing direction (look up/down) of the ultrasonic sensor can be controlled by Motor B. I don't alter the direction in this version, but I will probably explore the possibility in the future version.
The program can be downloaded here.
Random Light Finder v2
After spend some hours to get more familiar with the functions of NXT-G blocks. I simplified the algorithm. The new version can be downloaded here.
I also write a more simplified version in which I only let NXT rotate instead of both rotate and go forward. One can use this program to find the direction of the light (for example the redirect of the window). Download the rbt file here.
I also write a more simplified version in which I only let NXT rotate instead of both rotate and go forward. One can use this program to find the direction of the light (for example the redirect of the window). Download the rbt file here.
October 5, 2010
Random Light Finder v1
The first scheme I used is let the robot do random walk and stops when is light is stronger than a threshold.
I use the software NTX-G which is within the Lego NXT 8527 package to program it. Below is the illustration of the program, and the program is attached.
I put my desktop lamp on the floor as the light source. When NXT is with 30cm and faces to the lamp I get a light intensity over 70%, therefore I set 70% as the threshold in the program to tell NXT to stop.
Download the program here.
I use the software NTX-G which is within the Lego NXT 8527 package to program it. Below is the illustration of the program, and the program is attached.
I put my desktop lamp on the floor as the light source. When NXT is with 30cm and faces to the lamp I get a light intensity over 70%, therefore I set 70% as the threshold in the program to tell NXT to stop.
Download the program here.
October 4, 2010
Project Introduction
With the project Euglena I want to build a Lego NXT robot to find light. The name "Euglena" comes from the single-cell organism which can sense light and swim to it.
The sensor I am using is the light sensor and maybe also the ultrasonic sensor to avoid collision.
I will put all the programs and building instruction here, so that people who interested can reproduce it.
The sensor I am using is the light sensor and maybe also the ultrasonic sensor to avoid collision.
I will put all the programs and building instruction here, so that people who interested can reproduce it.
Subscribe to:
Posts (Atom)






