I have a mobile robot and I would like it to follow the walls of a room.

I have:

  • A map of the room.
  • Wheel encoders for the odometry.
  • A Kalman filter for fusing data from wheel encoders and IMU.
  • A Hokuyo lidar for localization and obstacle avoidance
  • A Kinect to see obstacles which can not be seen by the Hokuyo.
  • Amcl for localization.
  • A couple of sharp sensors on the side for wall following.

I am not planning to use the global or local costmap because the localization of the robot is not perfect and the robot might think that it is closer (or further away) to the wall than it actually is and therefore, wall following might fail. So, I am planning to just use the data from Hokuyo lidar and sharp sensors to do wall following and maintain constant distance from the wall (say 10 cm).

Now, I would like to know what is the best technique for doing wall following in this manner? Also, how can one deal with the issue of open gaps in the wall (like open doors, etc..) while doing wall following using the above approach?

I know this is a very general question but any suggestions regarding it will be appreciated. Please let me know if you need more information from me.

I am just trying to do wall following in a given room (I have the vertices of the room in a global reference frame) For example, Lets say I have a map of a room (shown below). I want to make the robot follow the wall very closely (say 10 cm from the wall). Also, if there is an open space (on bottom left), the robot should not go in the adjacent room but should keep on doing wall following in the given room (For this, I have the boundary limits of the room which I can use to make sure the robot is within the given room).
The approach which I am thinking is to come up with an initial global path (set of points close to the wall) for wall following and then make sure robot goes from one point to the next making sure that it always maintains a certain distance from the wall. If there is no wall, then the robot can just follow the global path (assuming localization is good). I am not sure about its implementation complexity and whether there is a better algorithm/ approach to do something like this.

enter image description here

  • 1
    $\begingroup$ You ask for "wall following" - is this a maze? Are you trying to get to some specific location? It sounds like wall following is a specific solution for a problem. What is the problem you are trying to solve? It sounds like you're just looking for a localization algorithm but it's not especially clear to me from your question. $\endgroup$
    – Chuck
    Commented Aug 26, 2015 at 15:26
  • $\begingroup$ This can be any room and I am just trying to follow the wall of that room. I am using ros and the amcl localization algorithm which is working pretty good. I just want to make sure the robot follows the wall accurately and avoids the obstacles close to the wall. I have updated my original question. $\endgroup$ Commented Aug 26, 2015 at 15:41

1 Answer 1


For a first attempt I would suggest constructing an angle histogram. See page 188-191 of this (old but still useful) reference: http://www-personal.umich.edu/~johannb/Papers/pos96rep.pdf

In other words, construct straight line segments representing parts of the wall from your scan points. Then identify the nearest wall and estimate its direction from the histogram, or perhaps by directly taking scan points along that region of the wall and making a least squares fit or some other average.

Once you have an approximate straight line for the wall, it should be possible to produce a turn command for the vehicle to steer itself.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.