[Solved] OpenGL issues with Gazebo and VMWare

Introduction

If you are working with ROS and Gazebo in the VMWare Workstation Player 15, you may encounter graphics issues while working with the Gazebo simulator. Here are the details of this issue with a screenshot.

Problem

After installing ROS and Gazebo, and if you are starting your simulation launch file, you may get the following error in the terminal. The Gazebo simulation will fail to load the simulation.

The error you may get is the following

VMware: vmw_ioctl_command error Invalid argument.

Here are the possible debugging and workaround you can do to fix this issue.


Debugging and Workarounds

There are some discussions happening answers.gazebo.org regarding these issues, but there are no clear solutions for these issues, only a few workarounds. Here are the links from answers.gazebo.org thread regarding this issue.

You can install the glmark2 benchmark tool in Ubuntu to test the 3D performance on your Ubuntu guest first.

Install glmark2

sudo apt install glmark2

After installing glmark2, run it on the terminal to get the OpenGL version and to get the 3D performance.

You can able to find the GL_VERSION as 3.3. GL_VENDOR: VMware Inc. This test also helps to benchmark the 3D performance of the current guest OS.


#1 Workaround: Disable Graphics Acceleration in VMWare

The first workaround is disabling the 3D Graphics acceleration in VMware. If you do this, 3D performance will be reduced but this issue will go.

I will not recommend this method, because it will reduce the 3D performance in Gazebo. The next method is more better than this

#2 Workaround: Downgrade the GL_Version

In this method, we are downgrading the GL_VERSION from 3.3 to GL_VERSION 2.1. This method will work better and the Gazebo performance will be also good.

You can use the following command to downgrade the GL_VERSION

echo "export SVGA_VGPU10=0" >> ~/.bashrc

This will permanently fix this issue. To test your settings, you can either test with Gazebo or use glmark2. Here is the screenshot of glmark2 after downgrading the GL_Version to 2.1.

Lentin Joseph

View posts by Lentin Joseph
Roboticist | Author of 8 robotics books | TEDx speaker

3 Comments

  1. Hi, this workaround does not work for me and I cant seem to find an answer on any of the related boards to this problem. Disabling 3D acceleration does work but isnt an optimal solution as I really need better performance for my gazebo simulation. When I put that command into my bash rc my verison of open GL is 2.1 Mesa 20.0.8. I dont know if this could be why my gazebo still doesnt open or not?

    1. Hi @David

      After adding in .bashrc, you can take a new terminal and try. I hope it will work. You can post the terminal message as a comment if that is not working.

  2. Ishan Chavan says:

    I tried workaround #1 and it made the issue go as per the post but the fps was 3 to 5 which is terrible. I tried Workaround #2 and I couldn’t get the GL_version to 2.1 even after editing the bashrc file, so I restarted the VM and problem was solved. Got it running at 60fps. Thankyou for this solution.

Leave a Reply