Skip to content

Commit 5eaf7d7

Browse files
authored
Merge pull request #132 from utn-mi/develop
Version 0.2.0
2 parents c70c621 + bf74c23 commit 5eaf7d7

82 files changed

Lines changed: 4779 additions & 2186 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Checks: 'clang-diagnostic-*,clang-analyzer-*,bug-prone-*'
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,bug-prone-*,-clang-diagnostic-ignored-optimization-argument'
33
WarningsAsErrors: ''
44
HeaderFilterRegex: 'src/*.h'
55
AnalyzeTemporaryDtors: false

.github/workflows/cpp.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,23 @@ on:
33
workflow_call:
44
pull_request:
55
paths:
6-
- "src/**"
6+
- "src/**"
7+
- ".github/workflows/**"
78

89
jobs:
910
build_clang:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4
1314
- name: Install dependencies
14-
run: sudo apt-get install --yes build-essential cmake git libpoco-dev libeigen3-dev libxslt-dev libcoin-dev libccd-dev libglfw3-dev libboost-all-dev liblzma-dev ninja-build clang-15 clang-tidy-15 clang-format
15-
# uses: awalsh128/cache-apt-pkgs-action@latest
16-
# with:
17-
# packages: build-essential cmake git libpoco-dev libeigen3-dev libxslt-dev libcoin-dev libccd-dev libglfw3-dev libboost-all-dev liblzma-dev ninja-build clang-15 clang-tidy-15 clang-format
18-
# version: 1.0
15+
run: sudo apt install $(cat debian_deps.txt)
1916
- name: Check clang format
2017
run: make cppcheckformat
21-
- name: Set up Python 3.10
18+
- name: Set up Python 3.11
2219
uses: actions/setup-python@v5
2320
with:
24-
python-version: '3.10'
25-
cache: 'pip'
21+
python-version: "3.11"
22+
cache: "pip"
2623
- name: Clang build
2724
run: make clangcompile
2825
- name: Clang Tidy
@@ -33,11 +30,11 @@ jobs:
3330
steps:
3431
- uses: actions/checkout@v4
3532
- name: Install dependencies
36-
run: sudo apt-get install --yes build-essential cmake git libpoco-dev libeigen3-dev libxslt-dev libcoin-dev libccd-dev libglfw3-dev libboost-all-dev liblzma-dev ninja-build clang-15 clang-tidy-15 clang-format
37-
- name: Set up Python 3.10
33+
run: sudo apt install $(cat debian_deps.txt)
34+
- name: Set up Python 3.11
3835
uses: actions/setup-python@v5
3936
with:
40-
python-version: '3.10'
41-
cache: 'pip'
37+
python-version: "3.11"
38+
cache: "pip"
4239
- name: GCC build
4340
run: make gcccompile

.github/workflows/py.yaml

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,20 @@ on:
33
workflow_call:
44
pull_request:
55
paths:
6-
- "python/**"
7-
- "src/pybind/**"
6+
- "python/**"
7+
- "src/pybind/**"
8+
- ".github/workflows/**"
89

910
jobs:
10-
lint:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: Set up Python 3.10
15-
uses: actions/setup-python@v5
16-
with:
17-
python-version: '3.10'
18-
cache: 'pip'
19-
- name: Install linting and formatting dependencies
20-
run: python -m pip install -r requirements_dev.txt
21-
- name: Code linting
22-
run: make pylint
23-
2411
format:
2512
runs-on: ubuntu-latest
2613
steps:
2714
- uses: actions/checkout@v4
2815
- name: Set up Python 3.10
2916
uses: actions/setup-python@v5
3017
with:
31-
python-version: '3.10'
32-
cache: 'pip'
18+
python-version: "3.10"
19+
cache: "pip"
3320
- name: Install linting and formatting dependencies
3421
run: python -m pip install -r requirements_dev.txt
3522
- name: Check formatting
@@ -40,32 +27,31 @@ jobs:
4027
env:
4128
CC: clang-15
4229
CXX: clang++-15
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4331
steps:
4432
- uses: actions/checkout@v4
4533
- name: Install CPP dependencies
46-
run: sudo apt-get install --yes build-essential cmake git libpoco-dev libeigen3-dev libxslt-dev libcoin-dev libccd-dev libglfw3-dev libboost-all-dev liblzma-dev ninja-build clang-15
47-
# uses: awalsh128/cache-apt-pkgs-action@latest
48-
# with:
49-
# packages: build-essential cmake git libpoco-dev libeigen3-dev libxslt-dev libcoin-dev libccd-dev libglfw3-dev libboost-all-dev liblzma-dev ninja-build clang-15 clang-tidy-15 clang-format
50-
# version: 1.0
51-
- name: Set up Python 3.10
34+
run: sudo apt install $(cat debian_deps.txt)
35+
- name: Install virtual frame buffer tool
36+
run: sudo apt install xvfb
37+
- name: Set up Python 3.11
5238
uses: actions/setup-python@v5
5339
with:
54-
python-version: '3.10'
55-
cache: 'pip'
40+
python-version: "3.11"
41+
cache: "pip"
5642
- name: Install building dependencies
5743
run: python -m pip install -r requirements_dev.txt
58-
- name: Create python wheel
59-
run: python -m build --wheel --outdir dist/
60-
- name: Install the wheel package
61-
run: python -m pip install dist/*.whl
44+
- name: Install wheel
45+
run: python -m pip install wheel
46+
- name: Download the models using cmake
47+
env:
48+
MODEL_TOKEN: ${{ secrets.MODEL_TOKEN }}
49+
run: cmake -G Ninja -B build -DINCLUDE_UTN_MODELS=ON -DGITLAB_MODELS_TOKEN="$MODEL_TOKEN" -DMUJOCO_VERSION=3.1.5
50+
- name: Install the package
51+
run: python -m pip install --no-build-isolation .
52+
- name: Code linting
53+
run: make pylint
6254
- name: Check that stub files are up-to-date
6355
run: make stubgen && git diff --exit-code
64-
- name: Upload Artifact
65-
uses: actions/upload-artifact@v4
66-
with:
67-
name: rcsss
68-
path: dist/*.whl
69-
retention-days: 30
7056
- name: Ensure all unittests(pytest) are passing
71-
run: make pytest
57+
run: xvfb-run make pytest

.github/workflows/release.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
workflow_run:
7+
workflows: ["Python", "Cpp"]
8+
branches: [master]
9+
types:
10+
- completed
11+
12+
jobs:
13+
release:
14+
if: ${{ startsWith(github.event.head_commit.message, 'bump:') and github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
name: "Bump version and create changelog with commitizen"
19+
steps:
20+
- name: Check out
21+
uses: actions/checkout@v4
22+
- name: Create bump and changelog
23+
uses: commitizen-tools/commitizen-action@master
24+
with:
25+
changelog_increment_filename: body.md
26+
commit: false
27+
push: false
28+
- name: Release
29+
uses: ncipollo/release-action@v1
30+
with:
31+
tag: v${{ env.REVISION }}
32+
bodyFile: "body.md"
33+
skipIfReleaseExists: true
34+
# TODO: create pypi source distribution

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.cache
2-
.vscode
32
build
43
plugin.h
54
.session.vim
@@ -14,3 +13,6 @@ config.yaml
1413
MUJOCO_LOG.TXT
1514
src/pybind/mujoco
1615
python/mujoco
16+
config.h
17+
wheels
18+
.env

.vscode/c_cpp_properties.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"/usr/include/eigen3",
8+
"/usr/include/python3.11"
9+
],
10+
"defines": [],
11+
"compilerPath": "/usr/bin/clang",
12+
"cStandard": "c17",
13+
"cppStandard": "c++17",
14+
"intelliSenseMode": "linux-clang-x64",
15+
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
16+
}
17+
],
18+
"version": 4
19+
}

.vscode/launch.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Test realsense",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"module": "rcsss",
12+
"console": "integratedTerminal",
13+
"args": ["realsense", "test", "config.yaml"],
14+
"justMyCode": true,
15+
},
16+
{
17+
"name": "Record with realsense",
18+
"type": "debugpy",
19+
"request": "launch",
20+
"module": "rcsss",
21+
"console": "integratedTerminal",
22+
"args": ["realsense", "test-record", "config.yaml"],
23+
"justMyCode": true,
24+
},
25+
{
26+
"name": "Debug python tests",
27+
"type": "debugpy",
28+
"request": "launch",
29+
"module": "pytest",
30+
"console": "integratedTerminal",
31+
"args": ["-vv"],
32+
"justMyCode": true,
33+
"cwd": "${workspaceFolder}"
34+
},
35+
36+
// C++
37+
{
38+
"name": "C++ Launch",
39+
"type": "cppdbg",
40+
"request": "launch",
41+
"program": "${workspaceFolder}/build/bin/test_cam",
42+
// "args": ["arg1", "arg2"],
43+
// "environment": [{ "name": "config", "value": "Debug" }],
44+
"cwd": "${workspaceFolder}"
45+
},
46+
]
47+
}

CMakeLists.txt

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ project(
77
DESCRIPTION "UTNs Robot Control Stack Library"
88
)
99

10-
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW) # Set version in project
10+
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
11+
12+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Allow us to set options for subprojects
13+
14+
cmake_policy(SET CMP0048 NEW) # Set version in project
1115
# Allow target properties affecting visibility during linking in static libraries
1216
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
13-
set(CMAKE_POLICY_DEFAULT_CMP0072 NEW) # Use GLVND instead of legacy libGL.so
14-
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Allow us to set options for subprojects
17+
cmake_policy(SET CMP0072 NEW) # Use GLVND instead of legacy libGL.so
18+
cmake_policy(SET CMP0135 NEW) # Use timestamp of file extraction not download
19+
cmake_policy(SET CMP0140 NEW) # Check return arguments
1520

1621
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
1722
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -34,30 +39,52 @@ set(RL_BUILD_RL_SG OFF)
3439
set(RL_BUILD_TESTS OFF)
3540
set(RL_BUILD_EXTRAS OFF)
3641

42+
option(INCLUDE_UTN_MODELS "Whether to include the private UTN models. Requires GITLAB_MODELS_TOKEN to be set to a valid token wit read_api permissions" OFF)
43+
3744
include(FetchContent)
45+
46+
find_package(Eigen3 REQUIRED)
47+
find_package(glfw3 REQUIRED)
48+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
49+
find_package(MuJoCo REQUIRED)
50+
3851
FetchContent_Declare(
3952
libfranka
4053
GIT_REPOSITORY https://github.com/frankaemika/libfranka.git
41-
GIT_TAG 0.10.0
54+
GIT_TAG 0.13.3
4255
GIT_PROGRESS TRUE
4356
EXCLUDE_FROM_ALL
4457
)
4558
FetchContent_Declare(rl
4659
GIT_REPOSITORY https://github.com/roboticslibrary/rl.git
47-
GIT_TAG master
60+
GIT_TAG 0b3797215345a1d37903634095361233d190b2e6
4861
GIT_PROGRESS TRUE
4962
EXCLUDE_FROM_ALL
5063
)
5164
FetchContent_Declare(pybind11
5265
GIT_REPOSITORY https://github.com/pybind/pybind11.git
53-
GIT_TAG master
66+
GIT_TAG v2.13.4
5467
GIT_PROGRESS TRUE
5568
EXCLUDE_FROM_ALL
5669
)
5770

5871
FetchContent_MakeAvailable(libfranka rl pybind11)
5972

60-
find_package(Eigen3 REQUIRED)
61-
find_package(glfw3 REQUIRED)
73+
if (${INCLUDE_UTN_MODELS})
74+
if (DEFINED GITLAB_MODELS_TOKEN)
75+
include(download_scenes)
76+
set(ref 77e8782a3488cbf01361d2322f02e75c0d820644)
77+
FetchContent_Declare(
78+
scenes
79+
URL "https://gitos.rrze.fau.de/api/v4/projects/1100/repository/archive?path=scenes&sha=${ref}"
80+
HTTP_HEADER "PRIVATE-TOKEN: ${GITLAB_MODELS_TOKEN}"
81+
)
82+
FetchContent_MakeAvailable(scenes)
83+
resolve_symlinks(${ref})
84+
else()
85+
message(FATAL_ERROR "GITLAB_MODELS_TOKEN missing. Not including lab scene")
86+
endif()
87+
endif()
88+
include(compile_scenes)
6289

6390
add_subdirectory(src)

Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PYSRC = python/rcsss
22
CPPSRC = src
3+
COMPILE_MODE = Release
34

45
# CPP
56
cppcheckformat:
@@ -11,14 +12,14 @@ cppformat:
1112
cpplint:
1213
clang-tidy -p=build --warnings-as-errors='*' $(shell find ${CPPSRC} -name '*.cpp' -o -name '*.cc' -name '*.h')
1314

14-
# NOTE: when changing the version, also change it in the pyproject.toml
15-
MUJOCO_VERSION=3.1.5
1615
gcccompile:
17-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DMUJOCO_VERSION=${MUJOCO_VERSION} -B build -G Ninja
16+
pip install --upgrade --requirement requirements_dev.txt
17+
cmake -DCMAKE_BUILD_TYPE=${COMPILE_MODE} -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -B build -G Ninja
1818
cmake --build build
1919

2020
clangcompile:
21-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DMUJOCO_VERSION=${MUJOCO_VERSION} -B build -G Ninja
21+
pip install --upgrade --requirement requirements_dev.txt
22+
cmake -DCMAKE_BUILD_TYPE=${COMPILE_MODE} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build -G Ninja
2223
cmake --build build
2324

2425
# Auto generation of CPP binding stub files
@@ -27,7 +28,7 @@ stubgen:
2728
find ./python -name '*.pyi' -print | xargs sed -i '1s/^/# ATTENTION: auto generated from C++ code, use `make stubgen` to update!\n/'
2829
find ./python -not -path "./python/rcsss/_core/*" -name '*.pyi' -delete
2930
find ./python/rcsss/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[typing\.Literal\[\([0-9]\+\)\], typing\.Literal\[1\]\]/typing\.Literal[\1]/g'
30-
31+
find ./python/rcsss/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[\([M|N]\), typing\.Literal\[1\]\]/\1/g'
3132
ruff check --fix python/rcsss/_core
3233
isort python/rcsss/_core
3334
black python/rcsss/_core
@@ -47,9 +48,15 @@ ruff:
4748
ruff check ${PYSRC}
4849

4950
mypy:
50-
mypy ${PYSRC} --install-types --non-interactive
51+
mypy ${PYSRC} --install-types --non-interactive --no-namespace-packages
5152

5253
pytest:
5354
pytest -vv
5455

55-
.PHONY: cppcheckformat cppformat cpplint gcccompile clangcompile stubgen pycheckformat pyformat pylint ruff mypy pytest
56+
bump:
57+
cz bump
58+
59+
commit:
60+
cz commit
61+
62+
.PHONY: cppcheckformat cppformat cpplint gcccompile clangcompile stubgen pycheckformat pyformat pylint ruff mypy pytest bump commit

0 commit comments

Comments
 (0)