- Table of Contents
- Project Goal
- Mapping
- Logic and functionality
- Behavior Tree diagram
- Launcher
- Tests
- Team
- Licencia
The aim of this project is to create a ROS2 application in order to make able a robot to patrol around predefined waypoints.
- The robot must use Behavior Trees y Nav2.
- It is necessary to map the environment we will use.
- The robot must perform some action when it reaches a waypoint (display message, turn on itself,...).
This behaviour must work in simulator using the Tiago robot. In addition, the repository must contain a package with all the nodes, following the recommended indications and organization of repositories.
One of the principal steps in order to this project was to make the mapping. We decided to choose the house map due to performance reasons (we can see different rooms on this map where we can set the waypoints) and map size (house map is neither too small nor too big, making a fluid and expressive behaviour in the robot).
In the following video we can see the complete process of the house mapping: Alternative Link (Youtube)
TAYROS2_MAPPING.mp4
Once we had the house mapped, we use the rviz2 and the Publish Point tool to set the position of the waypoints we want the robot to follow. This clicked points in the rviz are published in the /clicked_point topic:
Once we have configured the waypoints coordinates in the code, it is important to take in consider some parameters of the br2_navigation package. In our case, we have to slightly increase the values of the xy_goal_tolerance of the general_goal_checker parameters in tiago_nav_params.yaml.
The reason is the following: when Tiago is too close of reaching a waypoint (e.g ~0.5 error from (x,y) waypoint coordinates, and the tolerance value is < 0.5), his velocity will be too small. That means that it will take some minutes in order to reduce the error to the waypoint coordinates. That is why we need to take a properly value for that params:
tiago_nav_params.yaml:
general_goal_checker:
stateful: True
plugin: "nav2_controller::SimpleGoalChecker"
xy_goal_tolerance: 0.75
Notice that some of the other parameters in the yaml file are also important. Take in consider if modifying this project repository.
The logic of this program is based on the one we saw as an example in class, which can be found in the following repository.
In addition, the display of camera images has been added to the patrol node. For this we have used the opencv library.
Snippet(opencv image sub):
image_sub_ = node_->create_subscription<sensor_msgs::msg::Image>(
"/head_front_camera/rgb/image_raw", 10,
std::bind(&Patrol::img_callback, this, std::placeholders::_1));
You can see the video demonstration here: Alternative Link (Youtube)
patrollingDemonstration.mp4
You can see the Behaviour Tree diagram made in Groot:
patrolling.launch.py:
def generate_launch_description():
patrolling_cmd = Node(
package='tyros2_patrolling',
executable='patrolling_main',
parameters=[{
'use_sim_time': True
}],
remappings=[
('input_scan', '/scan_raw'),
('output_vel', '/nav_vel')
],
output='screen'
)
ld = LaunchDescription()
ld.add_action(patrolling_cmd)
return ld
As we know that it is very tedious to configure the rviz parameters in order to recive the maps and costmap correcty, we provide you a correct configuration for it.
We attempted to create a test that would check the velocities of the robot. Unfortunately, we encountered an issue with a CV dependency that we were unable to resolve. As a result, we had to comment out the test.
We verify the correctness of each obtained waypoint by comparing them one by one.
The robot goes to a arbitrary point in a fake server, it should reach the point and return success.
(TayROS2)
This work is licensed under a Apache license 2.0