How to program an Arduino Robot which can dodge an object that is moving/rolling towards it?

I am totally new to this so please help me!

Thanks,

Much Appreicated.

 

A lot of ways to proceed

You have quite a few options.  If you give more details we can help you better.

How big will the robot be?

Have you decided what kind of motors or wheels it will have?

Do you have any experience at all, with robots or arduino?

You can break the problem into several smaller problems and work on each of those.

The first problem is you need a robot that can move.

Then you need to be able to detect an object.  You will need some kind of sensor, such as an ultrasonic sensor or infrared.

Then, once you can detect the object, you need to determine if it is coming toward the robot.  By measuring the distance and checking if the distance is decreasing, you can determine if it is coming closer.

Then you need to have the robot decide how to move out of the way.

Give us more details and we can help you with the project.

Hi, thanks for the reply

Hi, thanks for the reply.

I have actually no experience in either arduino or robots, but I had already solved most of the problems such as detect object etc since they can all be found online. My only problem is that I have no idea in how to make the robot decides how to move out of the way when there are multiple objects (2~4) moving towards it in different directions, since I cant found any example similar to this online.

What do you have?

You should post what you have already.  Post the coe and diagrams showing what you have done and what you want to accomplish.

It will be almost impossible to give you specific help without specific knowledge of what you have.

Avoidance

For my scheme you must know the angle of trajectory for each of the approaching robots.

I would create map, grid of squares, that I consider safe. For instance an array sized 20 x 20, and Initialize the entries to “SAFE” (0).

Then for each robot, compute its course and mark the squares it travels thru as “UNSAFE” (1).

Then find the closest SAFE square to where you are.

If you know the approaching robot’s speed you could enhance the algorithm by having multiple grids, one for each approaching robot and instead of just marking entry as UNSAFE use the estimated time that the grid will be occupied.

The algorithm computation time should be insignificant compared to the time required to move your machine.

Sounds like a prime candidate for a simulation.

Gratitude

Thanks for the advise! I will try it.

Forces

Once you have some of the things oldguy has laid out, a robot, sensors, etc…

If you have distance sensors (like sonar or SharpIR that point in multiple directions or sweep to cover many angles.), you can try the Force Field Algorithm.  It won;t solve everything but can play a valuable part.

This algo will not specifically judge whether something is moving towards your bot, but it will take into account where all the objects are at a moment in time (as if they exert reverse gravity on your bot) and calculate a net force vector that can be used to alter the drive throttles to good effect.  This vector can also add in the goal that the robot may be trying to reach.

This can allow robots to move around while surrounded by multiple moving people, and plot gentle curves around obstacles.

I like some of the ideas already mentioned, like the grid, etc.