Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e87c3cd
ROS2 support
alphaville Mar 25, 2026
7bebcd5
update ROS2 auto-generated README
alphaville Mar 25, 2026
31a3b40
api docs
alphaville Mar 25, 2026
933157d
ROS2 tests in CI
alphaville Mar 25, 2026
cc6fce9
fix GA dependencies (ROS2 tests)
alphaville Mar 25, 2026
620f9a7
fix issues in ci.yml
alphaville Mar 25, 2026
3e92b92
wip: working on GA issues
alphaville Mar 25, 2026
9d3781c
GA actions configuration
alphaville Mar 25, 2026
8b8068d
fix issue in script.sh (set -u/+u)
alphaville Mar 25, 2026
f7c5799
GA: let's try again
alphaville Mar 25, 2026
255a152
ROS2 tests work OK locally
alphaville Mar 25, 2026
ea7a273
fix GA issues (hopefully)
alphaville Mar 25, 2026
918ba05
CI issue: import empy
alphaville Mar 25, 2026
e66d975
trying to fix GA issues
alphaville Mar 25, 2026
ec34d39
rearrange GA jobs
alphaville Mar 25, 2026
27a7a12
further testing of ROS2
alphaville Mar 25, 2026
e97c901
Merge branch 'master' into feature/385-ros2
alphaville Mar 25, 2026
48d3bdf
update changelog
alphaville Mar 25, 2026
b828f24
minor
alphaville Mar 25, 2026
29f65f9
bump version
alphaville Mar 25, 2026
7af46ba
update publish-pypi.sh
alphaville Mar 25, 2026
874d2bb
[ci skip] update website docs
alphaville Mar 25, 2026
9d05655
[ci skip] update ROS2 documentation
alphaville Mar 25, 2026
501a4e8
ros2: tighter testing
alphaville Mar 25, 2026
3215c0f
fix issue with ros2 rate
alphaville Mar 25, 2026
66f6337
update ros2 docs
alphaville Mar 25, 2026
25868c7
[docit][ci skip] update website docs
alphaville Mar 25, 2026
5eaae9e
[ci skip] update contributing guidelines
alphaville Mar 25, 2026
b92fda9
[ci skip] contributing.md + link to open_ros
alphaville Mar 26, 2026
a19f333
[ci skip] update website docs
alphaville Mar 26, 2026
225fc1d
[docit] build api docs
alphaville Mar 26, 2026
7bc3bc9
[ci skip] website: make mobile-friendly
alphaville Mar 26, 2026
6807d1d
[docit] update api docs
alphaville Mar 26, 2026
a993743
addressing #403
alphaville Mar 26, 2026
3325a4f
Merge branch 'dev/release' into feature/385-ros2
alphaville Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:

python_tests:
name: Python tests (${{ matrix.name }})
needs: rust_tests
needs:
- rust_tests
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
Expand Down Expand Up @@ -102,6 +103,55 @@ jobs:
if: runner.os == 'macOS'
run: bash ./ci/script.sh python-tests

ros2_tests:
name: ROS2 tests
needs: python_tests
runs-on: ubuntu-latest
timeout-minutes: 45
container:
image: ubuntu:noble
options: --user 0
env:
DO_DOCKER: 0
steps:
- uses: actions/checkout@v5

- name: Install container bootstrap dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cmake \
curl \
ca-certificates \
git \
gnupg2 \
locales \
lsb-release

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""

- uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Setup ROS 2
# `ros-tooling/setup-ros@v0.7` still runs as a Node.js 20 action.
# Force it onto Node 24 now so CI keeps working as GitHub deprecates
# Node 20, and upgrade `setup-ros` to a Node 24-compatible release
# when one becomes available.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy

- name: Run ROS2 Python tests
run: bash ./ci/script.sh ros2-tests

ocp_tests:
name: OCP tests (${{ matrix.name }})
needs: python_tests
Expand Down
34 changes: 34 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,35 @@ run_python_core_tests() {
generated_clippy_tests
}

run_python_ros2_tests() {
export PYTHONPATH=.
set +u
if [ -n "${ROS_DISTRO:-}" ] && [ -f "/opt/ros/${ROS_DISTRO}/setup.bash" ]; then
# setup-ros installs the ROS underlay but does not source it for our shell
source "/opt/ros/${ROS_DISTRO}/setup.bash"
elif [ -f "/opt/ros/jazzy/setup.bash" ]; then
source "/opt/ros/jazzy/setup.bash"
else
set -u
echo "ROS2 environment setup script not found"
exit 1
fi
set -u

if ! python -c "import em, lark, catkin_pkg" >/dev/null 2>&1; then
# ROS2 build helpers run under the active Python interpreter. The test venv
# already has NumPy from `pip install .`, but we also need the ROS-side
# Python packages used during interface and package metadata generation.
# Empy 4 has broken older ROS message generators in the past, so keep it
# on the 3.x API here.
python -m pip install "empy<4" lark catkin_pkg
fi

command -v ros2 >/dev/null
command -v colcon >/dev/null
python -W ignore test/test_ros2.py -v
}

run_python_ocp_tests() {
export PYTHONPATH=.
python -W ignore test/test_ocp.py -v
Expand All @@ -84,6 +113,11 @@ main() {
setup_python_test_env
run_python_core_tests
;;
ros2-tests)
echo "Running ROS2 Python tests"
setup_python_test_env
run_python_ros2_tests
;;
ocp-tests)
echo "Running OCP Python tests"
setup_python_test_env
Expand Down
121 changes: 106 additions & 15 deletions docs/contributing.md → docs/contributing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ title: Contributing to OpEn
description: How do I contribute to OpEn
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## How can I contribute to OpEn?
Thank you for considering contributing to Optimization Engine (OpEn)!

Expand Down Expand Up @@ -134,23 +137,111 @@ Each time the major or minor number of the Rust library is updated, a new crate
In order to release a new version make sure that
you have done the following:

- Updated [CHANGELOG]
- Updated the version in (SemVer):
- [CHANGELOG]
- [Cargo.toml]
- [setup.py]
- Resolved all associated issues on github (and you have created tests for these)
- Updated the documentation (Rust/Python API docs + website)
- Merged into master (your pull request has been approved)
- All tests pass on Travis CI and Appveyor
- Set `publish=true` in `Cargo.toml` (set it back to `false` for safety)
- Publish `opengen` on PyPI (if necessary)
- before doing so, make sure that the cargo.toml template
points to the correct version of OpEn
- Changed "Unreleased" into the right version in [CHANGELOG] and created
a release on github (example [release v0.4.0])
---

<Tabs>
<TabItem value="open" label="open (Rust)">

Checklist:

<ul>
<li>Updated [CHANGELOG]: bump version, write summary of changes</li>
<li>Updated [Cargo.toml]: bump version</li>
<li>Resolve all associated issues on GitHub</li>
<li>Write new unit tests if necessary</li>
<li>Update the API documentation</li>
<li>Update the information on the website</li>
<li>Merge into master once your pull request has been approved</li>
</ul>

Then, create a tag and push it...

```bash
git tag -a v0.10.0 -m "v0.10.0"
git push --tags
```

Lastly, update the [docker image](https://github.com/alphaville/optimization-engine/tree/master/docker).
This will have to be a new PR.

</TabItem>


<TabItem value="opengen" label="opengen">

Checklist:

<ul>
<li>Updated [CHANGELOG](https://github.com/alphaville/optimization-engine/blob/master/open-codegen/CHANGELOG.md): bump version, write summary of changes</li>
<li>Updated [VERSION]: bump version</li>
<li>Review [`pyproject.toml`](https://github.com/alphaville/optimization-engine/blob/master/open-codegen/pyproject.toml)</li>
<li>Resolve all associated issues on GitHub</li>
<li>Write new unit tests if necessary</li>
<li>Update the API documentation</li>
<li>Update the information on the website</li>
<li>Merge into master once your pull request has been approved</li>
<li>Update the API docs</li>
</ul>

Then, create a tag and push it...

```bash
git tag -a opengen-0.10.0 -m "opengen-0.10.0"
git push --tags
```



Lastly, update the [docker image](https://github.com/alphaville/optimization-engine/tree/master/docker).
This will have to be a new PR.

</TabItem>


<TabItem value="docker" label="docker">

Update the [Dockerfile](https://github.com/alphaville/optimization-engine/blob/master/docker/Dockerfile).
You may need to bump the versions of open and opengen:

```Dockerfile
ARG OPENGEN_VERSION=0.10.0
ARG OPTIMIZATION_ENGINE_CRATE_VERSION=0.11.0
```

Update the [CHANGELOG](https://github.com/alphaville/optimization-engine/blob/master/docker/CHANGELOG.md).
Update the [README](https://github.com/alphaville/optimization-engine/blob/master/docker/README.md) file.
Build, test, and push with

```bash
docker push alphaville/open:0.7.0
```

Update the [website docs](./docker) and the promo on the [main page](..)

</TabItem>
</Tabs>

---

To update the website, run
```bash
GIT_USER=alphaville \
CURRENT_BRANCH=master \
USE_SSH=true \
yarn deploy
```
from within `website/`. Then, update the opengen API docs too;
just push a commit with message starting with `[docit]`.
You can also issue a commit without git-add. Run

```bash
git commit -m '[docit] update api docs' --allow-empty
```



[CHANGELOG]: https://github.com/alphaville/optimization-engine/blob/master/CHANGELOG.md
[VERSION]: https://github.com/alphaville/optimization-engine/blob/master/open-codegen/VERSION
[Cargo.toml]: https://github.com/alphaville/optimization-engine/blob/master/Cargo.toml
[setup.py]: https://github.com/alphaville/optimization-engine/blob/master/open-codegen/setup.py
[release v0.4.0]: https://github.com/alphaville/optimization-engine/releases/tag/v0.4.0
Expand Down
2 changes: 1 addition & 1 deletion docs/python-c.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,4 @@ iterations = 69
outer iterations = 5
solve time = 0.140401 ms
```
```

44 changes: 27 additions & 17 deletions docs/python-ros.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
id: python-ros
title: Generation of ROS packages
sidebar_label: ROS packages
description: Code generation for ROS packages using OpEn in Python
description: Code generation for ROS packages using opengen
---

:::note Info
Opengen now supports [ROS2](./python-ros2).
:::

## What is ROS
The [Robot Operating System](https://www.ros.org/) (ROS) is a collection of tools and libraries, as well as a framework that facilitates the data exchange among them. ROS is popular in the robotics community and is used to design and operate modern robotic systems.

Expand All @@ -21,7 +25,7 @@ OpEn (with opengen version `0.5.0` or newer) can generate ready-to-use ROS packa

The input parameters message follows the following specification:

```
```msg
float64[] parameter # parameter p (mandatory)
float64[] initial_guess # u0 (optional/recommended)
float64[] initial_y # y0 (optional)
Expand All @@ -40,9 +44,28 @@ initial_y: []

#### Result

A result message (`OptimizationResult`) contains the solution of the parametric optimization problem and details about the solution procedure such as the number of inner/outer iterations and the solution time. The result of an auto-generated OpEn node is a message with the following specification:
A result message (`OptimizationResult`) contains the solution of the parametric optimization problem and details about the solution procedure such as the number of inner/outer iterations and the solution time.
An example of such a message is given below:

```yaml
solution: [0.5317, 0.7975, 0.6761, 0.7760, 0.5214]
inner_iterations: 159
outer_iterations: 5
status: 0
norm_fpr: 2.142283848e-06
penalty: 111250.0
lagrange_multipliers: []
infeasibility_f1: 0.0
infeasibility_f2: 2.44131958366e-05
solve_time_ms: 2.665959
```

<details>
<summary>Specification of <code>OptimizationResult</code></summary>

The message `OptimizationResult` is described by the following message file

```msg
# Constants match the enumeration of status codes
uint8 STATUS_CONVERGED=0
uint8 STATUS_NOT_CONVERGED_ITERATIONS=1
Expand All @@ -63,20 +86,7 @@ float64 infeasibility_f2 # infeasibility wrt F2
float64 solve_time_ms # solution time in ms
```

An example of such a message is given below:

```yaml
solution: [0.5317, 0.7975, 0.6761, 0.7760, 0.5214]
inner_iterations: 159
outer_iterations: 5
status: 0
norm_fpr: 2.142283848e-06
penalty: 111250.0
lagrange_multipliers: []
infeasibility_f1: 0.0
infeasibility_f2: 2.44131958366e-05
solve_time_ms: 2.665959
```
</details>

### Configuration Parameters

Expand Down
Loading
Loading