Brief introduction and use of rviz

Rviz is a 3D visualization platform in ROS. On the one hand, it can realize the graphical display of external information, and on the other hand, it can release control information to objects through rviz, so as to realize the monitoring and control of robots.

1 Installation and interface introduction of rviz

When installing ROS, if you perform a full installation and rviz is already installed, you can directly try to run it; If not completely installed, you can install rviz separately:

# Ubuntu16.04
sudo apt-get install ros-kinetic-rviz
# Ubuntu18.04
sudo apt-get install ros-melodic-rviz
# Ubuntu20.04
sudo apt-get install ros-noetic-rviz

After installation, please open a new terminal(shotcutCtrl+Alt+T),enter the following command:

roscore

Then open a new terminal(shotcutCtrl+Alt+T) enter the command to open rviz

rosrun rviz rviz
# or
rviz

Open rviz, and the following interface is displayed:

1.1 Introduction to each region

  • On the left is the list of displays, which are used to draw some content in the 3D world, and may have some available options in the display list.
  • Above is the toolbar, which allows users to select a variety of tools with various function keys +The middle part is a 3D view: it is the main screen that can view various data 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.
  • The lower part is the time display area, including system time and ROS time.
  • The right side is the viewing angle setting area, where different viewing angles can be set.

We only give a brief introduction to this part. If you want to know more details, you can go to User Guide

1.2 Simple Use

Launch via launch file

This example is based on the fact that you have completed the environment construction ,successfully copied the company's code from GitHub.

Open a console terminal(shotcutCtrl+Alt+T) Enter the command to configure ROS environment configuration

cd ~/catkin_ws/
source devel/setup.bash

Re input:

roslaunch ultraarm test.launch

Open rviz and get the following results:

If you want to know more about rviz, you can go to Official Documents

2 Control of mechanical arm

2.1 Operating environment

The environment shall be built before use,details can be viewed in Environment Construction section.

2.2 Slider control

Open a command line and run:

# ultraArm's default serial port name is"/dev/ttyUSB0",baud rate is 115200.
roslaunch ultraarm slider_control.launch

It will open rviz and a slider component, and you will see the following picture:

Then you can control the model movement in rviz by dragging the slider. If you want the real ultraArm to move together, you need to open a command line and run:

# ultraArm's default serial port name is"/dev/ttyUSB0",baud rate is 115200.
rosrun ultraarm slider_control.py

Please note: since the mechanical arm will move to the current position of the model when the command is entered, please ensure that the model in rviz is not penetrated before you use the command

Do not drag the slider quickly after connecting the mechanical arm to prevent damage to the mechanical arm

results matching ""

    No results matching ""