LearningROS 2 Fundamentals
Debugging ROS 2 | Debugging & Troubleshooting
Tools dan teknik debugging untuk ROS 2 | Debugging tools and techniques for ROS 2
Apa itu ROS 2?
0 dari 5 halaman selesai
In Progress
Scroll sampai 80% untuk menandai halaman selesai.
Debugging ROS 2
Pelajari tools untuk debugging dan troubleshooting sistem ROS 2.
🔧 rqt - GUI Tools Collection
# Launch rqt
rqt
# Or specific plugins
rqt_graph # Node/topic visualization
rqt_console # View log messages
rqt_topic # Topic inspector
rqt_plot # Plot numeric datarqt_graph - Visualize System
ros2 run rqt_graph rqt_graphShows nodes and topic connections - great for understanding system architecture.
🌐 rviz2 - 3D Visualization
ros2 run rviz2 rviz2Visualize:
- Robot model (URDF)
- TF frames
- Sensor data (camera, lidar)
- Path planning
📊 Common Debugging Commands
# Check if node is running
ros2 node list
# Check topic data
ros2 topic echo /topic_name
ros2 topic hz /topic_name # Check frequency
ros2 topic bw /topic_name # Check bandwidth
# Check service availability
ros2 service list
# View logs
ros2 run rqt_console rqt_console🐛 Common Issues & Solutions
| Problem | Solution |
|---|---|
| Node not found | source install/setup.bash |
| Topic not publishing | Check ros2 topic list, verify node running |
| Service timeout | Check server node, verify service name |
| Parameter not set | Use ros2 param list, check namespace |
📝 Logging
# In your node
self.get_logger().debug('Debug message')
self.get_logger().info('Info message')
self.get_logger().warn('Warning message')
self.get_logger().error('Error message')# Set log level
ros2 run my_package my_node --ros-args --log-level DEBUG🎥 Recording & Playback
# Record topics
ros2 bag record /topic1 /topic2 -o my_recording
# Record all
ros2 bag record -a
# Playback
ros2 bag play my_recording
# Info about bag
ros2 bag info my_recording✅ Debugging Checklist
- ☑️ Sourced workspace? (
source install/setup.bash) - ☑️ Node running? (
ros2 node list) - ☑️ Topics publishing? (
ros2 topic list,ros2 topic echo) - ☑️ Correct message types? (
ros2 topic info) - ☑️ TF frames correct? (
ros2 run tf2_tools view_frames)
🎉 ROS 2 Learning Complete!
Selamat! Kamu telah menyelesaikan track ROS 2 Fundamentals.