Common components in ROS (4)-rviz 3D visualization platform

Common components in ROS (4)-rviz 3D visualization platform

Overview

There are a lot of data in the robot system, but the value of the data form is often not conducive to the developer to feel the content described by the data, so it is often necessary to visualize the data.
In response to the visualization requirements of the robot system, ROS provides users with a three-dimensional visualization platform that displays a variety of data-RViz.
rviz is well compatible with various robot platforms based on ROS software framework. In rviz, you can use XML to describe the size, quality, position, material, joints and other attributes of any physical objects such as robots and surrounding objects, and present them in the interface. At the same time, rviz can also graphically display the information of the robot's sensors, the robot's movement status, and the changes in the surrounding environment in real time.
All in all, rviz helps developers realize the graphical display of all monitorable information. Developers can also control the behavior of the robot through buttons, sliders, values, etc. under the control interface of rviz.

One, install and run rviz

rviz has been integrated in the full version of ROS on the desktop, or it can be installed via the following command:

sudo apt-get install ros-kinetic=rviz

After the installation is complete, run the following commands in the terminal to start the ROS and rviz platforms:

roscore
rosrun rviz rviz

Insert picture description here

The main interface of rviz mainly contains the following parts.
3D view area: used to visually display data. There is currently no data, so it is displayed in black.
Toolbar: Used to provide tools such as perspective control, target setting, and publishing location.
Display item list: used to display the currently selected display plug-ins, and you can configure the properties of each plug-in.
Viewing angle setting area: used to select multiple viewing angles.
Time display area: used to display the current system time and ROS time.

2. Data visualization

The premise of data visualization is of course to publish the data that needs to be visualized in the corresponding message type, and then we can use the corresponding plug-in to subscribe to the message in rviz to realize the display.
1. Add a plug-in for displaying data. Click the "Add" button at the bottom left of the rviz interface, and rviz will list all the display plug-ins of all data types supported by default, as shown in the figure.
Insert picture description here

After the addition is complete, the display plug-ins that have been added will be listed in Dispaly on the left side of rviz; click the plus sign in front of the plug-in list to open an attribute list and set the attributes according to your needs. Under normal circumstances, the "Topic" attribute is more important and is used to declare the data source subscribed by the display plug-in. If the subscription is successful, the visualized data should appear in the middle display area.

Three, plug-in extension mechanism

rviz is a three-dimensional visualization platform. By default, it can display general-purpose data as shown in the figure, which contains data such as coordinate axes, camera images, maps, and lasers.
Insert picture description here
We can build our own human-computer interaction software based on rviz. For example, we can develop a series of rviz-based plug-ins for manipulator control, which can complete functions similar to industrial robot teaching devices:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45661757/article/details/112790012