Gazebo 3D simulator example of ROS tutorials (version: Noetic)
Tested on Ubuntu 20.04
For more details, see https://www.bilibili.com/video/BV1da411j72x
sudo apt install ros-$ROS_DISTRO-gazebo-ros-control
sudo apt install ros-$ROS_DISTRO-effort-controllers
sudo apt install ros-$ROS_DISTRO-joint-state-controller
sudo apt install ros-$ROS_DISTRO-driver-base
sudo apt install ros-$ROS_DISTRO-ackermann-msgs
sudo apt install ros-$ROS_DISTRO-rtabmap-ros
sudo apt install ros-$ROS_DISTRO-teb-local-planner
sudo apt install tcl-dev tk-dev python3-tk
- Create a project workspace
mkdir -p ~/racecar_ws/src
- git clone and compile it
cd ~/racecar_ws/src
git clone https://github.com/soonuse/racecar.git
cd ..
catkin_make
- Setup .bashrc
echo "source ~/racecar_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
- Start the gazebo map
roslaunch racecar_gazebo racecar_runway.launch
You should download the gazebo models or the map won't work.
git clone https://github.com/osrf/gazebo_models.git ~/.gazebo/models
- Open a new terminal and start rviz
roslaunch racecar_gazebo slam_gmapping.launch
Control the car with WASD keys and draw the whole map.
- Save the map
rosrun map_server map_saver -f ~/racecar_ws/src/racecar/racecar_gazebo/map/map_runway
- Start navigation and the gazebo map
roslaunch racecar_gazebo racecar_runway_navigation.launch
- Start rviz
roslaunch racecar_gazebo racecar_rviz.launch
-
Click
2D Nav Goal
then click the goal on the rviz map (hold down the cursor to set the goal pose) -
Start the navigation script
rosrun racecar_gazebo path_pursuit.py
- find OpenCVConfig.cmake
sudo apt install locate
sudo updatedb
locate OpenCVConfig.cmake
- edit CMakeLists.txt and replace OpenCV_DIR with the correct OpenCV path replace this line
set(OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev/)
with the correct OpenCV path