Implementation:CARLA simulator Carla Show Junctions Tool
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Visualization, Utility |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
Command-line utility script that visualizes all junctions on the current CARLA map, including bounding boxes, driving/sidewalk waypoints, and connected traffic lights.
Description
This script (show_junctions.py) discovers all junctions from the map topology and renders comprehensive junction information in the simulation viewport. It iterates through tmap.get_topology() to find unique junctions, then for each junction: draws a dark blue wireframe bounding box (Color(0,0,128)) with the junction ID label, renders green arrows (Color(0,128,0)) for driving lane entry-to-exit waypoint pairs, red arrows (Color(128,0,0)) for sidewalk waypoint pairs, and purple arrows (Color(128,0,128)) connecting the junction center to each associated traffic light. All geometry is elevated by 0.5 units above ground for visibility. The visualization duration is configurable via the --show argument.
Usage
Use this tool to inspect junction geometry, verify driving and sidewalk lane connectivity, and confirm traffic light associations within junctions for map validation and debugging.
Code Reference
Source Location
- Repository: CARLA
- File: PythonAPI/util/show_junctions.py
Signature
def main():
"""Discover and visualize all junctions with waypoints and traffic lights."""
Import
# Run as a command-line tool:
python show_junctions.py --show 100
I/O Contract
| Argument | Type | Default | Description |
|---|---|---|---|
| --host | str | 127.0.0.1 | CARLA server IP address |
| -p, --port | int | 2000 | CARLA server TCP port |
| --show | float | 100 | Duration of the visualization in seconds |
| Visual Element | Color | Description |
|---|---|---|
| Junction bounding box | Dark blue (0,0,128) | Wireframe box with junction ID text |
| Driving waypoints | Green (0,128,0) | Arrows from entry to exit waypoints |
| Sidewalk waypoints | Red (128,0,0) | Arrows from entry to exit waypoints |
| Traffic light links | Purple (128,0,128) | Arrows from junction center to traffic lights |
Usage Examples
# Visualize all junctions for 100 seconds
python show_junctions.py
# Extended visualization for map review
python show_junctions.py --show 500
# Remote server
python show_junctions.py --host 192.168.1.100 --show 60