Room Navigation

Teach Sparki how to move freely around the room.

SparkiDuino
Hard

Introduction

Room navigation can be a complex task for a mobile robot. There are a lot of different approaches to program a robot to let it “know where it is”, or to go from one room to another one. These are the basic problems of mapping / localization and navigation. When them are put together and done at the same time, their are called Simultaneous Localization And Mapping, or SLAM. We will try to learn a few basic concepts in this lesson, that will help to enable our little Sparki to move on a small house-like environment. But for simplicity, we will also rely on some previous knowledge about the rooms where Sparki is going to navigate, as well as some marks that we will add to the environment to make the work easier for our robot.  

What You’ll Need

  • Sparki.
  • The rooms to be navigated by Sparki. We will show you soon how to make a simple cardboard house for this.
 

The Rooms

We will need the rooms where Sparki will navigate. Of course, you can always design your own house for Sparki to navigate in, but we will see in this section one possible way of making them with cheap and widely available materials, and also with a geometry which should be friendly to our little robot. Here is the idea: And these are some possible dimensions, which takes into account parameters like the robot’s size, and other constraints: The above image can be downloaded, since it has higher resolution than the shown on this wab page. As you will see in the following steps, the Home marks are just that: marks (more on this soon). The other black lines on the image are walls, which will be made of cardboard. The walls should have an 11 cm tall as a minimum, to ensure that the robot’s ultrasonic range finder detects them. It may be convenient to start building the external walls: The following pictures shows that it may be convenient to cut the walls a bit longer than needed. This will allow us to fold them, with the help of a small cut which does not pass the cardboard thickness: After gluing the parts, you can use clips to hold them while the glue dries: Here you can see them together after having glued them: Please note the small triangles added as reinforcements for the structure: Finally, to ensure that the line Infrared Reflectance Sensors will work properly,  white paper should be used to cover the floor. We will add some black marks to the doors, using insulating black tape: And finally, here is how our small robot’s house looks: As you can see in the following picture, the robot has space enough to cross a door, even if it’s not when centered against it:  

Robot’s Home

One of the really important aspects here is that we need to define a coordinate system for the house. And it will be a 2D Cartesian one. Or course, to do that, we need to define an origin: the point labeled (0, 0) (where both x = 0 and y = 0). Here is the coordinate system that we are going to use along this lesson: So the most left-bottom corner is our (0, 0) point, while the home cross mark is going to be centered on the (10, 10) point. It’s good to note that the units that we are using are centimeters (cm). The cross mark is not something that the robot needs to detect, but it’s just a mark that we can see through the robot’s marker holder to help us position the robot at the beginning of each activity, as shown in the following picture: You can measure the 10 cm from each side easily and draw the (10, 10) mark with a pen: But there is a black mark that we will add to be detected by Sparki’s IR sensors. This one will help the robot to automatically center itself on start. We have used black insulating plastic tape. But please note that it’s half the width (we have cut the tape by the middle). This is important because if this mark is too wide, the centering algorithm will not work properly. In the following picture you can see the difference between this thin line and the mark on a door (which was made with the same tape, but keeping it original width): As can be seen in the image above, the mark is centered on the cross on the X axis and separated by 4 cm on the Y axis.  

Other Important Parameters

##Under construction: Rules for making an easy to navigate Sparki’s home.  

Robot’s Homing

Now that we have a house with rooms and an univocal coordinate system, let’s start programming the robot to navigate through it. Our first task will be to place the robot at the home point, but giving to Sparki the ability to determine if it’s at the right initial position by himself. Warning_Triangle Please remember to check that the batteries are properly connected (and charged!). And as we are going to use the motors here, please check that the On/Off Switch is on. Another important thing to take care of when playing with the robot’s motors is to be careful not to be working over a table. A fall from that table could permanently damage your Sparki. ##

##  

Basic Room Measurements

##

##Under construction/  

Now that our robot has some basic data of the room where it is, let’s try to do a very simple Cartesian  moving routine. Since the Sparki features relatively precise movements due to its stepper motors, we can try to make it move blindly (without any sensor feedback to determine the position). But after experimenting a bit with the real robot, we will soon realize the problems that emerge when we do not grab information from the sensors to correct the position.  This technique, which consists basically on calculating the current position based on the data from the previous one is called dead reckoning. And although it could give us an estimation of the current position, it has the severe drawback of an intrinsic accumulative error. So, let’s try to move our Sparki to the middle of the room by just using the information from its motors: ##Function explanation here. As you can see in the setup function we are trying to move the robot to some positions or waypoints (the middle of the room being the first of them) and then going back through the same waypoints to the home again. If you try the example you will get noticed of the cumulative error from this dead reckoning navigation technique when the robot comes back to the home point.  But why not experiment a bit more with this issue, repeating 3 times the same movements? Here is the code for the setup function: See the problem? Some of the sources of errors are:
  • Discretization: ##.
  • Differences between the physical robot and it’s software model: ##.
  • Round errors: ##.
  • Sensing errors: ##.
 

##Under construction  

Finding Doors

##Under construction. ##Under construction.  

Basic Room Navigation

##Under construction.  

Extra Activities

  • ##