How to mix number of robotics programs?

Many times my students ask me that how to mix number of robotics programs together. Actually this question should be asked as follows –

How can I control my robot to run on black track as well as as table top edge avoiding robot?

How to write obstacle avoiding robot code with line following robot code?

How to write obstacle avoiding robot code with table top edge avoiding robot code?

The answer to these questions is simple. Think of a task, for example, you want to control your robot as line following robot as well as table top edge avoiding robot. Then you will have to think logically and work out the code as follows –

  1. To control your robot as line following robot, you require two IR sensors.
  2. Now to control your robot as obstacle avoiding robot, as well, you need third IR sensor.
  3. It means that this task requires 3 IR sensors in total.
  4. Ok. Now we shall name these three IR sensors, in our code, as say, LS – left sensor, MS – middle sensor and RS – right sensor.
  5. We shall fix LS and RS horizontally, that is they will sense the black track below them.
  6. We shall fix MS vertically between the LS & RS such that MS is projecting quite outward, as compared to LS & RS, to detect the obstacle in front of it.
  7. This is our hardware setup.
  8. Now we shall discuss about the code.

How to write the code?

This task is not very complicated. What you need is the systematic and logical thinking. First we shall write the truth table about our required task.

  1. We have three IR sensors and they work on binary style.
  2. So, in all, we can have 8 possible combinations of the 3 IR sensors, as follows.

Download this truth table to understand the conditions, and how to implement them in your robotic program.

Click this link to download the truth table

You may like this!

The multipurpose robotic code project for your kit, on this link.