Need help to program a mobile robot

Hello SFE hackers, programmers, builders and all , I’ve been working on my two-wheeled mobile robot I’ve been trying to attempt to perfect my obstacle avoidance algorithm which is Artificial Potential Field method . Basically for my robot I’m using 5 ultrasonic sensors and detect objects and avoid them. Also i use Arduino Uno kit . The basic concept of the potential field approach is to compute a artificial potential field in which the robot is attracted to the target and repulsed from the obstacles . The artificial potential field is used due to its computational simplicity it just need the locations of obstacles that effected the environment of robot with current position of robot and position of goal . the mobile robot applies a force generated by the artificial potential field as the control input to its driving system .
As i understood from Artificial Potential Field method that can be used directly as motion control which generate desired angle to avoid obstacle and reach to the goal with desired speed so the question is , is that means that the program micro-controller is very simple , it just need to write on it the Artificial Potential Field method code without any thing else and the robot will work successfully ??? or that thing is wrong ???

The Artificial Potential Field approach works well, but I would recommend that you learn to program it using a robot simulator rather than an actual mechanical robot. That way if you make a mistake, nothing is destroyed.

There are several simulators. I like MobotSim, which you can download and use for free for a month. It is very easy to program. mobotsoft.com/?page_id=9

Many thanks to Mr. Jim Remington
dear I have already programmed the algorithm by using Matlab and it well done , but the problem is how to program it by using Arduino language , i want to program the Arduino to do the following loop…
1-read sensors
2- calculate field grid (which is the tough part )
3- calculate the “force” gradient vector at the position of the robot
4- apply motor outputs to move the robot in the direction and magnitude of the updated "force"
The tough part is calculating your field grid.

thanks

[quote]2- calculate field grid (which is the tough part )[/quote]Why is this difficult? If you have already programmed it in MATLAB, it should be easy to translate into C/C++.

Many thanks to Mr. Jim Remington , yes I have already programmed it by Matlab and It is fine but how could i program the Arduino with Artificial Potential Field approach ?

That program can be rewritten for Arduino, but if you are not familiar with C/C++ then now is the time to learn! There are many good on-line tutorials and books.

Many of the statements are the same in C/C++, but all the ones that use MATLAB vector notation will have to be rewritten, as C/C++ does not support vector operators. Furthermore, you will need to replace the power (^2) notation with multiply operations, or the pow() function.

It is possible to have MATLAB output C code, but it is unlikely that the code will run on the Arduino without modification, and if you don’t know C you won’t learn much by trying. Google “matlab to c” for more information.