Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
573c36c
fix: only normalize DISPLAY for bare-number values
CPrutean Aug 3, 2026
14095f8
feat: add macOS and Windows devcontainer variants for GUI forwarding
CPrutean Aug 3, 2026
d2bc186
feat: render Gazebo and RViz through VirtualGL on remote X servers
CPrutean Aug 3, 2026
c9cfc10
docs: document macOS and Windows GUI forwarding setup
CPrutean Aug 3, 2026
eb57b73
feat: moved from a docker compose centric dev container to a devconta…
CPrutean Aug 5, 2026
286409b
feat: moved from a docker compose centric dev container to a devconta…
CPrutean Aug 5, 2026
93875d1
fix: fixed some issues in chrono workflow
CPrutean Aug 5, 2026
5eeaf6e
feat: consolidated devcontainers into one file with overrides
CPrutean Aug 5, 2026
ef2f695
feat: removed unnecessary comments
CPrutean Aug 6, 2026
ccf02ac
fix: fixed formatting
CPrutean Aug 6, 2026
5d31df8
refactor: prebuilt vsg & chrono
matejstastny Aug 6, 2026
ab0e5a9
fix: added ca-certs to chrono image
matejstastny Aug 6, 2026
8b984d4
fix: add git to dockerfile
matejstastny Aug 6, 2026
7732d42
fix: makefile got turned to some generated slop
matejstastny Aug 6, 2026
5f8797d
fix: bashrc missing new line
matejstastny Aug 6, 2026
695dd1f
fix: chrono cli process was eating a lot of things from it
matejstastny Aug 6, 2026
a90db39
fix: env reference (I am not done with this file more slop)
matejstastny Aug 6, 2026
b76e617
fix: restore build toolchain and fix arm64 SIGILL in chrono image
matejstastny Aug 6, 2026
187e567
chore: rewrite host-env detection to generate a single docker/.env
matejstastny Aug 7, 2026
fe228f9
chore: merge docker-compose-dev.yml into docker-compose.yml
matejstastny Aug 7, 2026
0618fd2
chore: point devcontainer.json at merged compose file and host-env.sh
matejstastny Aug 7, 2026
7128638
chore: add mdx formatter to vscode settings
matejstastny Aug 7, 2026
69d5476
docs: update x_server.sh comments for merged compose file
matejstastny Aug 7, 2026
a094ad4
chore: simplify gitignore for merged env file flow
matejstastny Aug 7, 2026
4b4c5e4
chore: trim comments in docker/.env.defaults
matejstastny Aug 7, 2026
f0d10eb
chore: trim comment in vsg-chrono.Dockerfile
matejstastny Aug 7, 2026
0871c0f
refactor: shorten launch.py diagnostics, link to docs
matejstastny Aug 7, 2026
b78b6b5
docs: rewrite docker setup guide for merged env flow
matejstastny Aug 7, 2026
c8330c0
docs: drop nvidia setup page, fold into docker guide
matejstastny Aug 7, 2026
b079e5e
docs: replace getting-started.mdx with index.mdx
matejstastny Aug 7, 2026
b20e98a
docs: consolidate reference docs into dev-notes.mdx
matejstastny Aug 7, 2026
98d371b
docs: consolidate gazebo internals docs into architecture.mdx
matejstastny Aug 7, 2026
c847e8f
docs: update sidebar config for restructured pages
matejstastny Aug 7, 2026
54999c3
docs: update gazebo docs cross-links for restructure
matejstastny Aug 7, 2026
13e6108
docs: update chrono docs cross-links for restructure
matejstastny Aug 7, 2026
598c0d2
docs: fix README links for docs restructure
matejstastny Aug 7, 2026
969e50c
chore: update imgui window size from local run
matejstastny Aug 7, 2026
1b36b29
refactor: docs restructure & @CPrutean 's XQuartz refactor rewrite #85
matejstastny Aug 7, 2026
0b2da41
Merge branch 'main' into feat/xquartz-forwarding
matejstastny Aug 7, 2026
a4ee25b
chore: minor fixes
matejstastny Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
{
"dockerComposeFile": ["../docker/docker-compose.yml", "../docker/docker-compose-dev.yml"],
"name": "simulations",
"dockerComposeFile": "../docker/docker-compose.yml",
"service": "sim",
"runServices": ["sim"],

"workspaceFolder": "/home/trickfire/simulations",
"remoteEnv": {
"HOST_WORKSPACE": "${localWorkspaceFolder}"
},
"initializeCommand": "bash .devcontainer/host-env.sh || true",
"postCreateCommand": "pip3 install --break-system-packages -e .", // install the sim cli
"postStartCommand": "bash ./.devcontainer/x_server.sh || true",

"customizations": {
"vscode": {
"settings": {
"workbench.activityBar.location": "default",
"shfmt.executablePath": "/usr/local/bin/shfmt"
},
"extensions": [
// --- Python ---
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"ms-python.mypy-type-checker",

// --- C and C++ ---
"ms-vscode.cmake-tools",
"josetr.cmake-language-support-vscode",
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.makefile-tools",

// --- Robotics / ROS / URDF / meshes ---
"Ranch-Hand-Robotics.rde-ros-2",
"smilerobotics.urdf",
"morningfrog.urdf-visualizer",
"misiekhardcore.stl-previewer",

// --- Container ---
"ms-azuretools.vscode-docker",

// --- Formatters ---
"esbenp.prettier-vscode",
"yzhang.markdown-all-in-one",
"DotJoshJohnson.xml",
"tamasfe.even-better-toml",
"github.vscode-github-actions",
"mkhl.shfmt"
"mkhl.shfmt",
"unifiedjs.vscode-mdx"
]
}
}
Expand Down
77 changes: 77 additions & 0 deletions .devcontainer/host-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -eu

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
docker_dir="$(cd "$script_dir/../docker" && pwd)"

defaults="$docker_dir/.env.defaults"
overrides="$docker_dir/.env.local"
env_out="$docker_dir/.env"

uname_s="$(uname -s 2>/dev/null || echo unknown)"

log() { printf "\033[1;36m%s\033[0m\n" "$1"; }

gpu_available() {
[ "$uname_s" = "Linux" ] || return 1
command -v nvidia-smi >/dev/null 2>&1 || return 1
nvidia-smi -L >/dev/null 2>&1 || return 1
docker info --format '{{json .Runtimes}}' 2>/dev/null | grep -q '"nvidia"' || return 1
}

gpu_runtime=""
gpu_available && gpu_runtime="nvidia"

write_display_env() {
case "$uname_s" in
Darwin)
echo "# host: macOS (XQuartz over TCP + VirtualGL)"
echo "DISPLAY=host.docker.internal:0"
echo "VGL_DISPLAY=:88"
echo "VGL_COMPRESS=proxy"
;;
MINGW* | MSYS* | CYGWIN*)
echo "# host: Windows (VcXsrv/X410 over TCP + VirtualGL)"
echo "DISPLAY=host.docker.internal:0"
echo "VGL_DISPLAY=:88"
echo "VGL_COMPRESS=proxy"
;;
Linux)
echo "# host: Linux/WSLg (direct socket passthrough)"
echo "DISPLAY=${DISPLAY:-:0}"
;;
*)
echo "# host: unknown ($uname_s) - falling back to local display :0"
echo "DISPLAY=${DISPLAY:-:0}"
;;
esac
}

write_env() {
echo "# generated by .devcontainer/host-env.sh - do not edit or commit"
echo "# to change ports/flags, edit docker/.env.defaults (shared) or docker/.env.local (yours)"
echo ""

cat "$defaults"

if [ -f "$overrides" ]; then
echo ""
echo "# --- user overrides (docker/.env.local) ---"
cat "$overrides"
fi

echo ""
echo "# --- host-detected (generated, do not edit) ---"
write_display_env
echo "SIM_GPU_RUNTIME=$gpu_runtime"

if [ -n "$gpu_runtime" ]; then
echo "NVIDIA_VISIBLE_DEVICES=all"
echo "NVIDIA_DRIVER_CAPABILITIES=graphics,display,compute,utility"
echo "__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
fi
}

write_env >"$env_out"

echo "[INFO] host=$uname_s gpu=${gpu_runtime:-none}"
53 changes: 0 additions & 53 deletions .devcontainer/nvidia/devcontainer.json

This file was deleted.

65 changes: 52 additions & 13 deletions .devcontainer/x_server.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env bash

# --------------------------------------------------------------------------------------------
# Starts a headless X11 desktop (Xorg/Xvfb + Openbox + x11vnc + noVNC) inside the container.
# Intended for running GUI apps (Gazebo) in Docker.
# Supports --verbose flag for debugging (prints all output to console instead of log file).
# --------------------------------------------------------------------------------------------
# Sets up the container's display: Wayland/X11 passthrough when available, otherwise a
# headless Xorg/Xvfb + Openbox + x11vnc + noVNC stack. See docs/setup/docker.mdx.

set -eo pipefail
trap '' HUP
Expand Down Expand Up @@ -57,19 +53,62 @@ parse_args() {
done
}

try_wayland_passthrough() {
start_vgl_3d_server() {
if [[ $DISPLAY == :* ]]; then
return 0
fi

if ! command -v vglrun >/dev/null 2>&1; then
log "[VGL] vglrun not found - skipping (Gazebo/RViz will not be able to render)"
return 0
fi

local vgl_display="${VGL_DISPLAY:-:88}"
if xdpyinfo -display "$vgl_display" &>/dev/null; then
log "[VGL] 3D X server already running on $vgl_display"
return 0
fi

log "[VGL] Starting VirtualGL 3D X server (Xvfb) on $vgl_display"
Xvfb "$vgl_display" -screen 0 2560x1440x24 >>"$LOG_FILE" 2>&1 &
local vgl_pid=$!
disown "$vgl_pid" 2>/dev/null || true

# Xvfb takes a moment to start listening; without this the first `sim gazebo` after a
# container start could race it and silently fall back to unaccelerated rendering.
local i
for i in $(seq 1 20); do
if xdpyinfo -display "$vgl_display" &>/dev/null; then
log "[VGL] 3D X server ready on $vgl_display"
return 0
fi
sleep 0.25
done

log "[VGL] WARNING: 3D X server on $vgl_display did not come up - see $LOG_FILE"
}

try_display_passthrough() {
if [ -n "$FORCE_VNC" ]; then
DISPLAY="${FORCE_VNC_DISPLAY:-:77}"
unset WAYLAND_DISPLAY
log "[X11] FORCE_VNC set. Forcing virtual display $DISPLAY + VNC/noVNC"
return
fi

# Case 1: Linux host with a Wayland compositor, or WSL2 with WSLg. The host socket is
# bind-mounted into /run/host-runtime by docker-compose.yml.
local wayland_sock="/run/host-runtime/${WAYLAND_DISPLAY:-wayland-0}"
if [ -S "$wayland_sock" ]; then
log "[X11] Using Wayland socket at $wayland_sock"
exit 0
fi

if [ -n "$DISPLAY" ] && xdpyinfo -display "$DISPLAY" &>/dev/null; then
log "[X11] Using host X11 display at $DISPLAY"
start_vgl_3d_server
exit 0
fi
}

detect_backend() {
Expand Down Expand Up @@ -158,7 +197,12 @@ start_services() {

main() {
parse_args "$@"
try_wayland_passthrough
try_display_passthrough

if [[ $DISPLAY != :* ]]; then
log "[X11] $DISPLAY unreachable; falling back to internal Xvfb/Xorg on :0"
DISPLAY=":0"
fi

detect_backend
parse_screen_resolution
Expand All @@ -167,11 +211,6 @@ main() {
: "${VNC_PORT:?VNC_PORT is not set}"
: "${NOVNC_PORT:?NOVNC_PORT is not set}"

if xdpyinfo -display "$DISPLAY" &>/dev/null; then
log "[ERROR] Display $DISPLAY is already in use!"
exit 1
fi

start_services
}

Expand Down
14 changes: 5 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@
!.vscode/launch.json
!.vscode/extensions.json

# pixi
.pixi/

# Python
# python
.mypy_cache
__pycache__
*.egg-info/
build/
**/.venv

# ROS2
# ros
gazebo/install
gazebo/build
gazebo/log

# sim create tests
# sim tests
cli/gazebo/create/tests

# chrono outputs
Expand All @@ -31,9 +28,8 @@ chrono/results/*

# env
**/*.env
!docker/.env
docker/.env
docker/.env.local

# trickfire-docs
.trickfire-docs/
dist/
.cache/
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[mdx]": {
"editor.wordWrap": "on",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
Expand Down Expand Up @@ -74,6 +78,5 @@
"${workspaceFolder}/gazebo/sim_common"
],
"ROS2.distro": "jazzy",
"cmake.ignoreCMakeListsMissing": true,
"autoDevcontainer.enabled": true
"cmake.ignoreCMakeListsMissing": true
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Robot simulations for TrickFire Robotics - Gazebo Harmonic (ROS 2 Jazzy) for rob

**Full documentation is at [docs.trickfirerobotics.com/simulations](https://docs.trickfirerobotics.com/simulations)**

- [Getting Started](https://docs.trickfirerobotics.com/simulations/getting-started) - native setup, Dev Container alternative, first launch
- [Getting Started](https://docs.trickfirerobotics.com/simulations) - native setup, Dev Container alternative, first launch
- [Running Gazebo](https://docs.trickfirerobotics.com/simulations/gazebo/gazebo) - `sim gazebo` CLI usage and flags
- [Running Chrono](https://docs.trickfirerobotics.com/simulations/chrono/chrono) - `sim chrono` CLI usage
- [Adding a New Robot](https://docs.trickfirerobotics.com/simulations/gazebo/adding-robots) - OnShape to Gazebo with `sim gazebo create`
- [Environment](https://docs.trickfirerobotics.com/simulations/reference/docker-environment) - Docker environment in depth
- [Dev Notes](https://docs.trickfirerobotics.com/simulations/dev-notes) - architecture decisions, Docker environment internals, CLI tips
1 change: 1 addition & 0 deletions chrono/data/vsg/imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Size=531,121
[Window][Simulation]
Pos=5,5
Size=238,362
Collapsed=1

Loading