This was a quick and dirty project for a robotics class that I took at Georgia Tech in 2005. In this project, I built a Matlab simulator for testing out some simple obstacle avoidance/navigation code. My hope is that someone uses this a springboard to make a more complete version.
Introduction
I’ve spent plenty of time working on robotics projects, and I have enjoyed all aspects of the design process from mechanical to electrical to computer science. However, if you are only interested in the computer science part (control theory, artificial intelligence, creating behavior) then having to have an electromechanical platform to run your code on can be a big hassle!
One solution to this is to use a pre-made platform (such as in this project). However, this too can be problematic because everything can break, and when developing algorithms, it is often convenient to prototype them in a simulated environment where real-life confounders don’t hinder your creativity.
Simulations
This problem is often solved by robot simulators. One that I’ve used with great success is differential steering model. This is a simple, but very useful model for robotic actuation. With this type of drive system the robot can drive straight, trace an arc, or even turn in place.

Simulated World
The simulated robot can make its way around a simulated environment represented by a .png file where black represents walls, and white represents flat, clear terrain. Thus any “environment” can be shown as a black and white image. For testing, I used two types of terrains, an organic-looking obstacle course and an “office” with square walls and corners.
![[terrain images]](http://www.shawnlankton.com/wp-content/uploads/2007/09/course_terrain.thumbnail.png)
![[terrain images]](http://www.shawnlankton.com/wp-content/uploads/2007/09/office_terrain.thumbnail.png)
Navigation
So, now that we have a simulated robot in a simulated world we want it to do something. The goal I was working towards was this: Make the robot wander around the environment covering most of the area and not hitting any of the walls. This is accomplished with a pretty simple algorithm:
- Go straight unless sensors are blocked
- If one sensor is blocked, turn away from it
- If both are blocked, turn towards the farthest
- Turn until both sensors are free
- Continue going straight
There is a lot of room for improvement here (obviously), but this was a very quick project.
Results
Check out a couple of videos. Here we see the robot’s path as it drives around the area.
Demo
Download the demo and run “>>setup.m” Please feel free to make improvements to this. If you do, let me know!
hi, i just try your simulator and it is awesome ;)… can or not this code i’m extend to be multi-robot? or do you have the code…?..
Thanks…
I think it would be a good exercise to add a second robot. It would be fun, too. If you do it let me know and I’ll post your improvement or a link to it!
i tried… and i got tired, because still do not success… maybe you can give some idea to start…
TQ
i can plot multi robot now.. but just cannot drive all the robot yet… one more thing, do you have any idea how i want to do robot-robot avoidance?
Thanks…
Hello. I would like algorithm. It’s quite interesting .. and I would like more details.
Thank you
hi nice job……if you can , would you send me the matlab code for the robot with the sensors……it would be a great help ……
thank for your time!
Hi Angelo. All the code is available for download in the post – let me know if the link is broken!
hi
I simulated mobile robot navigation algorithm for dynamic bacteria need that please help me
email: peyman.jabraelzade@gmail.com
hlw,it is a very nice work.
may i plz know how to run the files sequentialy?i mean first i run the setup.m file but when i tried to run the others they r giving error…so mayb b i am wrong with the input and outputs.
plz guide
thnx