Search code examples
rosgazebo-simu

How do I delete a ros/gazebo-simulation completly


I have a kinda weird problem. I'm currently messing around with the VRX-Simulator, which simulates an unmanned-watersurface-vehicle.

For the installation I followed the guide on https://bitbucket.org/osrf/vrx/wiki/tutorials/SystemSetupInstall.

Then I tried to modify some of the files and tried to rebuild the project. This was the point when I noticed it always used the "old" version of my simulation within gazebo.

From now on no matter what I did (I even deleted the whole catkin workspace folder) ROS somehow managed to always launch the original version of my simulation even without any build/src folder existing when I used roslaunch.

roslaunch vrx_gazebo sandisland.launch

So my question would be how can I get rid of my simulation/model and where does ros/gazebo cache my simulation?


Solution

  • You most probably installed the package with the command from the tutorial sudo apt install ros-melodic-vrx-gazebo. So the package launched with roslaunch vrx_gazebo sandisland.launch was not in your catkin workspace. If you want to get rid of it you can uninstall it with sudo apt remove ros-melodic-vrx-gazebo. But this is not strictly necessary.

    There are several ways to find out where some ros package is located, try running some of these commands:

    rospack find vrx_gazebo will show you where the package used is located

    roscd vrx_gazebo will take you to the folder where it is installed something like

    /opt/ros/melodic/share/vrx_gazebo

    If you also followed the tutorials installing from source code then the issue most likely was not sourcing the built packages. The last line of the guide is a bit misleading. The line *Remember to run this command every time you open a new terminal. is meant to reference the command source ~/vrx_ws/devel/setup.bash

    Whether the installed package or the package built from source is used depends on which order they are listed in the environment variable ROS_PACKAGE_PATH. This variable is modified by both source /opt/ros/melodic/setup.bash and source ~/vrx_ws/devel/setup.bash. So have a look at the variable after each step with printenv | grep ROS or echo $ROS_PACKAGE_PATH. Theoretically if you source your terminal in the order I had the source commands it should be using the package built from source, you can verify with the rospack find ... and roscd ... commands mentioned earlier.

    In the end it is probably easier to add the sourcing commands to your .bashrc file so you would not forget to source the terminals as mentioned in the ROS installation tutorial. You can add the sourcing of the workspace to the the same file, you will just have to be aware that you would need to change the file, should you want to use a different workspace.

    http://wiki.ros.org/melodic/Installation/Ubuntu#melodic.2BAC8-Installation.2BAC8-DebEnvironment.Environment_setup

    relevant command from the tutorial:

    echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

    you could do the same for the workspace:

    echo "source ~/vrx_ws/devel/setup.bash" >> ~/.bashrc

    And after running those commands run exec bash to get the changes into the current terminal. All future terminals will have those commands already loaded.