02 avril 2006

Tadaaa!!!! Version2

Actually, I rushed it out yesterday night.
Although the picture was real, it was only the result of a proof-of-concept. So I went back to it right after I posted and kept coding until I arrived to something that looks better. That happened around 6:30 AM this morning. At that point, most of the basics was done. There was some more work to do to present it to the wide world (anyone who doesn't have matlab, that is).

What I managed is to animate that scripted picture. Here's the animation (it's a video, you'll have to download it but it's very light): Video1 . Save it to your computer and drop a comment if you can't see it (WMP doesn't work anymore on my PC so I couldn't try it, VLC doesn't work but MediaPlayerClassic worked fine).

It's actually a simplistic simulation of a robot (that's the black rectangle). The code is right here: (yup the code is the picture). It takes the inputs of the movement (the speed and the turn of the "driving wheel"), it makes a little math to find the path the robot takes and then it makes some more computation to display it on my screen.
Then there's a script that takes the display from my screen and transforms it into a nice movie that I can upload to the net and brag about for years to come.


That took me about 3 weeks to go through, most of the hard work being done on the display and the movie making. In the time it took me to do it I learnt a lot about torture devices called Graphical Elements Handles and Level 2 M-file S-Functions which is the most powerful and least documented feature of matlab, of course. But now, I can say I know.

That was the tedious and painful work. Now comes the creative part of it. I've designed the simulation so that the robot can sense its environment. It can see the colour of the world under it and somewhat around it. And it's pretty easy (I hope) to design a "brain" with commands such as:
- if you see yellow in front of you, turn left and slow down
- if you see red on your side, stop, reverse and turn in the opposite direction
- ...

That brain is the real reason of my robot simulation. I will be able to tinker with it very easily and test things out. One of the first things I'll try is the line-following robot. It's a simple robot that follows a line marked on the floor. Then I'll try to model more complex behaviours, light-hungry robots, explorers, robots that have a memory of their world... What I'd like to obtain in the end is a robot that could mimic curiosity.
Another very interesting area of research is the behaviour of swarms of robots. But that will come at a later date. And yes, of course, I'll probably buy a real robot with a little processor and sensors to let loose in my room. A robot with tracks, like caterpillars or a robot with 6 legs like an insect? Tough choice...

2 commentaires:

tommpouce a dit…

not even sure it works on the old one. I don't know how, but my WMP is completely screwed, I even tried reinstalling it from the microsoft website, but it doesn't work. I'll need to try different encodings to see which would be best (and work). I'll try to do that tonight. :-)

Anonyme a dit…

it works for me! i could see the animation and it's really cool! i seriously can't wait to see the monster... errr... robot you'll be creating with that. i love the idea of a curious robot. actually, i already have a name if you're interested: Curiobot. and i vote for 6 legs. and a laser gun, if possible.

update us about your progress!

-kala