[Solved] Ubuntu18.04 Px4 (xtdrone) gazebo joint simulate error

Ubuntu 18.04 installs gazebo9.0 by default and starts indoor1 of Px4 Launch will report an error:

gzserver: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsdformat.so.4: undefined symbol: _ZN8igniti

The reason is that the version of gazebo 9.0 is too low and needs to be upgraded to 9.13, 9.14 or 9.15 (I can use it when upgrading to 9.19) Upgrade method:

1 Uninstall the original gazebo
sudo apt-get remove gazebo* 
sudo apt-get remove libgazebo*
sudo apt-get remove ros-melodic-gazebo* #kinetic noetic Corresponding changes
2 Set up the computer to accept software from package.osrfoundation.org
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
cat /etc/apt/sources.list.d/gazebo-stable.list
#If deb http://packages.osrfoundation.org/gazebo/ubuntu-stable xenial main appears, it means no problem
xenial should be 20.04 18.04 for bio
3 Set the key
wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
4 Install gazebo9.1 command.
sudo apt-get install gazebo9=9.1*
//If after executing the commands sudo apt install ros-melodic-gazebo9-* sudo apt install ros-melodic-gazebo-*, gazebo starts with an error like symbol (e.g. gzserver: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsdformat.so.4: undefined symbol: _ZN8igniti). You can solve this problem by running sudo apt upgrade libignition-math2 first
5 sudo apt upgrade libignition-math2
If you type gazebo in the terminal after installation, Gazebo will open and the installation will be successful.
6 Gazebo itself is independent of ROS, so you need to install the Gazebo plugin for ROS
sudo apt install ros-melodic-gazebo9-*
sudo apt install ros-melodic-gazebo-*

Read More: