Skip to content

Commit

Permalink
Merge tag 'v2.2.0' into ihmc-develop
Browse files Browse the repository at this point in the history
Release of version 2.2.0.
  • Loading branch information
james-p-foster committed Feb 20, 2025
2 parents 3a0369e + 78d4da3 commit 9a8290c
Show file tree
Hide file tree
Showing 196 changed files with 5,532 additions and 3,625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
name: Check changelog action
runs-on: ubuntu-latest
steps:
- uses: tarides/changelog-check-action@v2
- uses: tarides/changelog-check-action@v3
with:
changelog: CHANGELOG.md
32 changes: 32 additions & 0 deletions .github/workflows/nix-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "NIX"

# This determines when this workflow is run
on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
nix:
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
name: (${{ matrix.os }})
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L
1 change: 1 addition & 0 deletions .github/workflows/ros1-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ concurrency:

jobs:
CI:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !contains(join(github.event.pull_request.labels.*.name, ','), 'no ros'))
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ros2-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ concurrency:

jobs:
CI:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !contains(join(github.event.pull_request.labels.*.name, ','), 'no ros'))
strategy:
fail-fast: false
matrix:
Expand All @@ -50,7 +51,7 @@ jobs:
BUILDER: colcon
# This by-passes issues on importing example_robot_data module when running examples and unit tests.
# It seems target_ws is unable to properly overlay upstream_ws.
AFTER_SETUP_UPSTREAM_WORKSPACE: 'pip install example-robot-data --break-system-packages'
AFTER_SETUP_UPSTREAM_WORKSPACE: 'pip install example-robot-data'
runs-on: ubuntu-latest
continue-on-error: true
steps:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: update-flake-lock

on:
workflow_dispatch:
schedule:
- cron: '0 21 12 * *'

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Update flake.lock"
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include: http://rainboard.laas.fr/project/crocoddyl/.gitlab-ci.yml
include: https://rainboard.laas.fr/project/crocoddyl/.gitlab-ci.yml
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@ ci:
autoupdate_branch: devel
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.6
rev: v0.9.6
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- --ignore
- UP036
- 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.23.1
rev: v0.24.2
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
rev: v19.1.7
hooks:
- id: clang-format
args:
- --style=Google
exclude: '^.*\.ipynb$'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2.2.0] - 1980-01-01

* Changed return policy in std::vector of Eigen's vector and matrices to be compliant with Pinocchio in https://github.com/loco-3d/crocoddyl/pull/1338
* Prevent users to improperly setting residual references in https://github.com/loco-3d/crocoddyl/pull/1332
* Fixed the inequality constraints' feasibility computation by incorporating bounds into the calculation in https://github.com/loco-3d/crocoddyl/pull/1307
* Improved the action factory used for unit testing in https://github.com/loco-3d/crocoddyl/pull/1300
* Ignore ruff issues in ipython notebook files in https://github.com/loco-3d/crocoddyl/pull/1297
* Improved efficiency for computing impulse-dynamics derivatives in https://github.com/loco-3d/crocoddyl/pull/1294
* Fixed bug of wrench cone fields not being updated with setters in https://github.com/loco-3d/crocoddyl/pull/1274
* Replaced parent by parentJoint (which was introduced in Pinocchio 3) in https://github.com/loco-3d/crocoddyl/pull/1271
* Introduced the notion of terminal dimension, residuals and constraints in https://github.com/loco-3d/crocoddyl/pull/1269
* General clean ups about std::size_t in https://github.com/loco-3d/crocoddyl/pull/1265
* Fixed issues in LQR extensions in https://github.com/loco-3d/crocoddyl/pull/1263
* Computed dynamic feasibility everytime in https://github.com/loco-3d/crocoddyl/pull/1262
* Extend LQR actions in https://github.com/loco-3d/crocoddyl/pull/1261
* Print log with grad absolute + updated logs with Pinocchio 3 in https://github.com/loco-3d/crocoddyl/pull/1260

## [2.1.0] - 2024-05-31

* Updated black + isort + flake8 to ruff in https://github.com/loco-3d/crocoddyl/pull/1256
Expand Down Expand Up @@ -296,7 +313,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Initial release

[Unreleased]: https://github.com/loco-3d/crocoddyl/compare/v2.1.0...HEAD
[Unreleased]: https://github.com/loco-3d/crocoddyl/compare/v2.2.0...HEAD
[2.2.0]: https://github.com/loco-3d/crocoddyl/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/loco-3d/crocoddyl/compare/v2.0.2...v2.1.0
[2.0.2]: https://github.com/loco-3d/crocoddyl/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/loco-3d/crocoddyl/compare/v2.0.0...v2.0.1
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ if(APPLE) # Use the handmade approach
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/find-external/OpenMP
${CMAKE_MODULE_PATH})
elseif(UNIX)
if(${CMAKE_VERSION} VERSION_GREATER "3.20.0" OR ${CMAKE_VERSION}
VERSION_EQUAL "3.20.0")
if(${CMAKE_VERSION} VERSION_GREATER "3.25.0" OR ${CMAKE_VERSION}
VERSION_EQUAL "3.25.0")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/find-external/OpenMP
${CMAKE_MODULE_PATH})
endif()
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<a href="https://gepettoweb.laas.fr/doc/loco-3d/crocoddyl/master/doxygen-html/"><img src="https://img.shields.io/badge/docs-online-brightgreen" alt="Documentation"/></a>
<a href="https://gepgitlab.laas.fr/loco-3d/crocoddyl/pipelines?ref=devel"><img src="https://gepgitlab.laas.fr/loco-3d/crocoddyl/badges/devel/pipeline.svg">
<a href="https://gepettoweb.laas.fr/doc/loco-3d/crocoddyl/devel/coverage/"><img src="https://gepgitlab.laas.fr/loco-3d/crocoddyl/badges/devel/coverage.svg">
<a href="https://repology.org/project/crocoddyl/versions"><img src="https://repology.org/badge/version-for-repo/aur/crocoddyl.svg" alt="AUR package"></a>
<a href="https://anaconda.org/conda-forge/crocoddyl"><img src="https://img.shields.io/conda/vn/conda-forge/crocoddyl.svg">
<a href="https://repology.org/project/crocoddyl/versions"><img src="https://repology.org/badge/version-for-repo/nix_stable_24_05/crocoddyl.svg" alt="nixpkgs stable 24.05 package"></a>
<a href="https://repology.org/project/crocoddyl/versions"><img src="https://repology.org/badge/version-for-repo/nix_unstable/crocoddyl.svg" alt="nixpkgs unstable package"></a>
<a href="https://pypi.org/project/crocoddyl/"><img src="https://badge.fury.io/py/crocoddyl.svg">
<a href="https://anaconda.org/conda-forge/crocoddyl"><img src="https://anaconda.org/conda-forge/crocoddyl/badges/downloads.svg">
<a href="https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29#fulltext"><img src="https://img.shields.io/badge/license-BSD--3--Clause-blue.svg?style=flat">
Expand Down Expand Up @@ -52,6 +55,13 @@ If you want to learn more about **Crocoddyl** and its solvers, we suggest readin

**Crocoddyl** can be easily installed on various Linux (Ubuntu, Fedora, etc.) and Unix distributions (Mac OS X, BSD, etc.). Below, there are different ways to install Crocoddyl.

### <img src="https://aur.archlinux.org/static/images/favicon.ico" height="18" /> On ArchLinux

With your favorite AUR helper, eg. paru:
```bash
paru -Syu crocoddyl
```

### :dragon: From <img src="https://s3.amazonaws.com/conda-dev/conda_logo.svg" height="18">

Just run the following command in the terminal:
Expand All @@ -60,6 +70,16 @@ Just run the following command in the terminal:
```
Conda installation supports [![conda install](https://anaconda.org/conda-forge/crocoddyl/badges/platforms.svg)](https://anaconda.org/conda-forge/crocoddyl).

### <img src="https://avatars.githubusercontent.com/u/487568" height="18" /> From Nix

`crocoddyl` & `python3Packages.crocoddyl` are available in [nixpkgs](https://github.com/NixOS/nixpkgs/).

This repository is also a flake, so you may:
- run a python shell with crocoddyl: `nix run github:loco-3d/crocoddyl`
- use it in your own flake: `crocoddyl.url = "github:loco-3d/crocoddyl";`

The build cache use by CI and developers is [gepetto.cachix.org](https://app.cachix.org/cache/gepetto)

### :snake: From <img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4-K6Sjm4--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://cdn-images-1.medium.com/max/1600/1%2A_Wkc-WkNu6GJAAQ26jXZOg.png" height="22">

Just run the following command in the terminal:
Expand Down
13 changes: 10 additions & 3 deletions bindings/python/crocoddyl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
import pinocchio
from pinocchio.visualize import MeshcatVisualizer

from .libcrocoddyl_pywrap import * # noqa: F403
from .libcrocoddyl_pywrap import __raw_version__, __version__ # noqa: F401
Expand Down Expand Up @@ -129,7 +130,10 @@ def init(self, solver):
thrusters.append(model.differential.actuation.thrusters)
for n in frameNames:
frameId = self.robot.model.getFrameId(n)
parentId = self.robot.model.frames[frameId].parent
if tuple(int(i) for i in pinocchio.__version__.split(".")) >= (3, 0, 0):
parentId = self.robot.model.frames[frameId].parentJoint
else:
parentId = self.robot.model.frames[frameId].parent
self.activeContacts[str(parentId)] = True
self.frictionMu[str(parentId)] = 0.7
self.frameTrajNames.append(str(frameId))
Expand Down Expand Up @@ -339,7 +343,10 @@ def _getForceInformation(self, state, contact_model, contact_data, cost_model):
fc = []
for key, contact in contact_data.todict().items():
if contact_model[key].active:
joint = state.pinocchio.frames[contact.frame].parent
if tuple(map(int, pinocchio.__version__.split("."))) >= (3, 0, 0):
joint = state.pinocchio.frames[contact.frame].parentJoint
else:
joint = state.pinocchio.frames[contact.frame].parent
oMf = contact.pinocchio.oMi[joint] * contact.jMf
fiMo = pinocchio.SE3(
contact.pinocchio.oMi[joint].rotation.T,
Expand Down Expand Up @@ -558,7 +565,7 @@ def __init__(
if frameNames is not None:
print("Deprecated. Do not pass frameNames")
robot.setVisualizer(
pinocchio.visualize.MeshcatVisualizer(
MeshcatVisualizer(
model=self.robot.model,
collision_model=self.robot.collision_model,
visual_model=self.robot.visual_model,
Expand Down
21 changes: 17 additions & 4 deletions bindings/python/crocoddyl/core/action-base.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
// BSD 3-Clause License
//
// Copyright (C) 2019-2023, LAAS-CNRS, University of Edinburgh,
// Copyright (C) 2019-2024, LAAS-CNRS, University of Edinburgh,
// University of Oxford, Heriot-Watt University
// Copyright note valid unless otherwise stated in individual files.
// All rights reserved.
Expand Down Expand Up @@ -40,15 +40,18 @@ void exposeActionAbstract() {
"and calcDiff(),\n"
"respectively.",
bp::init<boost::shared_ptr<StateAbstract>, std::size_t,
bp::optional<std::size_t, std::size_t, std::size_t> >(
bp::args("self", "state", "nu", "nr", "ng", "nh"),
bp::optional<std::size_t, std::size_t, std::size_t, std::size_t,
std::size_t> >(
bp::args("self", "state", "nu", "nr", "ng", "nh", "ng_T", "nh_T"),
"Initialize the action model.\n\n"
"We can also describe autonomous systems by setting nu = 0.\n"
":param state: state description,\n"
":param nu: dimension of control vector,\n"
":param nr: dimension of the cost-residual vector (default 1)\n"
":param ng: number of inequality constraints (default 0)\n"
":param nh: number of equality constraints (default 0)\n"))
":param nh: number of equality constraints (default 0)\n"
":param ng_T: number of inequality terminal constraints (default 0)\n"
":param nh_T: number of equality terminal constraints (default 0)"))
.def("calc", pure_virtual(&ActionModelAbstract_wrap::calc),
bp::args("self", "data", "x", "u"),
"Compute the next state and cost value.\n\n"
Expand Down Expand Up @@ -130,6 +133,16 @@ void exposeActionAbstract() {
bp::make_setter(&ActionModelAbstract_wrap::nh_,
bp::return_internal_reference<>()),
"number of equality constraints")
.add_property("ng_T",
bp::make_function(&ActionModelAbstract_wrap::get_ng_T),
bp::make_setter(&ActionModelAbstract_wrap::ng_T_,
bp::return_internal_reference<>()),
"number of inequality terminal constraints")
.add_property("nh_T",
bp::make_function(&ActionModelAbstract_wrap::get_nh_T),
bp::make_setter(&ActionModelAbstract_wrap::nh_T_,
bp::return_internal_reference<>()),
"number of equality terminal constraints")
.add_property(
"state",
bp::make_function(&ActionModelAbstract_wrap::get_state,
Expand Down
38 changes: 21 additions & 17 deletions bindings/python/crocoddyl/core/action-base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ class ActionModelAbstract_wrap : public ActionModelAbstract,
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
using ActionModelAbstract::ng_;
using ActionModelAbstract::ng_T_;
using ActionModelAbstract::nh_;
using ActionModelAbstract::nh_T_;
using ActionModelAbstract::nu_;
using ActionModelAbstract::unone_;

ActionModelAbstract_wrap(boost::shared_ptr<StateAbstract> state,
const std::size_t nu, const std::size_t nr = 1,
const std::size_t ng = 0, const std::size_t nh = 0)
: ActionModelAbstract(state, nu, nr, ng, nh),
const std::size_t ng = 0, const std::size_t nh = 0,
const std::size_t ng_T = 0,
const std::size_t nh_T = 0)
: ActionModelAbstract(state, nu, nr, ng, nh, ng_T, nh_T),
bp::wrapper<ActionModelAbstract>() {
unone_ = NAN * MathBase::VectorXs::Ones(nu);
}
Expand All @@ -38,14 +42,14 @@ class ActionModelAbstract_wrap : public ActionModelAbstract,
const Eigen::Ref<const Eigen::VectorXd>& x,
const Eigen::Ref<const Eigen::VectorXd>& u) {
if (static_cast<std::size_t>(x.size()) != state_->get_nx()) {
throw_pretty("Invalid argument: "
<< "x has wrong dimension (it should be " +
std::to_string(state_->get_nx()) + ")");
throw_pretty(
"Invalid argument: " << "x has wrong dimension (it should be " +
std::to_string(state_->get_nx()) + ")");
}
if (static_cast<std::size_t>(u.size()) != nu_) {
throw_pretty("Invalid argument: "
<< "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
throw_pretty(
"Invalid argument: " << "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
}
if (std::isnan(u.lpNorm<Eigen::Infinity>())) {
return bp::call<void>(this->get_override("calc").ptr(), data,
Expand All @@ -60,14 +64,14 @@ class ActionModelAbstract_wrap : public ActionModelAbstract,
const Eigen::Ref<const Eigen::VectorXd>& x,
const Eigen::Ref<const Eigen::VectorXd>& u) {
if (static_cast<std::size_t>(x.size()) != state_->get_nx()) {
throw_pretty("Invalid argument: "
<< "x has wrong dimension (it should be " +
std::to_string(state_->get_nx()) + ")");
throw_pretty(
"Invalid argument: " << "x has wrong dimension (it should be " +
std::to_string(state_->get_nx()) + ")");
}
if (static_cast<std::size_t>(u.size()) != nu_) {
throw_pretty("Invalid argument: "
<< "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
throw_pretty(
"Invalid argument: " << "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
}
if (std::isnan(u.lpNorm<Eigen::Infinity>())) {
return bp::call<void>(this->get_override("calcDiff").ptr(), data,
Expand Down Expand Up @@ -99,9 +103,9 @@ class ActionModelAbstract_wrap : public ActionModelAbstract,
u = bp::call<Eigen::VectorXd>(quasiStatic.ptr(), data, (Eigen::VectorXd)x,
maxiter, tol);
if (static_cast<std::size_t>(u.size()) != nu_) {
throw_pretty("Invalid argument: "
<< "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
throw_pretty(
"Invalid argument: " << "u has wrong dimension (it should be " +
std::to_string(nu_) + ")");
}
return;
}
Expand Down
Loading

0 comments on commit 9a8290c

Please sign in to comment.