Control of a robot in a simulated environment.
An overview of this program function.
Go to Introduction
A rapid description of how the program works (pseudo-code).
Go to How it works
How install and run this program in Linux.
Go to Installation and Execution
How this program could be improved.
Go to Improvements
This program manage a robot, endowed with laser scanners, which should move autonomously inside a circuit.
You can use the robot controller to:
- Increase the linear velocity;
- Decrease the linear velocity;
- Stop the robot;
- Reset the robot to the initial position.
The circuit is this one:
There are 3 packages:
- second_assignment: contains the map of the circuit.
- second_assignment_node: contains 2 source files .cpp
- robot.cpp: controls the robot to follow the ciruit avoiding the borders; for this task it reads data from laser scanners (base_scan topic), compare them (on the left and on the right) when it is too close to an obstacle (in front of its) and choose the direction where there is more space; it also publishes the new linear velocity (managed from the user interface provided by robot_controller node) in the cmd_vel topic.
- robot_controller.cpp: provides the user interface to digit commands and sends them to the service (server.cpp).
- second_assignment_server: contains the source file server.cpp that provides a service that takes in input the requested command from the robot_controller node, and execute the corrisponding task; Robot.srv is the file used by this service.
Look the pseudocode files into the corresponding directories for more details.
First of all download into your ROS workspace the current repository opening the terminal and typing:
git clone https://github.com/simone-contorno/rt-assignment-2
Move the folders into the src directory of your ROS workspace.
After, go into the root folder of your ROS workspace and type:
catkin_make
Afterwards type:
rospack profile
Now, open 5 terminals; in the first one run ROS core:
roscore
In the second one run the node to visualize the map:
rosrun stage_ros stageros $(rospack find second_assignment)/world/my_world.world
In the third one run the service node:
rosrun second_assignment_server server
In the fourth one run the robot controller node to manage the robot through the user interface:
rosrun second_assignment_node robot_controller
In the last one run the robot node:
rosrun second_assignment_node robot
To improve the robot performance, it could be done an improvement to mantain better the robot in the center of the path.
Thanks to have read this file, i hope it was clear and interesting.