The patrol behavior is a behavior that makes the robot move around a specific area indefinitely while avoiding the obstacles in it. This means that the robot must be moving, while making sure it doesn't get stuck or it hits any obstacle, the entire time.
Create services servers.
Create actions servers.
Create custom message interfaces.
Get TFs.
In this first part of the project, the robot need to find the angle without obstacles in front, for that we check each lidar point and the one that has the longest distance is choose as the angle to rotate.
Cmakelist.txt for Custom Interface
Cmakelist file for generating a custom service and action.
Package.xml for Custom Interface
package.xml file for generating a custom service and action.
In this part, a ROS Service that tells the robot what to do is created. Â The goal in this section is to create a ROS Service that, when called:
It receives the laser data captured by the sensor
It analyzes the laser data received
Based on this data, it tells the robot to go left, front or right
The goal of this part is to create an action server that allows to send the robot to a certain position, so it can be used later to manually navigate the the robot around the environment. The action server will receive a Point32 message as a goal. This Point32 will define the goal position [x, y, theta] for the robot.
As feedback, the action server publishes the current position of the robot [x,y,theta] every second. When the action finishes, the result will return a boolean with True indicating the action finished correctly.
All the part of the project were first tested on the simulated environment.
Autonomous patrolling
Action goal point
The videos below compare the simulation vs. the real robot, when navigating and avoiding the obstacles using the service method.
Service patrolling
Real demo