Close
0%
0%

Robot Positioning Module

In this project I will try to develop a positioning system for a robot. I will start with explaining the mathematical basics.

Similar projects worth following
Knowing the position of a robot in my opinion is one of the interesting aspects during the development of robots. As I like to play with mathematics, electronics, optics and 3D printers I thought a combined effort in these areas would be interesting.This project is based on an old article by Richard T. Vannoy in Seattle Robotics' Encoder (http://www.seattlerobotics.org/encoder/200109/lasernav.htm). I already tried to program this approach in Visual Basic just for fun in 2004, but in the meantime a lot of interesting new developments like Arduino's have entered the market, so now it's about time to try this in real life!

The starting point of this positioning module is that we have three Infrared emitters located on three edges of a rectangle:

Our robot is located somewhere in this rectangle:

On the top of the robot a IR sensor rotates 360 degrees and detects the angle between the three IR transmitters:

Please realize that Angle 3 will not be used in the calculation, but will disturb an easy positioning, I will come to that in a later stage when I start programming the Arduino!

To calculate the position of the robot one must realize that the robot has to be on the interception of two circles (on one circle there is the robot and the IR emitter at (0,0) and one other IR emitter, on the second circle is also the robot and the (0,0) emitter and the remaining IR emitter):

Now it's time to  do some mathematics!

To calculate the center of the right circle we first calculate it's radius:

R1=(XL/sin(Angle2))/2; where XL is the distance between the IR sources on the horizontal axis.

It will be obvious that the X position of the circles' centre will be halfway the bottom two IR emitters:

 X1=XL/2

Now the Y position of the centre can be calculated using Pythagoras: (R^2=X^2+Y^2 --> Y^2=R^2-X^2 -->)

Y1=sqrt(R1^2-X1^2)

The same can be done for the other circle:

R2=(YL/sin(Angle1))/2
Y2=YL/2
X2=sqrt(R2^2-Y2^2)

OK, now we know the centres of the two circles, how to find the intersection of them? In fact that is simple; we have to find the equation of the line connecting both centres (Y=MX+N):

M=(Y2-Y1)/(X2-X1)
N=Y1+((Y1-Y2)*X1)/(X2-X1)

The robot will be at a line from (0,0) perpendicular to this line:

The directional coefficient of this new line will be:

DC=-1/M

The second line does not have a Y offset as it goes through (0,0), so it's function is Y=DC*X

We now make the two functions equal to each other to find the X value of the intersection of the two lines:

M*X+N=DC*X --> 

Xintercept=-N/(M-DC)

The X position of the robot will be at twice the X position of the intercept:

So 

XRobot=2*XIntercept

and the using this X position in the function of the last line gives:

YRobot=DC*XRobot

20180428_171517.mp4

Rotating IR sensor prototype

MPEG-4 Video - 12.61 MB - 05/03/2018 at 12:46

Download

  • Problem with sequences...

    middelbeek05/07/2018 at 10:04 0 comments

    To check the approach, I wrote a small program that performs the calculations and detected a serious problem with my approach.
     
    While the IR sensor scans the area, the program cannot differentiate between the three transmitters. This means that Transmitter 1, 2 and 3 might be found in that sequence, but also in the sequence 2, 3, 1 or 3, 1, 2 as can be seen in the picture below.

    Luckily not all angles result in valid robotpositions; the angle between transmitter 1 and 2 cannot be smaller than 45 degrees and it cannot be larger than 180 degrees. The same for the angle between transmitter 2 and 3, and the angle between transmitter 3 and 1 must be 360 - Angle1 - Angle2, and can never be smaller than 90 or larger than 270 degrees.
     
    Alas, quite a lot of combinations prove to result in valid robot positions..

    As an example, suppose the first angle the module finds is 108 degrees, the second angle is 135 and the third angle is 117. This would result in a robot position at (15,23).
    If the angles were found in the sequence Angle2, Angle3, Angle1 however, the sequence would become 135, 117 and 108, which would result in a position of (15,12). The same holds for the sequence 117, 108 and 135 which would position the robot at (30,27).

    A couple of solutions for this problem can be used, but I still have to decide what would be the most promising.....

    I am thinking of using a magnetometer to find the orientation of the robot, or any trick that ensures the scanning always starts at IR transmitter 1. 

    Not sure yet....

  • Rotating IR sensor

    middelbeek05/03/2018 at 12:37 0 comments

    The first thing to do is to find/develop/build a rotating IR sensor. As I want to have a frequent update of the position of my robot, I prefer to have a sensor that continuously rotates, and not a system that scans 360 degrees, then turns 360 degrees the other direction and starts all over again, which should be necessary due to the twisting of the cables. I could not find an easy, affordable rotating connector, so I had to find another solution.

    One approach could be a 180 degrees video camera connected to a Raspberry Pi, and using some qiute complicated image analysis finding the IR emitters and calculate the angle between them. This can be done, but has the drawback of being complex, energy consuming and relatively expensive.

    For this reason I designed an IR sensor that is facing upwards towards a rotating mirror that is under an angle of 45 degrees. A modified servo is used to rotate the mirror. 

    In this way the sensor has an undisturbed view over the surrounding area, undisturbed by cables etcetera.

    During one rotation of the mirror the sensor should "see" my three IR emitters, and based on time differences the angle between them can be calculated.

View all 2 project logs

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates