Rviz is a ROS (Robot Operating System) visualization tool for displaying robot sensor data, motion status, maps and other information. It can help users better understand the working principle of the robot, debug the behavior of the robot, and visualize the trajectory of the robot, etc.
Here is an example using Rviz:
1. Start the ROS system
Enter the following command in the terminal:
roscore
2. Start the robot simulator
Enter the following command in the terminal:
roslaunch turtlebot_gazebo turtlebot_world.launch
3. Start Rviz
Enter the following command in the terminal:
roslaunch turtlebot_rviz_launchers view_navigation.launch
4. Add robot model in Rviz
In the "Displays" panel on the left side of Rviz, click the "Add" button, select "RobotModel", and then select "map" in "Fixed Frame".
5. Add a map in Rviz
In the "Displays" panel on the left side of Rviz, click the "Add" button, select "Map", and then select "/map" in "Topic".
6. Add the robot's motion state in Rviz
In the "Displays" panel on the left side of Rviz, click the "Add" button, select "RobotPosePublisher", and then select "/initialpose" in "Topic".
7. Add the sensor data of the robot in Rviz
In the "Displays" panel on the left side of Rviz, click the "Add" button, select "LaserScan", and then select "/scan" in the "Topic".
Now, you can see the robot's model, map, motion status and sensor data in Rviz. You can test the robot's behavior by dragging the map, changing the robot's motion state, and more.