Triangulation

In aviation, pilots can use two non-directional beacons to triangulate their position. The instrument that tells us the heading of the beacons on an airplane is called the Automatic Direction Finder (ADF). If you have two IR beacons, you can do a similar thing with just one IR sensor mounted on your robot. One disadvantage of the heading indicator from the beacon is that the values are not in the degrees that the Gyro Sensor uses. Still, with some effort you can use two beacons to do some basic triangulation.

In the following program, we use two IR beacons. Each beacon is set to a different channel. Set the first beacon to channel 1. Set the second beacon to channel 2. The IR sensor should be on the front of your robot. Choose a location that you want the robot to navigate back to and place your robot at that point. It is helpful to angle the beacons towards the robot. When you run the program, the robot will first turn towards beacon 1 and take a proximity measurement. Then the robot will turn towards beacon 2 and take a proximity measurement.

The value of the proximity measurement can change with the heading of the robot, so you do need to have the robot pointed straight towards the beacon for reproducible results. After you have done this, the robot can be moved to another location. After a brick button is pushed, the robot will navigate back to its original position.

Triangulation

Since this is a complex program, we will use My Blocks to make it easier to follow. In the preceding screenshot, you can see the first two My Blocks, IRB1 and IRB2, which will record the proximity measurements of the two beacons. The robot then waits for a brick button to signal that it has been repositioned. We then enter a loop where My Block Seek1 commands the robot to turn towards beacon 1, and then move toward it. Although we do not know the exact location of the robot, we know it is on a circular arc near beacon 1. Next, in My Block Seek2, the robot turns towards beacon 2 and then moves towards beacon 2. This loop repeats itself four times, which should be enough to reach the original location.

Let's now examine the program inside each of the My Blocks that will record the proximity measurements of the beacons.

Triangulation

In the preceding screenshot, we can see the program inside of My Block IRB1. The robot begins by turning towards the infrared beacon, which is set for channel 1. The robot only turns and does not move towards the beacon. The loop stops when the robot is facing the beacon. The robot will then pause (to make sure there is no motion) and store the proximity value from the Infrared Sensor to the Variable block Distance1. The robot will announce with the speaker that it has detected the first beacon. In the following screenshot, we can see a similar program inside of My Block IRB2. The main difference is that the sensor block is set to channel 2, and the value is stored to the variable Distance2.

Triangulation

We will now examine the program inside each seek My Block that will navigate the robot back to the original position.

Triangulation

As we can see in the preceding screenshot, our Seek1 My Block begins with a loop, which is similar to the previous My Blocks. The robot starts out by turning towards the beacon. When it is facing the beacon, the robot pauses to allow it to come to a complete stop. The robot will then move forwards (or backwards) proportionally to the error between the proximity value of the Infrared Sensor and the distance Variable block. In the following screenshot, you can see the Seek2 My Block. The only difference is the channel for the sensor block and the Variable block.

Triangulation

If you were to combine the information of the Gyro Sensor and the Infrared sensor, you would have an even more powerful tool to navigate a course. The Gyro Sensor would allow you to know along which radial your robot is positioned relative to the beacon.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.162.26