Debugging ROS2 topics
List all topics
View all active ROS2 topics in the system:/cmd_vel- Velocity commands/scan- LiDAR sensor data/odom- Odometry data/imu- Inertial measurement unit/camera/image_raw- Camera feed
Echo topic data
Monitor messages published to a topic in real-time:Check topic frequency
Measure how often messages are published:Get topic information
View topic type and publishers/subscribers:Debugging ROS2 nodes
List all nodes
Show all running ROS2 nodes:/turtlebot3_node/gazebo/teleop_keyboard(when running teleop)
Get node information
Inspect a specific node’s publishers, subscribers, services, and actions:- Subscriptions
- Publications
- Service servers
- Service clients
- Action servers
- Action clients
Visualization with RViz2
RViz2 provides 3D visualization of sensor data and robot state.Launch RViz2
Access the VNC desktop at http://localhost:6080 (password:ros), then:
Checking environment variables
Verify critical ROS2 environment variables:.bashrc by the post-create.sh script.
Debugging Gazebo issues
Check Gazebo logs
Review Gazebo server and client logs:Kill stuck Gazebo processes
If Gazebo won’t start or close properly:Test GPU rendering
Check if hardware GPU acceleration is available:Clear Gazebo cache
Reset Gazebo configuration if experiencing crashes:Package debugging
Verify package installation
Check if packages are correctly installed:Check package dependencies
Verify all dependencies are installed:Review build logs
Inspect build logs for errors:Using the verification script
Run the comprehensive setup verification script:- ROS2 Jazzy installation
- Gazebo Harmonic installation
- Python 3 and colcon
- TurtleBot3 packages
- Navigation2 packages
- Cartographer packages
- Environment variables
- Directory structure
- Build status
Common debugging scenarios
No topics visible
Robot not moving
Check if teleop is publishing
Verify Gazebo is running
Check the VNC desktop at http://localhost:6080 to see if Gazebo is displaying the robot.