Simple simulation of a turtle bot moving within a maze. Algorithm developed using ROS2 and Python3
Inspired by the paper A Constrained VFH Algorithm for Motion Planning of Autonomous Vehicles
1 - Move to catkin workspace folder
cd ~/catkin_ws/src/
2 - Clone the repository
git clone git@github.com:oselin/vmc_project.git
3 - Copy the track file into the Gazebo folder
cp -r vmc_project/models ~/.gazebo
3 - Recompile CMakeLists file and source the folder
catkin_make
source ~/.bashrc
First of all, launch Gazebo with the chosen track
roslaunch vmc_project project_world.launch
Then, activate the VFH algorithm by running the script
rosrun vmc_project racer.py
If you want to see in real time how data is manipulated, run
rosrun vmc_project plotter.py
or
rosrun vmc_project plotter2.py
The designed node publishes two types of data
- velocity commands to the robot
- manipulated data, or VF histograms + occupancy map
Since the latter is a very big message (almost 5000 float32 values), to increase the perfomances the following workaround has been designed.
plotter.py
: builds the graphs basing on the complex and heavy message
plotter2.py
: reads LiDAR values directly from /scan
topic and performs the same data manipulation steps as in racer.py. That is to avoid a useless publishing on a custom topic
Since this data manipulation is quite complex, the computer cannot keep up with both manipulating data, publishing commands and manging real time plots.
This slows down all the computations, leading to a failure of the algorithm. Workaround: A cool way to see real time plots is to first record the LiDARS values with
rosbag record /scan
And then simulate data publishing, but this time running only the plotter. Therefore
rosbag play <your-recording>
And on a new terminal
rosrun vmc_project plotter2.py