ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I am new to ROS myself but in past, i have made a wall following robot using arduino that used PID controller. There are two things to consider- 1) if you are using a single ultrasound sensor which is not directly perpendicular to the wall, there is a chance that the sent pulse might not even return since it bounced off at an angle(law of reflection at an inclined surface). This is the reason why 2D lidars are better suited at mapping walls.

2) if you are using a sensor which is placed perpendicular to the wall, you should be able to write a PID script using the sensor input. Let's say you get the data on "/Laser" topic and you want to keep your bot at a certain distance x form the wall. So now, you have the goal signal, i.e. x and the position signal, i.e. /Laser. now you can use pid ros package to either tune the bot manually using dynamic reconfiguration or use the autotune module for ros-pid package. Link- http://wiki.ros.org/pid

The method discussed here will allow the bot to maintain a certain distance from the wall but if you want to keep it moving along the wall, you have to give additional rewards like increase the x pose of the bot. This can still lead to oscillations since you are using only one ultrasound sensor. If you want finer results, use two sensors. One at the front of the bot and other at the back of the bot, both facing the wall. (allow keep a small error window, else the bot might oscillate)