Skip to content

Commit

Permalink
Jiminy release 1.7.19 (#700)
Browse files Browse the repository at this point in the history
* [core] Refactor random number generator to remove global state.
* [core] Fix sensor delay.
* [core] Fix sensor measurement at start.
* [core] Heightmap discretization now returns a geometry object and support decimation.
* [core] Fix broken PeriodicFourierProcess.
* [core] 'ForceSensor' measures only contact forces.
* [core] Improvement performance of 'swapMatrixRows' utility.
* [core] Avoid code duplication in 'swapJoints' utility.
* [core] Passing wrong size to 'isPositionValid' does not trigger exception anymore.
* [core] Use function pointer type by default for ControllerFunctor.
* [python/viewer] Detect Apple Silicon GPU to enable high-res shadow for panda3d.
* [python/viewer] Fix camera pose when travelling is enabled with panda3d.
* [python/viewer] Implement ground rendering from meshcat.
* [gym_jiminy/common] Fix support of empty arrays for 'contains' space utility.
* [gym_jiminy/common] More generic sample utility.
* [misc] Add core unit tests and cleanup CI scripts.
* [misc] Add support of Python 3.12 for jiminy_py.

---------

Co-authored-by: Alexis Duburcq <[email protected]>
  • Loading branch information
duburcqa and Alexis Duburcq authored Jan 30, 2024
1 parent 2e39130 commit ef88d8d
Show file tree
Hide file tree
Showing 95 changed files with 3,607 additions and 2,052 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11']
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11', '3.12']
BUILD_TYPE: ['Release']
include:
- PYTHON_VERSION: '3.8'
Expand All @@ -27,7 +27,6 @@ jobs:
shell: bash -ieo pipefail {0}

env:
TORCH_VERSION: "2.0.1+cpu"
CMAKE_CXX_FLAGS: "-march=x86-64-v3 -mtune=generic"

#####################################################################################
Expand Down Expand Up @@ -68,13 +67,16 @@ jobs:
sudo apt install -y gdb gnupg curl wget build-essential cmake doxygen graphviz texlive-latex-base
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0" "numba>=0.54.0"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0"
git config --global advice.detachedHead false
- name: Build project dependencies
- name: Build jiminy dependencies
run: |
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
"${PYTHON_EXECUTABLE}" -m pip install "torch==${TORCH_VERSION}" -f https://download.pytorch.org/whl/torch
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.12'
run: |
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.26,<0.29" "importlib-metadata>=3.3.0"
#####################################################################################
Expand All @@ -89,7 +91,8 @@ jobs:
-DBOOST_ROOT="$InstallDir" -DBoost_INCLUDE_DIR="$InstallDir/include" \
-DBoost_NO_SYSTEM_PATHS=TRUE -DBoost_NO_BOOST_CMAKE=TRUE -DBoost_USE_STATIC_LIBS=ON \
-DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON -DINSTALL_GYM_JIMINY=ON \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON \
-DINSTALL_GYM_JIMINY=${{ (matrix.PYTHON_VERSION == '3.12' && 'OFF') || 'ON' }} \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE="${{ matrix.BUILD_TYPE }}"
make install -j2
Expand All @@ -114,14 +117,12 @@ jobs:

- name: Run unit tests for jiminy
run: |
cd "$RootDir/build/core/unit"
ctest --output-on-failure
ctest --output-on-failure --test-dir "${RootDir}/build/core/unit"
cd "$RootDir/python/jiminy_py/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "$RootDir/python/jiminy_py/unit_py" -v
- name: Run unit tests for gym_jiminy
if: matrix.BUILD_TYPE == 'Release'
if: matrix.BUILD_TYPE == 'Release' && matrix.PYTHON_VERSION != '3.12'
run: |
cd "$RootDir/python/gym_jiminy/examples/reinforcement_learning/rllib"
gdb -batch -ex "run" -ex "bt" --args "${PYTHON_EXECUTABLE}" acrobot_ppo.py 2>&1 | \
Expand All @@ -131,8 +132,7 @@ jobs:
# because they require a different version of `gymnasium`.
"${PYTHON_EXECUTABLE}" -m pip install "stable_baselines3>=2.0"
cd "$RootDir/python/gym_jiminy/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "$RootDir/python/gym_jiminy/unit_py" -v
- name: Python static type checker
if: matrix.PYTHON_VERSION == '3.8' && matrix.BUILD_TYPE == 'Release'
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11']
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11', '3.12']
BUILD_TYPE: ['Release']
include:
- PYTHON_VERSION: '3.11'
Expand All @@ -27,7 +27,6 @@ jobs:
shell: bash -ieo pipefail {0}

env:
TORCH_VERSION: "2.0.1"
CMAKE_C_COMPILER: "/usr/bin/clang"
CMAKE_CXX_COMPILER: "/usr/bin/clang++"
CMAKE_CXX_FLAGS: "-DEIGEN_MPL2_ONLY -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -Wno-deprecated-declarations"
Expand Down Expand Up @@ -60,13 +59,16 @@ jobs:
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0" "numba>=0.54.0" "panda3d==1.10.12.*"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0"
"${PYTHON_EXECUTABLE}" -m pip install delocate twine
- name: Build project dependencies
- name: Build jiminy dependencies
run: |
OSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} OSX_ARCHITECTURES=${OSX_ARCHITECTURES} \
BUILD_TYPE="${{ matrix.BUILD_TYPE }}" ./build_tools/build_install_deps_unix.sh
"${PYTHON_EXECUTABLE}" -m pip install "torch==${TORCH_VERSION}" -f https://download.pytorch.org/whl/cpu
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.12'
run: |
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.26,<0.29" "importlib-metadata>=3.3.0"
#####################################################################################
Expand All @@ -87,8 +89,8 @@ jobs:
-DBOOST_ROOT="${InstallDir}" -DBoost_INCLUDE_DIR="${InstallDir}/include" \
-DBoost_NO_SYSTEM_PATHS=TRUE -DBoost_NO_BOOST_CMAKE=TRUE \
-DBoost_USE_STATIC_LIBS=ON -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON \
-DBUILD_PYTHON_INTERFACE=ON -DINSTALL_GYM_JIMINY=ON \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON \
-DINSTALL_GYM_JIMINY=${{ (matrix.PYTHON_VERSION == '3.12' && 'OFF') || 'ON' }} \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE="${{ matrix.BUILD_TYPE }}"
make -j2
Expand Down Expand Up @@ -159,8 +161,7 @@ jobs:
run: |
export DYLD_FALLBACK_LIBRARY_PATH="${InstallDir}/lib"
cd "${RootDir}/build/core/unit"
ctest --output-on-failure
ctest --output-on-failure --test-dir "${RootDir}/build/core/unit"
cd "${RootDir}/python/jiminy_py/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
Expand All @@ -174,18 +175,18 @@ jobs:
"${PYTHON_EXECUTABLE}" -m unittest test_pipeline_design.py -v
- name: Run unit tests for gym jiminy
if: matrix.BUILD_TYPE == 'Release'
if: matrix.BUILD_TYPE == 'Release' && matrix.PYTHON_VERSION != '3.12'
run: |
export LD_LIBRARY_PATH="${InstallDir}/lib/:/usr/local/lib"
# FIXME: segfault when enabling viewer for Panda3D 1.10.12
cd "${RootDir}/python/gym_jiminy/examples/reinforcement_learning/rllib"
JIMINY_VIEWER_DISABLE= "${PYTHON_EXECUTABLE}" acrobot_ppo.py
"${PYTHON_EXECUTABLE}" acrobot_ppo.py
# FIXME: Must install stable_baselines3 after running rllib test
# because they require a different version of `gymnasium`.
"${PYTHON_EXECUTABLE}" -m pip install "stable_baselines3>=2.0"
cd "${RootDir}/python/gym_jiminy/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${RootDir}/python/gym_jiminy/unit_py" -v
#########################################################################################

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
PYTHON_VERSION: ['cp38', 'cp39', 'cp310', 'cp311']
PYTHON_VERSION: ['cp38', 'cp39', 'cp310', 'cp311', 'cp312']

runs-on: ubuntu-20.04
container: 'quay.io/pypa/manylinux_2_28_x86_64:latest'
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
"${PYTHON_EXECUTABLE}" -m pip install setuptools wheel "pip>=20.3"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0" "numba>=0.54.0"
"${PYTHON_EXECUTABLE}" -m pip install "numpy>=1.21,<2.0"
"${PYTHON_EXECUTABLE}" -m pip install twine cmake
- name: Build project dependencies
run: |
Expand All @@ -75,8 +75,8 @@ jobs:
-DBOOST_ROOT="$InstallDir" -DBoost_INCLUDE_DIR="$InstallDir/include" \
-DBoost_NO_SYSTEM_PATHS=TRUE -DBoost_NO_BOOST_CMAKE=TRUE \
-DBoost_USE_STATIC_LIBS=ON -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON \
-DBUILD_PYTHON_INTERFACE=ON -DINSTALL_GYM_JIMINY=ON \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON \
-DINSTALL_GYM_JIMINY=${{ (matrix.PYTHON_VERSION == 'cp312' && 'OFF') || 'ON' }} \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_BUILD_TYPE="$BUILD_TYPE"
make -j2
Expand Down Expand Up @@ -195,8 +195,7 @@ jobs:
"$InstallDir/bin/pip_double_pendulum"
- name: Run unit tests on user environment
run: |
cd "${GITHUB_WORKSPACE}/python/jiminy_py/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${GITHUB_WORKSPACE}/python/jiminy_py/unit_py" -v
#####################################################################################

Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
# Using bash with automatic sourcing `.bashrc` and fail-fast behavior enabled
shell: bash -ieo pipefail {0}

env:
TORCH_VERSION: "2.0.1+cpu"

#####################################################################################

steps:
Expand Down Expand Up @@ -71,14 +68,13 @@ jobs:
echo "InstallDir=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Install pre-compiled dependencies
- name: Install pre-compiled project dependencies
run: |
sudo env "PATH=$PATH" "${RootDir}/build_tools/easy_install_deps_ubuntu.sh"
if [[ "${{ matrix.GENERATOR }}" == 'Ninja' ]] ; then
sudo apt install ninja-build
fi
"${PYTHON_EXECUTABLE}" -m pip install "torch==${TORCH_VERSION}" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "torch" -f https://download.pytorch.org/whl/torch
"${PYTHON_EXECUTABLE}" -m pip install "gymnasium>=0.26,<0.29" "importlib-metadata>=3.3.0"
#####################################################################################
Expand Down Expand Up @@ -134,11 +130,9 @@ jobs:
- name: Run unit tests for jiminy
run: |
cd "${RootDir}/build/core/unit"
ctest --output-on-failure
ctest --output-on-failure --test-dir "${RootDir}/build/core/unit"
cd "${RootDir}/python/jiminy_py/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${RootDir}/python/jiminy_py/unit_py" -v
- name: Run unit tests for gym_jiminy
if: matrix.BUILD_TYPE != 'Release'
Expand All @@ -154,8 +148,7 @@ jobs:
"${PYTHON_EXECUTABLE}" -m pip install "stable_baselines3>=2.0"
cd "${RootDir}/python/gym_jiminy/unit_py"
"${PYTHON_EXECUTABLE}" -m unittest discover -v
"${PYTHON_EXECUTABLE}" -m unittest discover -s "${RootDir}/python/gym_jiminy/unit_py" -v
#####################################################################################

Expand Down
32 changes: 15 additions & 17 deletions .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
shell: pwsh

env:
TORCH_VERSION: "2.0.1+cpu"
GENERATOR: "Visual Studio 17 2022"
CMAKE_CXX_FLAGS: "/DEIGEN_MPL2_ONLY /d2ReducedOptimizeHugeFunctions /fp:contract /arch:AVX2"

strategy:
matrix:
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11']
PYTHON_VERSION: ['3.8', '3.9', '3.10', '3.11', '3.12']
BUILD_TYPE: ['Release']
include:
- PYTHON_VERSION: '3.10'
Expand Down Expand Up @@ -58,16 +57,17 @@ jobs:
run: |
git config --global advice.detachedHead false
python -m pip install setuptools wheel "pip>=20.3"
python -m pip install "numpy>=1.21,<2.0" "numba>=0.54.0"
python -m pip install "numpy>=1.21,<2.0"
python -m pip install pefile machomachomangler
- name: Build project dependencies
- name: Build jiminy dependencies
run: |
if ("${{ matrix.PYTHON_VERSION }}" -ne '3.11') {
python -m pip install "torch==${env:TORCH_VERSION}" -f https://download.pytorch.org/whl/torch
python -m pip install "gymnasium>=0.26,<0.29" "importlib-metadata>=3.3.0"
}
${env:BUILD_TYPE} = "${{ matrix.BUILD_TYPE }}"
& "./workspace/build_tools/build_install_deps_windows.ps1"
- name: Install pre-compiled binaries for additional gym-jiminy dependencies
if: matrix.PYTHON_VERSION != '3.11' && matrix.PYTHON_VERSION != '3.12'
run: |
python -m pip install "torch" -f https://download.pytorch.org/whl/torch
python -m pip install "gymnasium>=0.26,<0.29" "importlib-metadata>=3.3.0"
#####################################################################################

Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
-DBoost_NO_SYSTEM_PATHS=TRUE -DBoost_NO_BOOST_CMAKE=TRUE `
-DBoost_USE_STATIC_LIBS=ON -DPYTHON_REQUIRED_VERSION="${{ matrix.PYTHON_VERSION }}" `
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON `
-DINSTALL_GYM_JIMINY=${{ (matrix.PYTHON_VERSION == '3.11' && 'OFF') || 'ON' }} `
-DINSTALL_GYM_JIMINY=${{ ((matrix.PYTHON_VERSION == '3.11' || matrix.PYTHON_VERSION == '3.12') && 'OFF') || 'ON' }} `
-DCMAKE_CXX_FLAGS="${env:CMAKE_CXX_FLAGS} $(
) -DBOOST_ALL_NO_LIB -DBOOST_LIB_DIAGNOSTIC -DBOOST_CORE_USE_GENERIC_CMATH $(
) -DEIGENPY_STATIC -DURDFDOM_STATIC -DHPP_FCL_STATIC -DPINOCCHIO_STATIC"
Expand Down Expand Up @@ -179,11 +179,9 @@ jobs:
run: |
$RootDir = "${env:GITHUB_WORKSPACE}/workspace" -replace '\\', '/'
Set-Location -Path "$RootDir/build/core/unit"
ctest --output-on-failure
ctest --output-on-failure --test-dir "${RootDir}/build/core/unit"
Set-Location -Path "$RootDir/python/jiminy_py/unit_py"
python -m unittest discover -v
python -m unittest discover -s "${RootDir}/python/jiminy_py/unit_py" -v
- name: Run unit tests for gym_jiminy
if: matrix.BUILD_TYPE != 'Release'
Expand All @@ -194,18 +192,18 @@ jobs:
python -m unittest test_pipeline_control.py test_pipeline_design.py -v
- name: Running unit tests for gym_jiminy
if: matrix.BUILD_TYPE == 'Release' && matrix.PYTHON_VERSION != '3.11'
if: matrix.BUILD_TYPE == 'Release' && matrix.PYTHON_VERSION != '3.11' && matrix.PYTHON_VERSION != '3.12'
run: |
$RootDir = "${env:GITHUB_WORKSPACE}/workspace" -replace '\\', '/'
Set-Location -Path "$RootDir/python/gym_jiminy/examples/reinforcement_learning/rllib"
$JIMINY_VIEWER_DEFAULT_BACKEND = "panda3d-sync"
python acrobot_ppo.py
# FIXME: Must install stable_baselines3 after running rllib test
# because they require a different version of `gymnasium`.
python -m pip install "stable_baselines3>=2.0"
Set-Location -Path "$RootDir/python/gym_jiminy/unit_py"
python -m unittest discover -v
python -m unittest discover -s "$RootDir/python/gym_jiminy/unit_py" -v
#########################################################################################

Expand Down
4 changes: 3 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ disable =
cyclic-import

# Enable the message, report, category or checker with the given id(s)
enable = c-extension-no-member
enable =
c-extension-no-member,
useless-suppression

[tool.pylint.miscellaneous]
# List of note tags to take in consideration, separated by a comma.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.12.4)

# Set the build version (specify a tweak version to indicated post-release if needed)
set(BUILD_VERSION 1.7.18.1)
set(BUILD_VERSION 1.7.19)

# Set compatibility
set(COMPATIBILITY_VERSION SameMinorVersion)
Expand Down
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ set(SRC
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities/helpers.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities/pinocchio.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities/json.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities/geometry.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities/random.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/io/abstract_io_device.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/io/memory_device.cc"
Expand Down
Loading

0 comments on commit ef88d8d

Please sign in to comment.