Common components in ROS (5)-Gazebo simulation environment

Common components in ROS (5)-Gazebo simulation environment

Overview

Gazebo is a powerful 3D physics simulation platform, with a powerful physics engine, high-quality graphics rendering, convenient programming and graphics interface, and most importantly, it has open source and free features. Although the robot model in Gazebo is the same as the model used by rviz, the physical properties of the robot and the surrounding environment, such as mass, coefficient of friction, and elasticity, need to be added to the model. The sensor information of the robot can also be added to the simulation environment in the form of a plug-in and displayed in a visual manner.

1. Features of Gazebo

Gazebo is an excellent open source physics simulation environment, which has the following characteristics:
1) Dynamic simulation: supports a variety of high-performance physics engines, such as ODE, Bullet, SimBody, DART, etc.
2) Three-dimensional visualization environment: supports displaying realistic three-dimensional environment, including light, texture, and shadow.
3) Sensor simulation: It supports the simulation of sensor data and can simulate sensor noise at the same time.
4) Extensible plug-ins: Users can customize the development of plug-ins to extend Gazebo's functions to meet individual needs.
5) Multiple robot models: Officially provide robot models such as PR2, Pioneer2 DX, TurtleBot, etc. Of course, you can also use your own robot models.
6) TCP/IP transmission: Gazebo's background simulation processing and foreground graphic display can realize remote simulation through network communication.
7) Cloud simulation: Gazebo simulation can be run on Amazon, Softlayer and other clouds, or on a cloud server built by yourself.
8) Terminal tools: Users can use the command line tools provided by Gazebo to realize simulation control in the terminal.
Gazebo's community maintenance is very active, with major version changes, but it still guarantees better compatibility.

Two, install and run Gazebo

Like rviz, if you have already installed the full version of ROS on the desktop, you can skip this step directly. Otherwise, use the following command to install:

sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control

After the installation is complete, use the following commands in the terminal to start ROS and Gazebo:

roscore
rosrun gazebo_ros gazebo

The main interface mainly contains the following parts:
1) 3D view area
2) Toolbar
3) Model list
4) Model attribute items
5) Time display area To
verify whether Gazebo is successfully connected to the ROS system, you can view the ROS topic list:

rostopic list

If the connection is successful, you should be able to see the list of topics published/subscribed by Gazebo.
Of course, there is also a list of services provided by Gazebo:

rosservice list

Insert picture description here

Three, build a simulation environment

A simulation environment needs to be constructed before simulation. There are two ways to create a simulation environment in Gazebo.
1) Insert the model directly.
In the model list on the left of Gazebo, there is an insert option that lists all available models. Select the model you want to use, place it in the main display area, and add simulation examples such as robots and external objects to the simulation environment.
Remarks: To load the model, you need to connect to a foreign website. In order to ensure the smooth loading of the model, you can download the model file in advance and place it under the local path "~/.gazebo/models". The download address of the model file is "https://bitbucket. org/osrf/gazebo_models/downloads/". 2)
The second method of Building Editor is to use the Building Editor tool provided by Gazebo to draw the map manually. Select Edit——>Building Editor in the Gazebo menu bar, select the drawing option on the left, and then use the mouse to draw in the upper window, and the lower window can display the drawing simulation environment in real time.
After the model is created, the robot model can be loaded and simulated.

Guess you like

Origin blog.csdn.net/weixin_45661757/article/details/112793845
Recommended