Main Content

Install and Set Up Virtual Machine for ROS and Gazebo

R2026b

 This page provides installation instructions for the Virtual Machine (VM), which is shipped as a supplement to ROS Toolbox and Robotics System Toolbox™. The VM comes preinstalled with Gazebo and ROS, enabling MATLAB® and Simulink® to seamlessly integrate with the Gazebo robot simulator and an external ROS (Robot Operating System). It runs on Ubuntu® 20.04 and supports multiple platforms, including Windows®, Linux®, and Mac.

This graphic image below is a sample demonstration of connectivity between local host machine and remote device running Gazebo on VM.

This preconfigured VM image is designed to support examples in ROS Toolbox and includes the following:

Note

Starting R2025a, the VM image shipped with ROS Toolbox does not include any ROS 2 installation. For ROS 2 resources, refer to Install and Set Up Docker for ROS, ROS 2, and Gazebo.

Instructions for Platform-Based Virtual Machine Installation

    1. Navigate to broadcom.com and click Support Portal dropdown in the upper right corner of the window.

    2. To create a basic Broadcom account, click Register. If you already have an account, click Go To Portal and log in with your username and password.

    3. Once logged in, click the Software dropdown menu on the top left. Expand the VMware Cloud Foundation division and click My Downloads.

    4. Select VMware Workstation Player and choose the required version. Any version starting 17.0.0 or higher is recommended.

    5. Select the appropriate file under Primary Downloads or Open Source tab at the top of the installation section to download and install the VMware Player.

    6. Download the archive containing the VM shipped with ROS Toolbox and unzip it to a location on your hard drive.

    1. Download VirtualBox for Linux host and install it.

    2. Download the Virtual Machine to a folder on your hard drive.

    3. Launch VirtualBox and select Import Appliance... from the File tab in the toolstrip. This opens the Import Virtual Appliance dialog box.

    4. Expand the Source dropdown in the dialog box. and select Source as Local File System. Choose the downloaded VM image from the File browser and click open.

    5. Click Finish to add the VM to your library. This process can take a few minutes.

    1. Navigate to broadcom.com and click Support Portal dropdown in the upper right corner of the window.

    2. To create a basic Broadcom account, click Register. If you already have an account, click Go To Portal and log in with your username and password.

    3. Once logged in, click the Software dropdown menu on the top left. Expand the VMware Cloud Foundation division and click My Downloads.

    4. Select VMware Workstation Player and choose the required version. Any version starting 17.0.0 or higher is recommended.

    5. Select the appropriate file under Primary Downloads or Open Source tab at the top of the installation section to download and install the VMware Player.

    6. Download the archive containing the VM shipped with ROS Toolbox and unzip it to a location on your hard drive.

    1. Download VirtualBox for Linux host and install it.

    2. Download the Virtual Machine to a folder on your hard drive.

    3. Launch VirtualBox and select Import Appliance... from the File tab in the toolstrip. This opens the Import Virtual Appliance dialog box.

    4. Expand the Source dropdown in the dialog box. and select Source as Local File System. Choose the downloaded VM image from the File browser and click open.

    5. Click Finish to add the VM to your library. This process can take a few minutes.

This platform uses Virtual Box Player to run the VM because VMware Workstation Player is not available for Mac. If you have a valid license for VMware Fusion, you can follow the installation instructions for Windows instead.

Follow these steps below to set up VM with Virtual Box Player:

  1. Download VirtualBox for Mac host and install it.

  2. Download the Virtual Machine to a folder on your hard drive.

  3. Launch VirtualBox and select Import Appliance... from the File tab in the toolstrip. This opens the Import Virtual Appliance dialog box.

  4. Expand the Source dropdown in the dialog box. and select Source as Local File System. Choose the downloaded VM image from the File browser and click open.

  5. Click Finish to add the VM to your library. This process can take a few minutes.

Setup Instructions post Virtual Machine Installation

  1. Start VMware Player. In VMware Player, click Open a Virtual Machine.

  2. Browse to the location of the Ubuntu image, select the ros-noetic-gazebov11.vmx file and click OK. This adds the VM to your library.

  3. In VMware Player, launch the Ubuntu VM. Click I copied it if a window opens asking if you copied or moved the VM.

  4. On the Ubuntu VM, you will see multiple Gazebo world startup scripts as well as other utility shortcuts. For the TurtleBot® examples, use the Gazebo Empty, Gazebo House, Gazebo Office, or Gazebo Sign Follower ROS icons.

  5. Click Gazebo House to open a world. If the Gazebo screen appears entirely black, refresh the image by minimizing it and then maximizing it.

  6. Open a new terminal in the Ubuntu VM. Type ifconfig and return to see the networking information for the VM. You can see the IP address for the VM in the inet addr under eth0.

  7. You must set two ROS environment variables to set up the network: ROS_MASTER_URI and ROS_IP. If you are using the demos from the desktop of the Ubuntu VM, these variables usually get automatically set during startup.

  8. To verify that the ROS environment variables are set up appropriately, check them using the echo $ENV_VAR command by replacing $ENV_VAR with the appropriate environment variable names. For example:

    echo $ROS_MASTER_URI
    echo $ROS_IP
    Close and reopen your terminal for it to take effect.

If you have your own VM, use these instructions to set it up for use with ROS Toolbox.

  1. Download the appropriate packages for Gazebo simulator and TurtleBot3, and follow the provided instructions to set up the TurtleBot in a simulated Gazebo environment.

  2. Open a new terminal in the Ubuntu VM. Type ifconfig and return to see the networking information for the virtual machine. You can see the IP address for the VM in the inet addr under eth0. While this example uses an Ethernet connection, in many cases, a wireless connection (WLAN) may be applicable.

  3. You must manually set two ROS environment variables to set up the network: ROS_MASTER_URI and ROS_IP. Set these environment variables by executing the following commands in the terminal and replacing IP_OF_VM with the IP address retrieved through ifconfig.

    echo export ROS_MASTER_URI=http://IP_OF_VM:11311 >> ~/.bashrc
    echo export ROS_IP=IP_OF_VM >> ~/.bashrc

    Launch Gazebo to open a world in the Ubuntu VM. Verify that the environment variables are appropriately set and you can ping back and forth between your host machine and the VM that has Gazebo running. For information on different ways to verify such connection, see Connect to ROS Network and Establish Communication.

  4. Before running any ROS commands on the Ubuntu VM, ensure the terminal is configured to use the correct ROS installation. This is done by sourcing the appropriate ROS environment setup script. For example, on the VM terminal, run this command:

    source /opt/ros/noetic/setup.bash
    

  5. To confirm the required ROS topics are accessible, enter the following command in a terminal on the Ubuntu VM:

    rostopic list
    
    Verify that the list contains these topics.
    /gazebo/link_states
    /gazebo/model_states
    /gazebo/performance_metrics

  6. Verify communication with the simulator machine by pinging its IP address. Replace IP_OF_VM with the actual IP address of the VM:

    ping IP_OF_VM
    
    A successful ping will display a response, whereas an unsuccessful ping will show no response.

For related information about configuring VM and setting up a Gazebo world, see Get Started with Gazebo and Simulated TurtleBot.

See Also

Topics

External Websites