Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pfernbac/curves
  • stonneau/curves
  • jchemin/curves
  • gsaurel/ndcurves
4 results
Show changes
Commits on Source (952)
Showing with 2169 additions and 97 deletions
# pre-commit run -a (Guilhem Saurel, 2022-07-27)
ffb995161cba59619cec1b70088eb1dd7c527b37
# format (Guilhem Saurel, 2022-04-04)
1f1525de5b2ae9daef224cc8b0c4f6e12edccc12
# Format: yapf 0.32 (Guilhem Saurel, 2022-01-28)
906e28c6bbae602474778823dc2fd934dfd2c479
# format (Guilhem Saurel, 2022-01-07)
631b1a618da82af020e7b1fb2fe5662d49a32c13
# python tests: format (Guilhem Saurel, 2022-01-07)
d6a87cf82c953e89e403e2cd1ce057a768697a8c
# [Tests][Python] clean formatting (Pierre Fernbach, 2020-05-04)
810ba652943b272a3e86eb888e1fec89959fc2a3
# remove StringIO, not available in Python 3 (Guilhem Saurel, 2019-08-06)
2c88bfbe0b9775f9da51d550c352e493430d3e60
name: Build ndcurves for Mac OS X/Linux via pip
on: [push, pull_request]
env:
CTEST_OUTPUT_ON_FAILURE: 1
CTEST_PARALLEL_LEVEL: 4
jobs:
ndcurves-pip:
name: "CI on ${{ matrix.os }} / python ${{ matrix.python-version }} with pip"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: ["ubuntu-latest"] # , "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- run: python -m pip install -U pip
- run: python -m pip install pin[build]
- run: echo "CMAKE_PREFIX_PATH=$(python -m cmeel cmake)" >> $GITHUB_ENV
- run: echo "LD_LIBRARY_PATH=$(python -m cmeel lib)" >> $GITHUB_ENV
- run: cmake -B build -S .
- run: cmake --build build
- run: cmake --build build -t test
name: "CI - Nix"
on:
push:
jobs:
nix:
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L
# Build and Release Folders
bin/
lib/
build/
build-rel/
# temp files
.*~
*.user
*.pyc
*.ipynb_checkpoints
include: http://rainboard.laas.fr/project/ndcurves/.gitlab-ci.yml
[submodule "cmake"]
path = cmake
url = https://github.com/jrl-umi3218/jrl-cmakemodules.git
pull_request_rules:
- name: merge automatically when CI passes and PR is approved
conditions:
- check-success = "CI on ubuntu-latest / python 3.8 with pip"
- check-success = "CI on ubuntu-latest / python 3.9 with pip"
- check-success = "CI on ubuntu-latest / python 3.10 with pip"
- check-success = "CI on ubuntu-latest / python 3.11 with pip"
- check-success = "CI on ubuntu-latest / python 3.12 with pip"
- check-success = "gitlab-ci"
- check-success = "nix (macos)"
- check-success = "nix (ubuntu)"
- check-success = "pre-commit.ci - pr"
- or:
- author = pre-commit-ci[bot]
- author = dependabot[bot]
actions:
merge:
ci:
autoupdate_branch: devel
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
exclude: poetry.lock
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
hooks:
- id: clang-format
args:
- --style=Google
exclude: python/test/sandbox/test.ipynb
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [2.0.0] - 2024-12-05
- :warning: BREAKING: switch from boost smart pointers to std ones
- setup nix
- setup mergify
## [1.4.1] - 2024-04-12
- tests: fix use of np.random in tests
- CMake: enable python bindings by default
## [1.4.0] - 2024-04-12
- Add a SO3 curves which is C2. It's called S03Smooth
- Add some typedef on using 3D curves.
- Fix typos around the package
- Add some tests on polynomials and the new structs.
- update tooling
- update packaging
- add pip CI
## [1.3.1] - 2023-11-29
### Changed
- ⚠️ require CMake 3.10 ⚠️
### Added
- python: define CopyableVisitor, fix SerializableVisitor and use them
### Fixed
- cmake generation on macosx
- Supporting pinocchio installed with cppad (#108)
- fix E721
## [1.3.0] - 2023-07-19
- add stubs support
- fix RPATH for OSX
## [1.2.0] - 2023-05-13
- [python] Enabled support to copy and deepcopy
- [python] Removed deprecated macros in eigenpy
- update for eigenpy v3
- pre-commit update
- sync submodule
- CMake: fetch submodule, set default build type, bump standard
## [1.1.6] - 2023-01-24
- don't build python bindings by default, to be more gentle with PAL robotics buildfarm.
## [1.1.5] - 2022-08-29
- fix allocator
- modernize cmake
## [1.1.4] - 2022-06-29
- remove unary function, deprecated since C++11 and removed in C++17
## [1.1.3] - 2022-05-31
## [1.1.2] - 2022-02-09
- [cmake] Improve Eigen detection/usage
- fix format
## [1.1.1] - 2022-01-06
- fix virtual functions
- fix optional dependency to pinocchio
- primitive now accept initial value\n
## [1.1.0] - 2021-05-03
- make dependency on pinocchio not mandatory
- fix link to Boost::serialization
- use eigen matrix serialization from pinocchio >= 2.6.0 if available
- export -DCURVES_WITH_PINOCCHIO_SUPPORT
## [1.0.0] - 2021-03-18
- ⚠️ library renamed from curves to ndcurves ⚠️
- added arithmetic operations on curves
## [0.5.2] - 2020-09-24
- fix CMake for fedora
## [0.5.1] - 2020-07-27
- fix serialization versioning
## [0.5.0] - 2020-07-25
- Add piecewise::load_from_text_file
- New curves type required by sot-talos-balance
- Use Bezier formulation for cubic hermite
- Check input degree before converting curve to bezier or hermite
- remove cubic and quintic classes
## [0.4.1] - 2020-04-02
Changes since v0.4.0:
- [CMake] fix pinocchio detection
- [CMake] export CURVES_WITH_PINOCCHIO_SUPPORT
## [0.4.0] - 2020-03-30
Changes since v0.3.3:
- [Python] Add pickle support
- Add serialization/curves header
## [0.3.3] - 2020-03-11
Changes since v0.3.2:
- CMake Exports
## [0.3.2] - 2020-02-13
Changes since v0.3.1:
- [Python] Fix binding of Piecewise.curve_at_index
- Replace several critical asserts with exceptions
- Install the header python_definitions.h in include/python
- Add python API to retrieve bezier waypoints as 2D array
- Add C++ and python API to retrieve the translation or rotation curve contained in a SE3 curve
- Correctly specify the corresponding shared_pointer to all python class
- Fix SO3 constructors when t_min == t_max
- Correctly check and raise error when trying to use polynomial constructors from boundary condition when t_min == t_max
- Reworking of the exposition of the abstract class in Python (fix https://gepgitlab.laas.fr/loco-3d/curves/issues/32)
- Correctly register the shared_pointer of the base abstract classes in boost::Python
## [0.3.1] - 2020-02-13
Changes since v0.3.0:
- [CMake] add INSTALL_PYTHON_INTERFACE_ONLY option
- Update README
## [0.3.0] - 2020-01-10
Changes since v0.2.0:
- [CMake] update minimal eigenpy version
- Add operator == and != for all curves
- Add methods isApprox() and isEquivalent() to all curves
- Fix optional dependency to pinocchio for python bindings
- [Python][Tests] remove all unecessary reshape(-1,1) in python
- Rework the class piecewise_curve to make it generic and remove the need to specify the type of curve used as a template argument, can now mix any kind of curves inside
- Rework the methods convert_to_X_from_Y to convert_to_X and remove the need to specify the input type as template argument
- Add compute_derivate_ptr() method to curve_abc and implement it in all child classes
- Add degree() method to curve_abc and implement it in all child class
- Factorize the most commonly used typedef with template argument in fwd.h
- [Python] correctly define eigenpy matrix type for point3 and point6
- [CMake] fix hardcoded path
- [CMake] fix install path of optimization files
- [Tests][Python] use Quaternion.isApprox to test equality instead of ==
- Add SE3 with pinocchio
- Add conversion functions from piecewise curve to python bindings
- Optimization
- Fix all compiler warnings
- Export plot
## [0.2.0] - 2019-10-04
- Initial release
[Unreleased]: https://github.com/loco-3d/ndcurves/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/loco-3d/ndcurves/compare/v1.4.1...v2.0.0
[1.4.1]: https://github.com/loco-3d/ndcurves/compare/v1.4.0...v1.4.1
[1.4.0]: https://github.com/loco-3d/ndcurves/compare/v1.3.1...v1.4.0
[1.3.1]: https://github.com/loco-3d/ndcurves/compare/v1.3.0...v1.3.1
[1.3.0]: https://github.com/loco-3d/ndcurves/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/loco-3d/ndcurves/compare/v1.1.6...v1.2.0
[1.1.6]: https://github.com/loco-3d/ndcurves/compare/v1.1.5...v1.1.6
[1.1.5]: https://github.com/loco-3d/ndcurves/compare/v1.1.4...v1.1.5
[1.1.4]: https://github.com/loco-3d/ndcurves/compare/v1.1.3...v1.1.4
[1.1.3]: https://github.com/loco-3d/ndcurves/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/loco-3d/ndcurves/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/loco-3d/ndcurves/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/loco-3d/ndcurves/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/loco-3d/ndcurves/compare/v0.5.2...v1.0.0
[0.5.2]: https://github.com/loco-3d/ndcurves/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/loco-3d/ndcurves/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/loco-3d/ndcurves/compare/v0.4.1...v0.5.0
[0.4.1]: https://github.com/loco-3d/ndcurves/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/loco-3d/ndcurves/compare/v0.3.3...v0.4.0
[0.3.3]: https://github.com/loco-3d/ndcurves/compare/v0.3.2...v0.3.3
[0.3.2]: https://github.com/loco-3d/ndcurves/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/loco-3d/ndcurves/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/loco-3d/ndcurves/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/loco-3d/ndcurves/releases/tag/v0.2.0
cmake_minimum_required(VERSION 2.6)
project(spline)
cmake_minimum_required(VERSION 3.10)
# Project properties
set(PROJECT_ORG loco-3d)
set(PROJECT_NAME ndcurves)
set(PROJECT_DESCRIPTION "creatie and manipulate spline and bezier curves.")
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/build/")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/lib/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin/")
# Project options
option(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
option(INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
# Project configuration
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)
set(CXX_DISABLE_WERROR TRUE)
add_subdirectory (src/spline)
add_subdirectory (src/tests/spline_test)
# JRL-cmakemodule setup
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
endif()
include("${JRL_CMAKE_MODULES}/base.cmake")
include("${JRL_CMAKE_MODULES}/boost.cmake")
include(CMakeDependentOption)
cmake_dependent_option(
GENERATE_PYTHON_STUBS
"Generate the Python stubs associated to the Python library" OFF
BUILD_PYTHON_INTERFACE ON)
set_default_cmake_build_type("Release")
# Project definition
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
check_minimal_cxx_standard(14 ENFORCE)
# Project dependencies
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/find-external/CppAD/"
${CMAKE_MODULE_PATH})
find_package(Eigen3 QUIET NO_CMAKE_PACKAGE_REGISTRY)
if(Eigen3_FOUND)
add_project_dependency(Eigen3 REQUIRED NO_CMAKE_PACKAGE_REGISTRY
PKG_CONFIG_REQUIRES eigen3)
else(Eigen3_FOUND)
add_project_dependency(Eigen3 MODULE REQUIRED PKG_CONFIG_REQUIRES eigen3)
endif(Eigen3_FOUND)
find_package(pinocchio QUIET)
option(CURVES_WITH_PINOCCHIO_SUPPORT "Build with pinocchio support"
${pinocchio_FOUND})
if(CURVES_WITH_PINOCCHIO_SUPPORT)
if(NOT pinocchio_FOUND)
message(
FATAL_ERROR
"CURVES_WITH_PINOCCHIO_SUPPORT selected, but pinocchio has not been found"
)
endif(NOT pinocchio_FOUND)
add_project_dependency(pinocchio REQUIRED PKG_CONFIG_REQUIRES)
pkg_config_append_cflags("-DCURVES_WITH_PINOCCHIO_SUPPORT")
endif(CURVES_WITH_PINOCCHIO_SUPPORT)
set(PACKAGE_EXTRA_MACROS
"SET(CURVES_WITH_PINOCCHIO_SUPPORT ${CURVES_WITH_PINOCCHIO_SUPPORT})")
add_project_dependency(Boost REQUIRED COMPONENTS serialization)
if(BUILD_PYTHON_INTERFACE)
add_project_dependency(eigenpy 3.0.0 REQUIRED PKG_CONFIG_REQUIRES
"eigenpy >= 3.0.0")
endif(BUILD_PYTHON_INTERFACE)
# Main Library
set(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/bernstein.h
include/${PROJECT_NAME}/bezier_curve.h
include/${PROJECT_NAME}/constant_curve.h
include/${PROJECT_NAME}/cross_implementation.h
include/${PROJECT_NAME}/cubic_hermite_spline.h
include/${PROJECT_NAME}/curve_abc.h
include/${PROJECT_NAME}/curve_constraint.h
include/${PROJECT_NAME}/curve_conversion.h
include/${PROJECT_NAME}/exact_cubic.h
include/${PROJECT_NAME}/fwd.h
include/${PROJECT_NAME}/helpers/effector_spline.h
include/${PROJECT_NAME}/helpers/effector_spline_rotation.h
include/${PROJECT_NAME}/linear_variable.h
include/${PROJECT_NAME}/MathDefs.h
include/${PROJECT_NAME}/optimization/definitions.h
include/${PROJECT_NAME}/optimization/details.h
include/${PROJECT_NAME}/optimization/integral_cost.h
include/${PROJECT_NAME}/optimization/quadratic_problem.h
include/${PROJECT_NAME}/piecewise_curve.h
include/${PROJECT_NAME}/polynomial.h
include/${PROJECT_NAME}/python/python_definitions.h
include/${PROJECT_NAME}/quadratic_variable.h
include/${PROJECT_NAME}/se3_curve.h
include/${PROJECT_NAME}/serialization/archive.hpp
include/${PROJECT_NAME}/serialization/curves.hpp
include/${PROJECT_NAME}/serialization/eigen-matrix.hpp
include/${PROJECT_NAME}/serialization/registeration.hpp
include/${PROJECT_NAME}/sinusoidal.h
include/${PROJECT_NAME}/so3_linear.h
include/${PROJECT_NAME}/so3_smooth.h)
add_library(${PROJECT_NAME} INTERFACE)
modernize_target_link_libraries(
${PROJECT_NAME}
SCOPE
INTERFACE
TARGETS
Eigen3::Eigen
INCLUDE_DIRS
${EIGEN3_INCLUDE_DIR})
target_include_directories(
${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost::serialization)
if(CURVES_WITH_PINOCCHIO_SUPPORT)
target_link_libraries(${PROJECT_NAME} INTERFACE pinocchio::pinocchio)
target_compile_definitions(${PROJECT_NAME}
INTERFACE -DCURVES_WITH_PINOCCHIO_SUPPORT)
endif(CURVES_WITH_PINOCCHIO_SUPPORT)
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)
if(BUILD_PYTHON_INTERFACE)
add_subdirectory(python)
endif(BUILD_PYTHON_INTERFACE)
add_subdirectory(tests)
# NDCurves
[![Pipeline status](https://gitlab.laas.fr/loco-3d/ndcurves/badges/master/pipeline.svg)](https://gitlab.laas.fr/loco-3d/ndcurves/commits/master)
[![Coverage report](https://gitlab.laas.fr/loco-3d/ndcurves/badges/master/coverage.svg?job=doc-coverage)](https://gepettoweb.laas.fr/doc/loco-3d/ndcurves/master/coverage/)
[![PyPI version](https://badge.fury.io/py/ndcurves.svg)](https://pypi.org/project/ndcurves)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/loco-3d/ndcurves/master.svg)](https://results.pre-commit.ci/latest/github/loco-3d/ndcurves)
A template-based Library for creating curves of arbitrary order and dimension, eventually subject to derivative constraints. The main use of the library is the creation of end-effector trajectories for legged robots.
To do so, tools are provided to:
- create **exact** splines of arbitrary order (that pass exactly by an arbitrary number waypoints)
- constrain initial / end velocities and acceleration for the spline.
- constrain take-off and landing phases to follow a straight line along a given normal (to avoid undesired collisions between the effector and the contact surface)
- automatically handle 3d rotation of the effector.
- create curves in SO3
- support partial symbolic differentiation of curves. You can represent control points as linear variables, and integrate / differentiate those variable curves. You can also compute the cross product of two curves, which is relevant for centroidal dynamics.
Several type of formulation are provided:
- Polynomials
- Bezier
- Hermite (only cubic hermite for now)
The library is template-based, thus generic: the curves can be of any dimension, and can be implemented in double or float and can work with kind variables like Vector, Transform, Matrix, ...
## Installation
### Installation through robotpkg
You can install this package through robotpkg. robotpkg is a package manager tailored for robotics softwares.
It greatly simplifies the release of new versions along with the management of their dependencies.
You just need to add the robotpkg apt repository to your sources.list and then use `sudo apt install robotpkg-py3\*-ndcurves`.
If you have never added robotpkg as a softwares repository, please follow first the instructions from 1 to 3; otherwise, go directly to instruction 4.
Those instructions are similar to the installation procedures presented in [http://robotpkg.openrobots.org/debian.html](http://robotpkg.openrobots.org/debian.html).
1. Add robotpkg as source repository to apt:
```bash
sudo tee /etc/apt/sources.list.d/robotpkg.list <<EOF
deb [arch=amd64] http://robotpkg.openrobots.org/wip/packages/debian/pub $(lsb_release -sc) robotpkg
deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -sc) robotpkg
EOF
```
2. Register the authentication certificate of robotpkg:
```bash
curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add -
```
3. You need to run at least once apt update to fetch the package descriptions:
```bash
sudo apt-get update
```
4. The installation of nd-curves:
```bash
sudo apt install robotpkg-py3\*-ndcurves # for Python 3
sudo apt install robotpkg-py27-ndcurves # for Python 2
```
Finally you will need to configure your environment variables, e.g.:
```bash
export PATH=/opt/openrobots/bin:$PATH
export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/openrobots/lib/python2.7/site-packages:$PYTHONPATH
```
### Installation from source
#### Dependencies
* [Eigen (version >= 3.2.2)](http://eigen.tuxfamily.org/index.php?title=Main_Page)
#### Additional dependencies for python bindings
* [Boost.Python](http://www.boost.org/doc/libs/1_63_0/libs/python/doc/html/index.html)
* [eigenpy](https://github.com/stack-of-tasks/eigenpy)
To handle this with cmake, use the recursive option to clone the repository.
For instance, using http:
```
git clone --recursive https://github.com/loco-3d/ndcurves $NDCURVES_DIR
```
Where $NDCURVES_DIR is to be replaced to your selected source folder.
The library is header only, so the build only serves to build the tests and python bindings:
```sh
cd $NDCURVES_DIR && mkdir build && cd build
cmake -DBUILD_PYTHON_INTERFACE=ON .. && make && make test
```
Switch the BUILD_PYTHON argument to OFF if you don't want to use the python bindings of the package.
If everything went fine you should obtain the following output:
```sh
100% tests passed, 0 tests failed out of 3
```
#### Optional: Python bindings installation
To install the Python bindings first enable the `BUILD_PYTHON_INTERFACE` option:
```
cmake -DBUILD_PYTHON_INTERFACE=ON ..
```
Then rebuild the library:
```
cd ${NDCURVES_DIR}/build
make && make test
```
To see example of use, you can refer to the [test file](https://github.com/loco-3d/ndcurves/blob/master/python/test/test.py)
which is rather self explanatory:
In spite of an exhaustive documentation, please refer to the C++ documentation, which mostly applies to python.
## Documentation and tutorial
For the C++ / Python detailed documentation, you can consult [this pdf](https://github.com/loco-3d/ndcurves/blob/devel/doc/curves.pdf) available in the doc folder
For a python tutorial, you can refer to the [jupyter notebook](https://github.com/loco-3d/ndcurves/blob/master/python/test/sandbox/test.ipynb).
The [test file](https://github.com/loco-3d/ndcurves/blob/master/python/test/test.py) is more exhaustive and rather self explanatory.
## Citation
If you wish to cite this work please use the bibtex below:
```bib
@software{ndcurves,
author = {Tonneau, Steve and Chemin, Jason and Fernbach, Pierre and Saurel, Guilhem},
title = {ndcurves},
url = {https://github.com/loco-3d/ndcurves},
year = {2013}
}
```
# cmake folders and files
src/
CMakeFiles/
cmake_install.cmake
Makefile
CMakeCache.txt
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
else (EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
Subproject commit 29c0eb4e659304f44d55a0389e2749812d858659
File added
This diff is collapsed.
doc/source/images/De_Casteljau_construction.png

34.7 KiB

{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733380312,
"narHash": "sha256-ywntxT10Om755wkB9tYgJwEwELQZKYAO5WcNuHv1vjI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a772498086eac57d97065a980a21fc0f304e3192",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1733096140,
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "Library for creating smooth cubic splines";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;
perSystem =
{ pkgs, self', ... }:
{
apps.default = {
type = "app";
program = pkgs.python3.withPackages (_: [ self'.packages.default ]);
};
devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; };
packages = {
default = self'.packages.ndcurves;
ndcurves = pkgs.python3Packages.ndcurves.overrideAttrs (_: {
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./CMakeLists.txt
./doc
./include
./package.xml
./python
./tests
];
};
});
};
};
};
}
/**
* \file Math.h
* \brief Linear algebra and other maths definitions. Based on Eigen 3 or more
* \author Steve T.
* \version 0.1
* \date 06/17/2013
*
* This file contains math definitions used
* used throughout the library.
* Preprocessors definition are used to use eitheir float
* or double values, and 3 dimensional vectors for
* the Point structure.
*/
#ifndef _SPLINEMATH
#define _SPLINEMATH
#include <Eigen/Dense>
#include <Eigen/SVD>
#include <utility>
#include <vector>
namespace ndcurves {
/// \brief An inverse kinematics architecture enforcing an arbitrary number of
/// strict priority levels (Reference : Boulic et Al. 2003)
template <typename _Matrix_Type_>
void PseudoInverse(_Matrix_Type_& pinvmat) {
Eigen::JacobiSVD<_Matrix_Type_> svd(
pinvmat, Eigen::ComputeFullU | Eigen::ComputeFullV);
_Matrix_Type_ m_sigma = svd.singularValues();
double pinvtoler = 1.e-6; // choose your tolerance widely!
_Matrix_Type_ m_sigma_inv =
_Matrix_Type_::Zero(pinvmat.cols(), pinvmat.rows());
for (long i = 0; i < m_sigma.rows(); ++i) {
if (m_sigma(i) > pinvtoler) {
m_sigma_inv(i, i) = 1.0 / m_sigma(i);
}
}
pinvmat = (svd.matrixV() * m_sigma_inv * svd.matrixU().transpose());
}
template <typename Matrix3, typename Point>
Matrix3 skew(const Point& x) {
Matrix3 res = Matrix3::Zero(3, 3);
res(0, 1) = -x(2);
res(0, 2) = x(1);
res(1, 0) = x(2);
res(1, 2) = -x(0);
res(2, 0) = -x(1);
res(2, 1) = x(0);
return res;
}
static const double MARGIN(0.001);
} // namespace ndcurves
#endif //_SPLINEMATH