So far ARCHO has existed only in XML files and terminal output. It's time to "see" him for the first time. RViz is a tool that does exactly that: it displays anything published on the ROS 2 network โ the robot model, the TF tree, LiDAR data, Nav2's planned path โ in a live 3D view.
RViz is the robot's information window; Gazebo (next chapter) is the robot's virtual lab. RViz doesn't simulate any physics โ if you place ARCHO a meter above the ground, in RViz he just stays there, floating in mid-air, because RViz only shows what it receives from the ROS network; it doesn't apply the laws of the real world.
If you want to design a car, a CAD drawing program only shows its appearance โ it won't tell you whether it rolls over or how it brakes. RViz plays exactly that role for a robot โ a window for seeing and debugging, not a physical laboratory.
Before we open RViz, let's see what we'll find inside it:
| Window section | Role |
|---|---|
| Displays panel | Lists every information layer you want to see; each can be toggled on/off with a checkbox |
| Add button | Adds a new display (e.g. LaserScan, PointCloud, Path) |
| Fixed Frame | The reference frame everything is drawn relative to |
| 3D view | The main scene; can be rotated, zoomed, and panned with the mouse |
| Views | Camera type (Orbit, Top Down, First Person, etc.) |
To display the model, we need a three-step chain, each link of which we already built in earlier chapters:
We create a launch file named display.launch.py in archo_description/launch:
from launch import LaunchDescription
from launch.substitutions import Command
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
from ament_index_python.packages import get_package_share_directory
import os
def generate_launch_description():
package_path = get_package_share_directory('archo_description')
xacro_file = os.path.join(package_path, 'urdf', 'archo.urdf.xacro')
robot_description = ParameterValue(
Command(['xacro ', xacro_file]), value_type=str)
return LaunchDescription([
Node(
package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{'robot_description': robot_description}],
),
Node(
package='joint_state_publisher_gui',
executable='joint_state_publisher_gui',
),
Node(
package='rviz2',
executable='rviz2',
output='screen',
),
])
We don't yet have a real controller or wheel simulation (that's next chapter's job). joint_state_publisher_gui
opens a small window with a slider for every movable joint โ you can manually "spin" the left or right
wheel and immediately see robot_state_publisher reflect that change in TF. A great tool
for quick testing before moving on to full simulation.
When RViz opens for the first time, you'll usually see nothing โ because no displays have been added yet. Add these four with the Add button:
| Display | What it shows |
|---|---|
Grid | A reference grid on the ground, purely for visual orientation |
RobotModel | ARCHO's actual appearance โ exactly the Visual geometry we defined in Xacro back in Chapter 4 |
TF | The colored axes (red/green/blue) of every frame, so you can see whether last chapter's TF tree was actually built correctly |
LaserScan | LiDAR data points, once we enter Gazebo next chapter; its topic is usually /scan |
And most importantly, set the Fixed Frame to base_footprint โ the same root we verified with check_urdf back in Chapter 4.
If you see nothing on screen after adding RobotModel, it's usually one of three things: the wrong
Fixed Frame was selected, robot_state_publisher isn't running, or Xacro threw an error and
robot_description was never published at all. The Displays panel usually shows a red icon
next to the item that has a problem.
Unlike previous chapters, this chapter's checkpoint is "visual" โ you need to confirm the following by looking at RViz:
For the first time in this book, we saw ARCHO with our own eyes โ not as lines of XML, but as a live 3D model that makes Chapter 5's TF tree real. But remember: RViz is only an information window. Nothing actually "happens" inside it. For ARCHO to truly move, collide with gravity, and behave with real physics, we need to step into the next virtual lab.
ARCHO Project is now visible for the first time. The display.launch.py file we just built will be the foundation for every later launch file โ each time, we'll simply add one more layer on top (Gazebo, Nav2, SLAM).
In Chapter 7, ARCHO enters Gazebo for the first time โ a place where he's no longer merely seen, but where gravity acts on him, he collides with the ground, and his LiDAR and IMU produce real (noisy) data.