Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NASA Challenge_[@AndrejOrsula]_[Parallel ProcGen Environments] #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 56 additions & 0 deletions spaceros_procgen_envs/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "${localWorkspaceFolderBasename}",
"build": {
"context": "${localWorkspaceFolder}",
"dockerfile": "${localWorkspaceFolder}/Dockerfile.bundle_isaac_sim",
"cacheFrom": "openrobotics/spaceros_procgen_envs"
},
"workspaceFolder": "/home/spaceros-user/spaceros_procgen_envs",
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/home/spaceros-user/spaceros_procgen_envs",
"runArgs": [
// Network mode
"--network=host",
"--ipc=host",
// NVIDIA GPU
"--gpus=all",
// Other GPUs
"--device=/dev/dri:/dev/dri",
"--group-add=video"
],
"mounts": [
// Local time
"type=bind,source=/etc/localtime,target=/etc/localtime,readonly",
// Input devices
"type=bind,source=/dev/input,target=/dev/input",
// GUI (X11)
"type=bind,source=/tmp/.X11-unix,target=/tmp/.X11-unix",
"type=bind,source=${localEnv:TMPDIR:/tmp}/xauth_docker_vsc_${localWorkspaceFolderBasename},target=${localEnv:TMPDIR:/tmp}/xauth_docker_vsc_${localWorkspaceFolderBasename}",
// Cache (compiled shaders, proceduraly generated assets, etc.)
"type=bind,source=${HOME}/.cache/spaceros_demos/isaac_sim/computecache,target=/home/spaceros-user/.nv/ComputeCache",
"type=bind,source=${HOME}/.cache/spaceros_demos/isaac_sim/glcache,target=/home/spaceros-user/.cache/nvidia/GLCache",
"type=bind,source=${HOME}/.cache/spaceros_demos/isaac_sim/kit,target=/home/spaceros-user/isaac-sim/kit/cache",
"type=bind,source=${HOME}/.cache/spaceros_demos/isaac_sim/ov,target=/home/spaceros-user/.cache/ov",
"type=bind,source=${HOME}/.cache/spaceros_demos/procgen_envs,target=/home/spaceros-user/.cache/spaceros_procgen_envs"
],
"containerEnv": {
// GUI (X11)
"DISPLAY": "${localEnv:DISPLAY}",
"XAUTHORITY": "${localEnv:TMPDIR:/tmp}/xauth_docker_vsc_${localWorkspaceFolderBasename}",
// NVIDIA GPU
"NVIDIA_VISIBLE_DEVICES": "all",
"NVIDIA_DRIVER_CAPABILITIES": "all"
},
"initializeCommand": "XAUTH=\"${localEnv:TMPDIR:/tmp}/xauth_docker_vsc_${localWorkspaceFolderBasename}\"; touch \"${XAUTH}\"; chmod a+r \"${XAUTH}\"; XAUTH_LIST=$(xauth nlist \"${localEnv:DISPLAY}\"); if [ -n \"${XAUTH_LIST}\" ]; then echo \"${XAUTH_LIST}\" | sed -e 's/^..../ffff/' | xauth -f \"${XAUTH}\" nmerge -; fi",
"customizations": {
"vscode": {
"extensions": [
// Python
"ms-python.black-formatter",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance"
// Note: Add your preferred extensions here
]
}
}
}
28 changes: 28 additions & 0 deletions spaceros_procgen_envs/.devcontainer/open.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e

SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" &>/dev/null && pwd)"
DEMO_DIR="$(dirname "${SCRIPT_DIR}")"

## Determine the workspace folder
if [[ -n "$1" ]]; then
# Use the first argument as the workspace folder if provided
WORKSPACE_FOLDER="$1"
else
# Otherwise, try to extract the workspace folder from `./devcontainer.json`
WORKSPACE_FOLDER="$(grep -Po '"workspaceFolder":.*?[^\\]",' "${SCRIPT_DIR}/devcontainer.json" | cut -d'"' -f4 || true)"
if [[ -z "${WORKSPACE_FOLDER}" ]]; then
# If `./devcontainer.json` does not contain the workspace folder, default to the root
WORKSPACE_FOLDER="/"
fi
fi

## Open the Dev Container in VS Code
CODE_REMOTE_CMD=(
code --remote
"dev-container+$(printf "%s" "${DEMO_DIR}" | xxd -p | tr -d "[:space:]")"
"${WORKSPACE_FOLDER}"
)
echo -e "\033[1;90m${CODE_REMOTE_CMD[*]}\033[0m" | xargs
# shellcheck disable=SC2048
exec ${CODE_REMOTE_CMD[*]}
34 changes: 34 additions & 0 deletions spaceros_procgen_envs/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Python
**/__pycache__/
**/.pytest_cache/
**/*.pcd
**/*.py[cod]
**/*.pyc
**/*$py.class

## Rust
target/
**/*.rs.bk
**/*.pdb
**/.cargo/config.toml
!.cargo/config.toml

## Shared Objects
**/*.so

## Dump files
**/core.*

## Logs
logs/

## Docker
Dockerfile*
.dockerignore
build.sh
join.sh
run.sh

## Git
.git/
.gitignore
23 changes: 23 additions & 0 deletions spaceros_procgen_envs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Python
**/__pycache__/
**/.pytest_cache/
**/*.pcd
**/*.py[cod]
**/*.pyc
**/*$py.class

## Rust
target/
**/*.rs.bk
**/*.pdb
**/.cargo/config.toml
!.cargo/config.toml

## Shared Objects
**/*.so

## Dump files
**/core.*

## Logs
logs/
28 changes: 28 additions & 0 deletions spaceros_procgen_envs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.5)
project(spaceros_procgen_envs)

## Find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)

## Install Python package
ament_python_install_package(spaceros_procgen_envs)

## Install Python scripts
set(SCRIPTS_DIR scripts)
install(PROGRAMS
${SCRIPTS_DIR}/blender/procgen_assets.py
${SCRIPTS_DIR}/agent_random.py
${SCRIPTS_DIR}/agent_zero.py
${SCRIPTS_DIR}/clean_procgen_cache.py
${SCRIPTS_DIR}/list_envs.py
${SCRIPTS_DIR}/run_spaceros.py
${SCRIPTS_DIR}/teleop.py
DESTINATION lib/${PROJECT_NAME}
)

## Install directories
install(DIRECTORY apps config launch DESTINATION share/${PROJECT_NAME})

## Setup the project
ament_package()
Loading
Loading