ROS visualization tool Rviz& displays the video of the computer camera

Overview

Install Rviz and use it to display video from the computer camera.

One, get to know Rviz

RViz is ROS 三维可视化工具. Its main purpose is 三维方式显示ROS消息to be able to 数据进行可视化表达. For example, it is possible to express the distance between the sensor in the laser rangefinder (LRF) sensor and the obstacle without programming, and the point cloud data (PCD, Point Cloud Data) of the three-dimensional distance sensor such as RealSense, Kinect or Xtion, obtained from the camera Image value, etc.
Insert picture description here

rviz: The ROS Visualization Tool, ie 机器人操作系统3D可视化工具. Its role is: a virtual world, used to simulate the effect of the robot in the real world.
Simply put, it is a simulator software of ROS.

Second, install Rviz

1. Preliminary preparation

Find the virtual machine settings
Insert picture description here
Click on the USB controller and change the USB compatibility to USB2.0 to
Insert picture description here
connect to the camera.
Insert picture description here
Check whether
cheese can be used normally. #Using this command will call the camera, and an interface will pop up to display the camera’s screen
#The default cheese should be no According to the need to execute the following command

sudo apt-get install cheese

Insert picture description here

2. Installation

Compile from source file
Download first

rosdep install rviz

Insert picture description here
Compile

rosmake rviz

Insert picture description here
Start and
run the following command

roscore
rosrun rviz rviz

Insert picture description here
Insert picture description here
You can also run the following commands directly, the effect is the same

roscore
rviz

The open interface is as follows
Insert picture description here

3. A brief introduction to the interface

The overall interface
Insert picture description here
area division introduction
Insert picture description here
➊ 3D view (3D view): Refers to the black part of the screen. It is the main screen on which various data can be viewed in three dimensions. 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.
➋ Displays: The display on the left is an area where users can select data views from various topics. If you click [Add] at the bottom left of screen 4, the selection screen will be as shown in Figure 6-7. There are currently about 30 different displays to choose from, which we will introduce in detail in the description below.
➌ Menu: The menu is at the top. The user can choose the command to save or read the status of the display screen, as well as various panels.
➍ Tools: Tools are buttons located at the bottom of the menu that allow users to select multiple functions with various function buttons, such as Interact, Move Camera, Select, Focus Camera, Measure, 2D Pose Estimate, 2D Navigation Goal and Publish Point and so on.
➎ Views: Set the viewpoint of the 3D view
■ Orbit: Rotate around the specified viewpoint (here called Focus). This is the most commonly used basic view by default.
■ FPS (First Person): Display the picture seen by the first person viewpoint.
■ ThirdPersonFollower: Shows the view of chasing a specific target from a third-person viewpoint.
■ TopDownOrtho: This is the Z-axis view, which is different from other views. It is displayed in direct view instead of perspective.
■ XYOrbit: similar to the default value of Orbit, but the focus is fixed on the XY plane with the Z axis value of 0.
➏ Time: Display the current time (wall time), ROS Time and their respective elapsed time. This is mainly used for simulation, if you need to restart, please click the [Reset] button at the bottom.
Screen selection screen
Insert picture description here

最上面是display的类型。最下面是名称,必须是独一无二的。

Show own properties
Insert picture description here

Status共有四种状态:OK,Warning,Error和Disable。 不同的状态,扩展内容里面会有说明。

The most commonly used menu in the process of using RViz should be the screen 5 menu. The display menu is used to select the information displayed on the 3D View screen
Insert picture description here
Insert picture description here

Three, camera video display

1. Install related feature packs

Install uvc camera function package

sudo apt-get install ros-melodic-uvc-camera

Insert picture description here
Install image related function packages

sudo apt-get install ros-melodic-image-* 
sudo apt-get install ros-melodic-rqt-image-view

Insert picture description here
Insert picture description here

2. Related startup

Start the core program of Ros

roscore

Insert picture description here
Run the uvc_camera node in another terminal

rosrun uvc_camera uvc_camera_node

Insert picture description here
Open another terminal to view topic messages

rostopic list

Insert picture description here
Print camera information

rostopic echo /camera_info

Insert picture description here

3. Rviz configuration

Open rviz

rviz

Insert picture description here
Find Add in the lower left corner of the tab and click.
Insert picture description here
Find Image under By display type, click to select, and then click OK to add
Insert picture description here
. Change the value of image Topic to /image_raw and the
Insert picture description here
result is displayed
Insert picture description here

If you can't open the camera, you can choose to change the USB, and then run the command again.

Four, summary and reference materials

1. Summary

This article is mainly a brief introduction and use of the ROS visualization tool Rviz. Rviz is a 3D simulator, which is equivalent to showing the things in life in the 3D model.

2. Reference materials

RViz study notes (1)-install
ROS study (7): three-dimensional visualization tool (RViz) .
ROS query notebook camera parameters, use rviz to display real-time video .

Guess you like

Origin blog.csdn.net/QWERTYzxw/article/details/115011484