Brief introduction and use of rviz2
Rviz2 is a visualization tool for displaying messages in the robot environment, providing a 3D perspective to view the robot's status and activities. It can help developers better understand the current status and activities of the robot, as well as other visual messages. Rviz2 provides a series of visualization tools that can help developers better understand the status and activities of robots, such as visual coordinate systems, laser scanning messages, point cloud messages, robot models, etc. Using Rviz2, robotic systems can be easily viewed and debugged to better achieve robotic goals.
1 Introduction to rviz2
Open the ROS2 environment terminal, enter the command to open rviz2:
ros2 run rviz2 rviz2
# or
rviz2
Open rviz2 and display the following interface:
1.1 Introduction of each area
- On the left is the list of monitors, a monitor is something that draws something in the 3D world and may have some options available in the display list. Including functions such as adding, deleting, copying, renaming plug-ins, displaying plug-ins, and setting plug-in properties.
- Above is the toolbar, which allows users to use various function buttons to select tools with multiple functions
- The middle part is the 3D view: it is the main screen where various data can be viewed in 3D. The background color, fixed frame, grid, etc. of the 3D view can be set in detail in the Global Options and Grid items displayed on the left.
- Below is the time display area, including system time and ROS time.
- The right side is the observation angle setting area, and different observation angles can be set.
We only give a rough introduction in this part. If you want to know more detailed content, you can go to the user guide to view it.
2 Simple use
Launch through launch file
This example is based on the fact that you have completed Environment Setup and successfully copied the company's code from GitHub.
Open the ROS2 environment terminal and enter the following commands to configure the ROS2 environment.
cd ~/colcon_ws/
colcon build --symlink-install
source install/setup.bash
Enter again:
ros2 launch mercury_b1 test.launch.py
Open rviz2 and get the following result:
If you want to know more information about rviz, you can go to the official documentation to view it.