Using the Simulator#
![_images/gazebo.png](_images/gazebo.png)
![_images/simulation_demo.gif](_images/simulation_demo.gif)
Installation & Setup#
In the official guide the installation is explained in more detail, here we have only the sequence of commands.
Installing ROS Noetic Ninjemys#
sudo apt install curl # if you haven't already installed curl
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install ros-noetic-desktop-full
ROS Environment Variables#
To use ROS we need to:
source /opt/ros/noetic/setup.bash
Simulator setup#
In the desired folder, clone the simulator repository:
git clone https://git.fe.up.pt/beeplearning/simulator.git
Then in the Simulator
folder (cd Simulator
) run:
catkin_make --pkg utils
catkin_make
And add the following lines to the ./devel/setup.bash
file (gedit devel/setup.bash
), while replacing {YOUR_USER}
by your ubuntu username:
export GAZEBO_MODEL_PATH="~/Documents/Simulator/src/models_pkg:$GAZEBO_MODEL_PATH"
export ROS_PACKAGE_PATH="~/Documents/Simulator/src:$ROS_PACKAGE_PATH"
So that we do not need to run source
every time, we can automate this by making the bash shell run that command every time it is launched:
echo "source ~/Documents/simulator/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
Giving execution permissions#
In the root of the repository:
chmod +x src/sim_pkg/launch/bash_scripts/delay.sh src/example/src/camera.py src/example/src/control.py
Fixing Memory Issues#
Reducing the size of the texture used for the track#
In the file ./src/models_pkg/track/materials/scripts/bfmc_track.material
, change 2021_Big.png
to one of the options in ./src/models_pkg/track/materials/textures
(2021_Big.png
, 2021_Medium.png
, 2021_Small.png
, 2021_VerySmall.png
).
Disabling Gazebo GUI#
In the file src/sim_pkg/launch/map_with_all_objects.launch
change <arg name="gui" value="true"/>
to <arg name="gui" value="false"/>
.
Running the Simulator#
Do not forget to always do the following before running (only necessary if you did not add this command to your .bashrc
):
source devel/setup.bash
Then to launch the simulator:
roslaunch sim_pkg map_with_all_objects.launch
To launch our nodes:
rosrun example camera.py
rosrun example control.py
(The nodes are located at Simulator/src
, i.e., example
is a folder in that directory.)