For this
update, we will program the robot to find a "Home"
position in the robot arena, defined as any point within its
boundaries which the robot can fit, and the robot will travel
to no matter what its initial position or orientation within
the arena at the start. Why is this such an important task? This
is because to do a task, such as watering the plants or checking
the status of the cats food dish we need to be able to send a
robot to a precise location within its work space, and then it
can use fine tuning sensors to move in to its exact position
it needs for its primary function. How it gets its positioning
information can be done many ways, but once it gets that data
it must deal with it and go to its destination. This demonstration
is I am using the robots sonar to detect the edges of the robot
arena using its on board compass to locate the directions of
the correct walls. It then has its current position. A future
setup may use Lidar, beacons, or ceiling mounted transmitters
to do this exact same function. For now, we use the sonar, with
no obstructions in the arena.
Finding your current
location
| The
arena is mapped with an X, Y coordinate grid along its bottom
and left edge. A point the robot can fit well into is designated
Home. This is X = 10, Y = 11 or half way up and 10 inches from
the left side. This is where the robot must park itself within
a tolerance to consider itself in the home position. Lets start
with a photo of the Arena, which is 24 inches tall and 48 inches
wide. The "Home Position is marked here. The robot will
be able to get within only an inch of its very center over the
mark. This is due to three sources of error. The first is the
sonars data is converted to integer value inches, and cannot
do fractional amounts. So it rounds it to the nearest inch. Secondly,
the robots wheels do not travel at exactly the same speed and
irregularities in the floor make this impossible anyway in the
real world. So its 90 degree turns are accurate in an angular
sense, but it pivots around a point not under the center of the
robot by about an inch. Finally, when the robot travels straight,
irregularities in the floor surface cause final position errors
over the full distance of the arena. Also the robot can only
move full speed or not at all. This causes the robot to sometimes
over shoot its target by about an inch. The final errors accumulate
such that we are typically about an inch off. This is perfect
however for the initial travel and a series of fine adjust sensors
will set it exactly on target later. |
| The
home position. |
| The
robot is set in the arena in a random location, pointing a random
direction. |
| Next
upon power up, the robot uses its Devantech digital compass to
point at 48 degrees, the direction of the east end of the arena.
It takes a distance reading with the sonar, and the reading is
converted from a pulse width to integer inches for the X value. |
| The
robot rotates to north in the exact direction of the side of
the arena, and takes a Y axis distance reading with the sonar.
It now knows it current position. |
| Next
we rotate back along the X axis, then start to travel forward.
The sonar is read continuously and the robot will stop when the
X value is 10. |
| The
robot is moving along the X axis counting the distance down.
If it was left of the home position, it would be moving backwards
and doing the same thing. |
| The
robot stops at X=10 or whatever point it is told to do or next
in its list of coordinates. |
| Rotation
at Y axis to measure its position. It will then travel forwards
or backwards to reach the correct Y value of Y = 11. |
| After
the Y value is achieved, the robot turns to its final docking
position. It is sitting right over the mark! (within an inch
in numerous trials.) |
Movie
1 click here | Here is a small movie clip
(160 x 100 mpeg) showing the robot in action finding home. turn
up your sound to hear my narration! |
Movie
1 click here | This time Im am putting
the robot in the other corner, on the other side of the Home
position. Home is now to the right and the robot must deal with
small spaces in this part of the arena. |
Conclusion.
This simplified
procedure will work in any square environment, or in one that
has a method to read the X,Y coordinates in a rectangular work
space. We move on from here, making the work areas more complex
and using path planning to shorten the robots path to its goal.
(maybe the first plant to water!)
|
|