Brief introduction and use of rviz

rviz is a 3D visualization platform in ROS. On one hand, it can realize the graphical display of external information, and on the other hand, it can also release control information to an object through rviz, realizing the monitoring and control of a robot.

1 Installation of rviz and the introduction to its interface

When installing ros, if you perform a complete installation, rviz is already installed, and you may try to run it directly; if it is not fully installed, you may install rviz separately:

After the installation is complete, open a new terminal (shortcut key: Ctrl+Alt+T) and enter the following command:

Then open a new terminal (shortcut key: Ctrl+Alt+T) and input the following command to open rviz.

Open rviz, and the following interface will be displayed:

img

1.1 Introduction of all areas

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

2 mycobot_ros installation and update

mycobot_ros is a ROS package from ElephantRobotics that works with all types of desktop robots.

The address of the project: https://github.com/elephantrobotics/mycobot_ros

The official default ROS1 workspace is catkin_ws.

Click the ROS1 Shell icon on the desktop or the corresponding icon in the lower bar of the desktop to open the ROS1 environment terminal:

img

img

img

Then enter the following command:

Note: If the /home/er/catkin_ws/src(equivalent to ~/catkin_ws/src) already exists in the mycobot_ros folder, you need to delete the mycobot_ros folder before running the above command. In the directory path, er is the user name of the VM. If they are different, change them.

3 Simple use

Start using launch file

This example is built on what you have already done Environment building and you have successfully copied the company's code from GitHub to your virtual machine.

Open a new terminal (shortcut key: Ctrl+Alt+T)

Input the command to configure the ROS environment.

Input again:

Open rviz, and then you will obtain the following result:

img

If you want to know more information about rviz, go to Official documents.

4 M5 Version Prerequisites

Then enter the user password(Note: The password is not displayed, just enter it correctly).

Control and following of the robot arm

1 Slider Control

Open a command line and run:

rviz and a slider component will be opened, and you will see the following interface:

img

Then you can control the model in rviz to make it move by dragging the slider. If you want the real mycobot to move with the model, you need to open another command line and run:

Note: Since the robot arm will move to the current position of the model when the command is input, make sure that the model in rviz does not appear to be worn out before you use the command.

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

2 Model Following

In addition to the above controls, we can also let the model move by following the real robot arm. Open a command line and run:

Then open another command line and run:

It will open rviz to show the model following effect.

3 GUI control

On the basis of the previous contents, this package also provides a simple GUI control interface. This method is used for interaction between real robot arms. Connect to mycobot.

Open a command line:

Running effect:

img

4 Keyboard control

Keyboard control is added in new_mycobot_320 package, and real-time Synchronization is performed in rviz. This function depends on pythonApi, so be sure to connect with the real robot arm.

Open a command line and run:

Running effect is as follows:

img

mycobot information will be output in the command line as follows:

Then open another command line and run:

You will see the following output in the command line:

In this terminal, you can control the state of the robot arm and move it using the keys in the command line.

Parameters supported by this script: