This is the third assignment of the Research Track 1 course. The target of the project is to drive a robot in a 3D map, thanks to a Python code. Furthermore the user can control the robot, choosing one of the following choices:
- provide the robot with coordinates x and y that it reaches automatically
- drive the robot by the keyboard
- drive the robot by the keyboard avoiding obstacles
You have to download the repository from https://github.com/CarmineD8/final_assignment.git (github.com) and https://github.com/CarmineD8/slam_gmapping.git (github.com).
After downloading and building the environment, make the ' .py ' file executable with the command:
$ chmod +x <name_of_the_script>.py
To run the simulation use the following command in three different terminal:
$ roslaunch final_assignment simulation_gmapping.launch
$ roslaunch final_assignment move_base.launch
$ roslaunch a_assignment3 a_launch.launch
Now you can see the robot starts to move in the environment.
The logic behind the code is shown in the attached flowchart.
So you have the script ' a_launch.launch ' which contain ' controller.py ', where you can find the functions to manage each user choice, and ' case_2.py '.
There are 4 type of choices:
-
if the user select the first choice, he must enter X and Y coordinates with which the robot can move towards a defined position; moreover the code is able to show a message which inform the user if the target is achieved or not
-
if the user select the second choice, the code called the function ' teleop_twist_keyboard ' which is the main responsible of the robot's moves
-
if the user select the third choice, the code called the function ' teleop_twist_keyboard ' which is the main responsible of the robot's moves, plus the collision handler which allow to the robot to avoid obstacles and proceed along the path smoothly
-
in the last choice, the user simply close the whole program.
This assignment relies on some software facilities, like:
-
Gazebo, which is an open-source 3D robotic simulator integrated into ROS that has the ability to accurately simulate robots in indoor and outdoor environments. In particular, in this case, the robot surfs in a group of rooms delimited by walls. For controlling the robot I need some topics like ' /scan ' (topic on which the simulation node publishes the output of the robot laser scanners) and ' /cmd_vel ' (topic to which the simulation node is subscribed in order to receive commands to set the robot linear and angular velocity).
-
Rviz, which is a 3D viewer and It interacts with Gazebo
-
slam_gmapping (node), which is the node that implements a simultaneous localization and mapping (SLAM) algorithm
-
teleop_twist_keyboard (node), which is a GUI (Graphic User Interface) that allows the user to drive a robot by the keyboard.