cmvr-es/script/build_ompl.sh
lgv 37a62fb3e3 feat(arm): add collision-aware planning and refactor motion control
Integrate OMPL RRTConnect and quintic B-spline smoothing into moveP, reuse
the B-spline trajectory generator for moveJ, and remove the TOPPRA paths
and dependencies. Separate joint and Cartesian planners, smoothers, and
the standalone curve math library.

Move speedL execution into SpeedLExecutor, tighten velocity QP feasibility,
and add adaptive speed reduction, braking recovery, feedback-derived TCP
velocity, and grouped cyclic velocity submission. Improve MuJoCo control
cycle synchronization and camera streaming.

Centralize kinematics and collision geometry in RobotModel, expose box
obstacles through CollisionChecker, and extract SelfCollisionMonitor for
protective stops and recovery. Add cancellable moveP pre-approach and
configurable failure recovery to the touch workflow, with updated configs,
documentation, and regression coverage.

Validation: recorded -j8 build and 133 passing tests on 2026-10-08, including
headless MuJoCo checks for eight target poses and seven moveJ returns.
Static scene configuration removal passed 27 follow-up tests and six arm
configuration parses. Staged diff and shell syntax checks pass; no new
hardware tests were run for this commit.
2026-10-13 09:18:06 +08:00

63 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Build the same portable x86-64 OMPL core used by this project's dependency
# bundle. No system installation or sudo is required.
cmvr_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
cmvr_ompl_version=2.0.2
cmvr_ompl_sha256=d867190a46a7f730923475a68af2e09fc9e796017a59be395a4bf3900d0c3ae4
if [[ $(uname -m) != x86_64 ]]; then
echo 'This dependency recipe targets x86-64; ARM needs a separate toolchain build.' >&2
exit 1
fi
cmvr_ompl_prefix="$cmvr_root/dependency/x86/third_party/ompl/v$cmvr_ompl_version"
cmvr_eigen_prefix="$cmvr_root/dependency/x86/third_party/Eigen3/v3.4.0"
cmvr_ompl_work=$(mktemp -d "${TMPDIR:-/tmp}/cmvr-ompl.XXXXXXXX")
trap 'rm -rf -- "$cmvr_ompl_work"' EXIT
cmvr_ompl_archive="$cmvr_ompl_work/ompl.tar.gz"
if [[ -n ${CMVR_OMPL_ARCHIVE:-} ]]; then
cp -- "$CMVR_OMPL_ARCHIVE" "$cmvr_ompl_archive"
else
curl --fail --location --retry 3 --connect-timeout 15 --max-time 300 \
"https://codeload.github.com/ompl/ompl/tar.gz/refs/tags/$cmvr_ompl_version" \
-o "$cmvr_ompl_archive"
fi
printf '%s %s\n' "$cmvr_ompl_sha256" "$cmvr_ompl_archive" | sha256sum --check -
tar -xzf "$cmvr_ompl_archive" -C "$cmvr_ompl_work"
cmvr_ompl_source="$cmvr_ompl_work/ompl-$cmvr_ompl_version"
cmake -S "$cmvr_ompl_source" -B "$cmvr_ompl_work/build" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$cmvr_ompl_prefix" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_PREFIX_PATH="$cmvr_eigen_prefix" \
'-DCMAKE_INSTALL_RPATH=$ORIGIN' \
-DOMPL_SKIP_RPATH=ON \
-DOMPL_VERSIONED_INSTALL=OFF \
-DOMPL_BUILD_SHARED=ON \
-DOMPL_BUILD_VAMP=OFF \
-DOMPL_BUILD_PYTHON_BINDINGS=OFF \
-DOMPL_BUILD_DEMOS=OFF \
-DOMPL_BUILD_TESTS=OFF \
-DCMAKE_DISABLE_FIND_PACKAGE_flann=ON \
-DCMAKE_DISABLE_FIND_PACKAGE_Triangle=ON \
-DCMAKE_DISABLE_FIND_PACKAGE_spot=ON \
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON \
-DCMAKE_DISABLE_FIND_PACKAGE_Python=ON
cmake --build "$cmvr_ompl_work/build" --target ompl --parallel "${CMVR_OMPL_JOBS:-4}"
# Upstream's exported CMake targets use the default install component. Stage a
# full install, then retain just the headers, library, and package metadata.
cmake --install "$cmvr_ompl_work/build" --prefix "$cmvr_ompl_work/install" --strip
# Resolve Eigen's deprecated include variable on the consumer's machine instead
# of retaining the absolute path of the machine that built this bundle.
sed -i \
's@^list(APPEND OMPL_INCLUDE_DIRS .*Eigen3/v3\.4\.0)@list(APPEND OMPL_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIRS}")@' \
"$cmvr_ompl_work/install/share/ompl/cmake/omplConfig.cmake"
mkdir -p "$cmvr_ompl_prefix/lib" "$cmvr_ompl_prefix/share/ompl"
cp -a "$cmvr_ompl_work/install/include" "$cmvr_ompl_prefix/"
# Remove headers left by an earlier build using OMPL's versioned layout.
rm -rf -- "$cmvr_ompl_prefix/include/ompl-2.0"
cp -a "$cmvr_ompl_work/install/lib/"libompl.so* "$cmvr_ompl_prefix/lib/"
cp -a "$cmvr_ompl_work/install/share/ompl/cmake" "$cmvr_ompl_prefix/share/ompl/"
printf 'Installed OMPL %s to %s\n' "$cmvr_ompl_version" "$cmvr_ompl_prefix"