65.9K
CodeProject is changing. Read more.
Home

Smart Broom as an Adaptive Autonomous Machine

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.63/5 (7 votes)

May 29, 2006

CPOL

2 min read

viewsIcon

28229

downloadIcon

291

An article about smart devices and adaptive autonomous systems

Sample Image - Smart_Broom.jpg

Introduction

An Adaptive Autonomous Machine can be described as a machine which is able to move in an unknown place and complete some specific tasks which were defined before the discovery. These systems can behave as humans and help us with difficult duties after they are programmed. One of the difficult duties of everyday life is house work. The aim of the project is to program a machine which can clean a house as a smart broom and consider the performance of different algorithms.

While a smart broom project is coded, there are a few difficulties which should be observed. They are deciding how to behave when meeting a barrier, updating the map of the house and finding the next movements.

One of the pivotal points of the project is barriers. There is a lot of furniture in a room such as wardrobes and sofas which can be considered as a barrier by the system. Despite the fact that the barriers prevent a broom passing the next step, the cleaner should not be stopped from doing the task. Because of this, the system should be programmed to recognize barriers. The sensors can help a device to be acknowledged about the current situation.

Another important handicap is updating the map. The map of a house or a room should be updated after every step. There are plenty of algorithms as a solution to this problem. Eight Neighbor Kernel Laplace (8-NKL) is one of the simple solutions. The project is developed to use two kinds of algorithms, 8-NKL and 4-NKL.

The last scope is finding the next step. After every step, the broom should be deciding the next direction to move. Finding the least visited neighbor should be one of the convenient methods, which is programmed in the project.

However, Smart Broom Project has only little to offer you about adaptive autonomous machines. It is easy to understand a simple smart device. In the near future, smart systems and their projects will be more popular.

Using the Code

The project includes one form and also one user control. When the project runs, the load of the form generates a matrix which can symbolize the area which will be cleaned by the broom. The matrix is created by a user control which is inherited from a simple button with extra properties such as X and Y coordinates. After the matrix is created, all of the matrix objects will be added to a datatable which will help us to easily find an object and its properties.

User Control

public class ExtButton : System.Windows.Forms.Button
{
private int m_X;
private int m_Y;

    public ExtButton()
    {}
     public int X
     {
      get {
             return m_X;
      }
      set {
        m_X = value;
      }
     }
     public int Y
     {
      get {
        return m_Y;
      }
      set
      {
        m_Y = value;
      }
      }
}

There are two kinds of algorithms to find the next movement in the project, Eight Neighbour Laplace Kernel (8-NLK) and Four Neighbour Laplace Kernel (4-NLK).

private void BtnLapKernelEight_Click(object sender, System.EventArgs e)
    {
             int nextNodeX=0,nextNodeY=0,Minnvalue=0;
             curX=0;
        curY=0;
        Random rnd = new Random();
        if (AnyNonVisited())
        {
        int total=0;
        int consNeig=0;
        int nvalue;
        int i,j;
        int avg=0;
        Minnvalue=100;
        for (i=-1;i<2;i++)
        {
            for (j=-1;j<2;j++)
            {
                if (!((i==0) && (j==0)))
                    {
                        nvalue=FindValue(curX+i,curY+j);
                        if (nvalue!=-1)
                            {
                            if (Minnvalue>nvalue) {
                                Minnvalue=nvalue;
                                nextNodeX=curX+i;
                                nextNodeY=curY+j;
                                        }
                            total+=nvalue;
                            consNeig++;
                            }
                    }
            }
        }
        avg=(total/consNeig) + 1;
        addNewValue(curX,curY,avg);
        markTheNode(curX,curY,false);
        curX=nextNodeX;
        curY=nextNodeY;
        markTheNode(nextNodeX,nextNodeY,true);
        }
        this.timer1.Enabled=true;
        this.timer1.Start();
    }