Overview
Thepost-create.sh script performs one-time initialization when the development container is first created. It sets up the ROS2 environment, clones TurtleBot3 repositories, and configures user settings.
Location: .devcontainer/post-create.sh
Execution: Automatically run by postCreateCommand in devcontainer.json
Runtime: Approximately 1-2 minutes (depends on network speed)
Script structure
Initialization
GPU detection
- Checks if
glxinfois available - Tests for direct rendering support
- Sets
USE_SOFTWARE_RENDERINGflag for later use - Defaults to software rendering if detection fails
ROS2 environment setup
Bashrc configuration
The script appends comprehensive configuration to~/.bashrc:
ROS2 setup
- Sources ROS2 Jazzy on every shell startup
- Sources workspace overlay if built
- Sets ROS_DOMAIN_ID to 30 (isolates network traffic)
- Configures TurtleBot3 Burger as default model
- Uses CycloneDDS as DDS implementation
- Sets Gazebo Harmonic as simulator version
Software rendering fallback
Bash aliases
Workspace permissions
Repository cloning
- Intelligent detection of existing repositories
- Validates content by checking for package.xml
- Idempotent: safe to run multiple times
- Clones Jazzy branch from official ROBOTIS repositories
- DynamixelSDK: Motor control SDK
- turtlebot3_msgs: Message definitions
- turtlebot3: Core packages
- turtlebot3_simulations: Gazebo simulation
Package verification
Dependency management
- Initialize rosdep database (if not done)
- Update rosdep package lists
- Install all package dependencies from src/
--from-paths src: Scan src/ directory--ignore-src: Don’t install packages we’re building-r: Continue on error-y: Answer yes to prompts
Additional setup
Maps directory
GPU info file
~/GPU_INFO.txt with:
- GPU vendor and renderer information
- Direct rendering status
- Troubleshooting hint for Gazebo crashes
Completion message
Exit behavior
- Success: Exits with code 0
- Failure: Exits with non-zero code (due to
set -e)
Files modified
~/.bashrc: Appended with ROS2 configuration and aliases~/GPU_INFO.txt: Created with GPU information~/maps/: Directory created/workspace/turtlebot3_ws/src/: Repositories cloned