generated from athackst/vscode_ros2_workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julian Arkenau
authored
Sep 18, 2023
0 parents
commit 426f080
Showing
22 changed files
with
1,036 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM althack/ros2:humble-dev | ||
|
||
# ** [Optional] Uncomment this section to install additional packages. ** | ||
# | ||
# ENV DEBIAN_FRONTEND=noninteractive | ||
# RUN apt-get update \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> \ | ||
# # | ||
# # Clean up | ||
# && apt-get autoremove -y \ | ||
# && apt-get clean -y \ | ||
# && rm -rf /var/lib/apt/lists/* | ||
# ENV DEBIAN_FRONTEND=dialog | ||
|
||
# Set up auto-source of workspace for ros user | ||
ARG WORKSPACE | ||
RUN echo "if [ -f ${WORKSPACE}/install/setup.bash ]; then source ${WORKSPACE}/install/setup.bash; fi" >> /home/ros/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// See https://aka.ms/vscode-remote/devcontainer.json for format details. | ||
{ | ||
"dockerFile": "Dockerfile", | ||
"build": { | ||
"args": { | ||
"WORKSPACE": "${containerWorkspaceFolder}" | ||
} | ||
}, | ||
"remoteUser": "ros", | ||
"runArgs": [ | ||
"--network=host", | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt=seccomp:unconfined", | ||
"--security-opt=apparmor:unconfined", | ||
"--volume=/tmp/.X11-unix:/tmp/.X11-unix", | ||
"--volume=/mnt/wslg:/mnt/wslg", | ||
"--ipc=host" | ||
// uncomment to use intel iGPU | ||
// "--device=/dev/dri" | ||
], | ||
"containerEnv": { | ||
"DISPLAY": "${localEnv:DISPLAY}", // Needed for GUI try ":0" for windows | ||
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}", | ||
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}", | ||
"PULSE_SERVER": "${localEnv:PULSE_SERVER}", | ||
"LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl | ||
}, | ||
// Set *default* container specific settings.json values on container create. | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"althack.ament-task-provider", | ||
"betwo.b2-catkin-tools", | ||
"DotJoshJohnson.xml", | ||
"ms-azuretools.vscode-docker", | ||
"ms-iot.vscode-ros", | ||
"ms-python.python", | ||
"ms-vscode.cpptools", | ||
"redhat.vscode-yaml", | ||
"smilerobotics.urdf", | ||
"streetsidesoftware.code-spell-checker", | ||
"twxs.cmake", | ||
"yzhang.markdown-all-in-one", | ||
"zachflower.uncrustify" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import glob | ||
import os | ||
import subprocess | ||
import yaml | ||
|
||
prefix="src" | ||
|
||
def add_git_submodule(repo_name, repo_url, repo_version): | ||
subprocess.call(['git', 'submodule', 'add', '-b', repo_version, repo_url, repo_name]) | ||
|
||
def is_submodule(repo_name): | ||
try: | ||
subprocess.check_output(['git', 'submodule', 'status', repo_name], stderr=subprocess.DEVNULL) | ||
return True | ||
except subprocess.CalledProcessError: | ||
return False | ||
|
||
def parse_repos_file(file_path): | ||
with open(file_path, 'r') as file: | ||
repos_data = yaml.safe_load(file) | ||
repositories = repos_data['repositories'] | ||
|
||
for repo_name, repo_info in repositories.items(): | ||
if 'type' in repo_info and repo_info['type'] == 'git': | ||
repo_url = repo_info['url'] | ||
repo_version = repo_info['version'] | ||
submodule_name = os.path.join(prefix, repo_name) | ||
|
||
if not is_submodule(submodule_name): | ||
add_git_submodule(submodule_name, repo_url, repo_version) | ||
print(f"Added {repo_name} as a submodule.") | ||
|
||
# Find .repos files within the src directory | ||
repos_files = glob.glob('src/**/*.repos', recursive=True) | ||
|
||
# Process each .repos file | ||
for repos_file in repos_files: | ||
parse_repos_file(repos_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PYTHONPATH=src:install/lib/python3.10/site-packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: 'Lint' | ||
description: 'Lint using devcontainer' | ||
runs: | ||
using: 'docker' | ||
image: '../../../.devcontainer/Dockerfile' | ||
entrypoint: ".github/actions/lint/run.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
./setup.sh | ||
ament_${LINTER} src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: 'Test' | ||
description: 'Test using devcontainer' | ||
runs: | ||
using: 'docker' | ||
image: '../../../.devcontainer/Dockerfile' | ||
entrypoint: ".github/actions/test/run.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
./setup.sh | ||
./build.sh | ||
./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: docs | ||
|
||
on: | ||
release: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build and push docs | ||
uses: athackst/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: ROS | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- foxy* | ||
- humble* | ||
- iron* | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout code | ||
uses: actions/checkout@v4 | ||
- | ||
name: Test | ||
uses: ./.github/actions/test/ | ||
|
||
lint: | ||
name: ament_${{ matrix.linter }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
linter: [cppcheck, cpplint, uncrustify, lint_cmake, xmllint, flake8, pep257] | ||
steps: | ||
- | ||
name: Checkout code | ||
uses: actions/checkout@v4 | ||
- | ||
name: Run linter | ||
uses: ./.github/actions/lint/ | ||
env: | ||
LINTER: ${{ matrix.linter }} | ||
|
||
complete: | ||
name: Tests passed | ||
needs: | ||
- lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check | ||
run: echo "Completed successfully!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/* | ||
install/* | ||
log/* | ||
site/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**", | ||
"/opt/ros/humble/include/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "/usr/bin/gcc", | ||
"compileCommands": "${workspaceFolder}/build/compile_commands.json", | ||
"cStandard": "c99", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "linux-gcc-x64" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
// Example launch of a python file | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"program": "${file}", | ||
"console": "integratedTerminal", | ||
}, | ||
// Example gdb launch of a ros executable | ||
{ | ||
"name": "(gdb) Launch (merge-install)", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/install/lib/${input:package}/${input:program}", | ||
"args": [], | ||
"preLaunchTask": "build", | ||
"stopAtEntry": true, | ||
"cwd": "${workspaceFolder}", | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "(gdb) Launch (isolated-install)", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/install/${input:package}/lib/${input:package}/${input:program}", | ||
"args": [], | ||
"preLaunchTask": "build", | ||
"stopAtEntry": true, | ||
"cwd": "${workspaceFolder}", | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
//Example of a ROS Launch file | ||
{ | ||
"name": "ROS: Launch File (merge-install)", | ||
"type": "ros", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"target": "${workspaceFolder}/install/share/${input:package}/launch/${input:ros_launch}", | ||
}, | ||
{ | ||
"name": "ROS: Launch File (isolated-install)", | ||
"type": "ros", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"target": "${workspaceFolder}/install/${input:package}/share/${input:package}/launch/${input:ros_launch}", | ||
}, | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "package", | ||
"type": "promptString", | ||
"description": "Package name", | ||
"default": "examples_rclcpp_minimal_publisher" | ||
}, | ||
{ | ||
"id": "program", | ||
"type": "promptString", | ||
"description": "Program name", | ||
"default": "publisher_member_function" | ||
}, | ||
{ | ||
"id": "ros_launch", | ||
"type": "promptString", | ||
"description": "ROS launch name", | ||
"default": "file_name_launch.py" | ||
} | ||
] | ||
} |
Oops, something went wrong.