Overview
After creating your URDF, visualization in RViz helps verify correctness before deploying to real robot. This guide covers RViz configuration, TF debugging, and common visualization issues.Goal: Ensure your URDF accurately represents the physical robot before adding control and navigation layers.
RViz Basics
Launch RViz with Robot Model
RViz Interface
Displays Panel (Left)
Add/configure visualization plugins:
- RobotModel
- TF
- LaserScan
- Camera
- Markers
Toolbar (Top)
- Move camera
- Select objects
- Measure tool
- 2D Nav Goal (for navigation)
Views Panel (Bottom-left)
- Orbit view (default)
- FPS view
- TopDown view
- XYOrbit view
3D View (Center)
Main visualization area:
- Left-click drag: rotate
- Middle-click drag: pan
- Scroll: zoom
Essential Displays
RobotModel Display
Shows robot URDF with links and joints. Add Display:- Click “Add” button
- Select “RobotModel”
- Configure:
- Description Topic:
/robot_description(default) - TF Prefix: (leave empty)
- Alpha: 1.0 (fully opaque)
- Visual Enabled: ✓
- Collision Enabled: ☐ (usually off)
- Description Topic:
- “No transform from [link] to [link]” → TF tree broken
- “URDF file failed to load” → Check
robot_state_publisherrunning
TF Display
Shows coordinate frame axes (RGB = XYZ). Add Display:- Click “Add”
- Select “TF”
- Configure:
- Show Names: ✓ (show frame labels)
- Show Axes: ✓
- Show Arrows: ☐ (usually off)
- Marker Scale: 0.3 (size of axes)
- Frame Timeout: 15 (seconds)
- Red: X-axis (forward)
- Green: Y-axis (left)
- Blue: Z-axis (up)
Grid Display
Ground reference. Configure:- Plane: XY (horizontal)
- Cell Size: 0.5 m
- Color: Gray
Fixed Frame Selection
Fixed Frame is the reference for all visualizations. Common choices:base_footprint(recommended for robot-centric view)base_link(robot base)odom(world-fixed, shows robot movement)map(for navigation)
- Displays → Global Options → Fixed Frame → Select from dropdown
Joint State Publisher
Allows testing movable joints interactively.Joint State Publisher (Basic)
Publishes fixed joint states (all joints at 0):Joint State Publisher GUI
Provides sliders for each joint:- Slider for each continuous/revolute joint
- Real-time URDF update in RViz
- Reset button
- Randomize button (testing)
Expected Behavior:
- Moving slider → wheel rotates in RViz
- All 4 wheels should rotate around Y-axis
TF Debugging
View TF Tree
Generate visual TF tree diagram:Check Specific Transform
- Translation X: 0.15m (front)
- Translation Y: 0.175m (left)
- Translation Z: -0.05m (below, wheel radius)
TF Tree Monitoring
Advanced RViz Configuration
Save Custom Configuration
After setting up displays:- File → Save Config As
- Save to
mecanum_description/rviz/urdf.rviz - Update launch file to load config automatically
Multiple Configurations
Create different configs for different tasks:urdf.rviz- URDF visualization onlyteleop.rviz- Add velocity arrows, odometrynavigation.rviz- Add map, path, costmapsdebug.rviz- Add markers, diagnostics
Visualization Tips
Color-code robot parts
Color-code robot parts
Assign different colors to easily identify parts:
- Base: Orange
- Wheels: Silver/Gray
- Sensors: Black (LiDAR), Blue (IMU)
- Mounts: Green
Hide/show parts selectively
Hide/show parts selectively
In RViz:
- Expand “RobotModel” display
- Expand “Links”
- Uncheck links to hide (e.g., hide wheels during sensor alignment)
Measure distances
Measure distances
RViz Measure Tool:
- Toolbar → Measure (ruler icon)
- Click start point
- Click end point
- Distance shown in meters
- Verify wheel spacing
- Check sensor heights
- Validate clearances
View from different angles
View from different angles
Orbit Camera (default):
- Left-drag: rotate around focal point
- Shift + left-drag: pan
- Scroll: zoom
- Views panel → Type → Select:
- TopDownOrtho: Top view (good for wheel alignment)
- FPS: First-person (good for sensor FOV)
- XYOrbit: Side view (good for height verification)
Check for visual artifacts
Check for visual artifacts
Common issues:
- Z-fighting: Two surfaces overlap (flicker)
- Solution: Offset surfaces slightly
- Inside-out meshes: Faces rendered wrong
- Solution: Fix normals in CAD software
- Missing textures: Mesh appears black
- Solution: Embed textures or use materials instead
Testing Procedures
Visual Inspection Checklist
-
Base link:
- Correct size (length, width, height)
- Centered at origin
- Proper orientation (X forward, Z up)
-
Wheels:
- 4 wheels present
- Positioned at corners
- Touching ground (Z = 0 at
base_footprint) - Correct orientation (can roll forward)
-
Sensors:
- LiDAR on top, unobstructed view
- IMU at center of base
- Frames aligned (X forward)
-
TF Frames:
- All frames visible in TF display
- Axes follow ROS convention
- No disconnected frames
-
Joint Motion:
- Wheel joints rotate smoothly (GUI sliders)
- No collision between parts
- Rotation axis correct (Y-axis for wheels)
Physical Measurements Comparison
Measure real robot, compare with URDF in RViz:| Parameter | Real Robot | URDF (RViz) | Match? |
|---|---|---|---|
| Base length | ___ mm | 400 mm | ☐ |
| Base width | ___ mm | 300 mm | ☐ |
| Base height | ___ mm | 100 mm | ☐ |
| Wheel diameter | ___ mm | 100 mm | ☐ |
| Wheelbase (FL to RL) | ___ mm | 300 mm | ☐ |
| Track width (FL to FR) | ___ mm | 350 mm | ☐ |
| LiDAR height | ___ mm | 200 mm | ☐ |
Simulation vs Reality
Before first real-world test:- Drive robot forward 1m (encoder odometry)
- Measure actual distance traveled
- If mismatch:
- Check wheel radius in URDF
- Verify encoder CPR
- Calibrate odometry
Common Visualization Issues
No robot visible in RViz
No robot visible in RViz
Causes & Solutions:
-
No robot_description published:
If empty →
robot_state_publishernot running -
Fixed frame invalid:
- Change Fixed Frame to
base_link
- Change Fixed Frame to
-
RobotModel display not added:
- Add → RobotModel → OK
-
Alpha = 0 (invisible):
- RobotModel → Alpha → 1.0
TF errors in RViz
TF errors in RViz
Error: “No transform from [base_link] to [wheel_FL]”Causes:
robot_state_publishernot running- URDF syntax error (joint references nonexistent link)
- TF tree disconnected
Parts in wrong position
Parts in wrong position
Symptom: Wheels floating, sensor underground, etc.Solution:
- Check
<origin xyz="..." rpy="..."/>in URDF - Verify parent/child links in joints
- Use TF debugging:
Joint doesn't move
Joint doesn't move
Symptom: GUI slider doesn’t affect robotCauses:
- Joint type is
fixed(should becontinuous) - Joint name mismatch
joint_state_publisherpublishing conflicting states
Mesh not loading
Mesh not loading
Error: “Could not load resource [package://…/…/file.stl]”Solutions:
-
Verify file exists:
-
Check package name in path:
-
Rebuild package:
Recording and Playback
Save RViz Screenshots
For documentation:- 3D View → Right-click → “Save Image”
- Or: File → Export → Screenshot
Record Bag File
Record TF and joint states for playback:Integration with Real Robot
Once URDF validated:Publish Real Joint States
From ESP32 (via microROS or serial bridge):- Wheels now rotate in sync with real robot!
Visualize Sensor Data
Add LaserScan display:Next Steps
ros2_control Setup
Add hardware interfaces to URDF for motor control
Teleop Control
Control robot with keyboard commands
Localization Setup
Publish odometry from wheel encoders
TF2 Reference
Deep dive into coordinate transforms