Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Arkenau authored Sep 18, 2023
0 parents commit 426f080
Show file tree
Hide file tree
Showing 22 changed files with 1,036 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/Dockerfile
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
48 changes: 48 additions & 0 deletions .devcontainer/devcontainer.json
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"
]
}
}
}
38 changes: 38 additions & 0 deletions .devcontainer/repos_to_submodules.py
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)
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=src:install/lib/python3.10/site-packages
6 changes: 6 additions & 0 deletions .github/actions/lint/action.yml
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"
5 changes: 5 additions & 0 deletions .github/actions/lint/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

./setup.sh
ament_${LINTER} src/
6 changes: 6 additions & 0 deletions .github/actions/test/action.yml
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"
6 changes: 6 additions & 0 deletions .github/actions/test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

./setup.sh
./build.sh
./test.sh
7 changes: 7 additions & 0 deletions .github/dependabot.yml
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
17 changes: 17 additions & 0 deletions .github/workflows/docs.yaml
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]
50 changes: 50 additions & 0 deletions .github/workflows/ros.yaml
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!"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/*
install/*
log/*
site/*
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
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
}
90 changes: 90 additions & 0 deletions .vscode/launch.json
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"
}
]
}
Loading

0 comments on commit 426f080

Please sign in to comment.