• Non ci sono risultati.

Rviz is a 3D visualiser for ROS. The main window (figure3.18) is divided into three main parts: on the left, a list of displays and their own properties, the 3D view in the middle and, on the right, a list of views.

3.7.1 Displays

Displays are what is shown in the 3D view. A display has some properties such as the status (OK, Warning, Error and Disabled) with a short explanation, in order to let the user understand if it is behaving in the correct way, and the subscribed topic where data are taken from. There is a very long list of different kinds of displays and each display has its own kind of properties. The most common built-in displays types are:

Grid This display shows a 2D or 3D grid of lines along a plane, centered at the

3.7 – Rviz

Figure 3.17: Example of object recognition. on the left, the object to recognise which detectors and descriptors (yellow and light blue points), in the middle there is the image from the camera and the detected object has a square around it, on the right, the list of parameters.

origin of the target frame. It is generally used to represent the XY plane as a surface on which to locate the robot. The Grid display is included by default when a new Rviz window is opened.

RobotModel This kind of display shows the pose of each link and reconstructs the entire robot. Links information (visual and collision) is given by the robot_description parameter in the Parameter Server and it retrieves the po-sition of each joint using the tf tree. The model is updated with a given rate.

TF This kind of display shows the tf transform tree published by the robot_state_publisher node (see section3.4.2). It allows to display the frame name, the frame axes and the arrow from the child frame to the parent frame.

Axes are indicated: in red the X axis, in green the Y axis and in blue the Z axis. The fixed frame is always available (usually world frame) and it is

ROS — Robot Operating System

Figure 3.18: Rviz main window with the displays section on the left, views section on the right and the 3D view in the middle

located in the center of the coordinate system.

Image This kind of display generates a new display window with an image inside.

This image is updated with a given rate and it takes information from the sensor_msgs/Image topic. This kind of display is generally used to show images coming from a camera.

Marker This display adds a primitive shape to the 3D view, reading information from the visualization_msgs/Marker message on visualization_marker topic.

The available shapes are arrow, cube, sphere, cylinder, line strip, line list, cube list, sphere list, points, view-oriented text, mesh resource and triangle list. In case of a single object, it is displayed using the center of the object or using the start and end point (only in the case of the arrow), while in case of list objects a set of points is used. Obviously the visualisation of a single marker is less expensive than many markers, so it is better to use an object list when many shapes of the same type have to be displayed.

When this kind of display is created, it automatically subscribes to the same topic with extension “_array” using visualization_msgs/MarkerArray mes-sages. With this kind of messages it is possible to display many markers at once.

PointCloud2 This kind of display is used to show data from sensor_msgs/Point-Cloud2 messages in order to generate some shapes in the 3D view, according to

3.7 – Rviz

the depth generated from a sensor, for example, a depth camera. This display offers four different rendering styles (points, billboards, billboard spheres and boxes), giving the possibility to choose the best one that fits the application.

If the users do not find a desired display in the provided list they can use a plugin to add a new customised display with some specific properties so as to make it behave as they want.

3.7.2 View

Views are different types of camera available in the visualiser. Each camera has a different way to be controlled and a different type of projection (Orthographic or Perspective). The different types of cameras are:

Orbital Camera This camera rotates around a focal point that can be everywhere in the space.

XY Orbit This camera has the same behaviour and the same way of controlling the Orbital Camera but the focus point is restricted to be in the XY plane.

Third Person Follower This camera maintains a constant viewing angle towards the tangent frame but it turns if the tangent frame yaws.

FPS (first-person) Camera This camera gives you a first-person perspective.

Rotating the camera is like rotating one’s head up and down or left and right.

Zooming in and out is like moving forwards and backwards.

Top-down Orthographic This camera provides a top to bottom perspective, along the Z axis in the robot frame using an orthographic view therefore if the camera moves farther the object does not get smaller.

Given a certain type of camera, its pose and the target frame, it is possible to save the view in the view panel and use it in the future.

Many different configurations are possible using displays and views. A config-uration is made up of displays and their properties, tool properties and a camera type with its settings. It can be saved in a folder and reused again. It can be simply loaded from the Rviz windows or it is generally used inside a launch file.

When a display is used, rviz uses the tf to transform data from the coordinate frame into the global reference frame. There are two very important reference frames: the fixed frame and the target frame. The former is used to identify the world, in fact it is usually called “world”, it is fixed and it does not move. The latter is the frame for the camera view. For example, considering a mobile robot, if the target frame is the map, you will see the robot moving around, conversely if the target frame is the robot, you will see the robot fixed and the map moving with respect to it.

ROS — Robot Operating System

Documenti correlati