Skip to content

Commit

Permalink
Add pixi.toml to simplify running the generation locally
Browse files Browse the repository at this point in the history
traversaro committed Feb 15, 2024
1 parent a42368e commit 4e8ed94
Showing 5 changed files with 69 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
build/
.build/
# pixi environments
.pixi

deploy_commit_message
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# Authors: Silvio Traversaro
# CopyPolicy: Released under the terms of the GNU LGPL v2+.

cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.16)

project(icub-model-generator)

30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,18 +6,28 @@ are available at https://github.com/robotology/icub-models .

**Note: this repository is meant to streamline the process of producing iCub URDF/SDF models by iCub mantainers. It is not meant to be used directly by users of iCub. For offical info on the kinematic parameters of the iCub, please see [the documentation in iCub's documentation](https://icub-tech-iit.github.io/documentation/icub_kinematics/icub-forward-kinematics/icub-forward-kinematics/).**

## Dependencies
- [iDynTree](https://github.com/robotology/idyntree)
- [YARP](https://github.com/robotology/yarp)
- [simmechanics-to-urdf](https://github.com/robotology/simmechanics-to-urdf)

Detailed documentation on how to install the softare is current work in progress. In the meanwhile, you can check the exact way in which the software is installing by inspecting the [`CI` GitHub Actions workflow](.github/workflows/ci.yml) that is used to automatically generate the models of iCub using this repo and commit it to the [icub-models](https://github.com/robotology/icub-models) repo.


## Usage
To generate the models, please ensure that you have all the necessary dependencies.
To update the content of a local `icub-models` repository, set in the `ICUB_MODELS_SOURCE_DIR`
CMake variable the absolute path to your `icub-models` repository, and execute the `copy-models-to-icub-models` target.

To generate the models, first of all that you have [pixi installed](https://pixi.sh/#installation).

Then, clone the repo and generate and the models via the `test_generated_models` pixi task:

~~~
cd ~
git clone https://github.com/robotology/icub-models-generator
cd icub-models-generator
pixi run test_generated_models
~~~

If you want to generate the models in a local clone of icub-models, set the `ICUB_MODELS_SOURCE_DIR` environment variable to the location of the `icub-models` local folder, and run the `copy_models_to_icub_models` pixi task:
~~~
cd ~
git clone https://github.com/robotology/icub-models
export ICUB_MODELS_SOURCE_DIR=`pwd`/icub-models
cd icub-models-generator
pixi run copy_models_to_icub_models
~~~

## Pipelines
Currently, it is possible to generate iCub models by means of two different pipelines.
40 changes: 40 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[project]
name = "icub-models-generator"
# pixi forces the use of a version, but then the version is not used anywhere,
# so we actually just set it to 0.0.0 and never update it
version = "0.0.0"
description = "Resources and programs to generate models (URDF, SDF) of the iCub robot."
authors = ["Silvio Traversaro <[email protected]>"]
channels = ["conda-forge"]
platforms = ["linux-64", "linux-aarch64", "win-64", "osx-arm64", "osx-64"]

[tasks]
# As of pixi 0.13.0, pixi does not support git pip packages, so we install it from source
# Specific commit of urdfdom_py is a workaround for https://github.com/robotology/simmechanics-to-urdf/issues/36
header_commit = { cmd = "echo Automatic build of models via icub-models-generator. > ./deploy_commit_message" }
header_repos = { cmd = "echo ### Dependencies information of dependencies installed manually: >> ./deploy_commit_message", depends_on = ["header_commit"] }
install_urdfdom_py = { cmd = "export URDF_PARSER_PY_COMMIT=31474b9baaf7c3845b40e5a9aa87d5900a2282c3 && pip install git+https://github.com/ros/urdf_parser_py.git@$URDF_PARSER_PY_COMMIT --no-deps && echo urdf_parser_py commit: ros/urdf_parser_py@$URDF_PARSER_PY_COMMIT >> ./deploy_commit_message", depends_on = ["header_repos"]}
install_simmechanics_to_urdf = { cmd = "export SIMMECHANICS_TO_URDF_COMMIT=22caa23cfe7063299c5746304850b8afd74f4e1f && pip install git+https://github.com/robotology/simmechanics-to-urdf@$SIMMECHANICS_TO_URDF_COMMIT --no-deps && echo icub-model-generator commit: robotology/icub-models-generator@$SIMMECHANICS_TO_URDF_COMMIT >> ./deploy_commit_message", depends_on = ["install_urdfdom_py"] }
header_pixi_list = { cmd = "echo ### Dependencies information via pixi list: >> ./deploy_commit_message", depends_on = ["install_simmechanics_to_urdf"]}
pixi_list = { cmd = "pixi list >> ./deploy_commit_message", depends_on = ["header_pixi_list"]}
configure_cmake_project = { cmd = "cmake -GNinja -S. -B.build -DICUB_MODELS_SOURCE_DIR=$ICUB_MODELS_SOURCE_DIR -DBUILD_TESTING:BOOL=ON", depends_on = ["pixi_list"]}
generate_models = { cmd = "cmake --build .build --target generate-models", depends_on = ["configure_cmake_project"]}
copy_models_to_icub_models = { cmd = "cmake --build .build --target copy-models-to-icub-models", depends_on = ["configure_cmake_project"]}
build_tests = { cmd = "cmake --build .build", depends_on = ["configure_cmake_project"] }
test_generated_models = { cmd = "ctest --test-dir .build", depends_on = ["generate_models", "build_tests"]}

[dependencies]
idyntree = ">=10.3.0,<10.4"
yarp = ">=3.9.0,<3.10"
lxml = "==4.9.4"
# Not using latest pyyaml as workaround for https://github.com/robotology/simmechanics-to-urdf/issues/57
pyyaml = ">=5.0.0,<6.0.0"
numpy = ">=1.26.4,<1.27"
catkin_pkg = ">=1.0.0,<1.1"
pip = ">=24.0,<25"
python = ">=3.11.1,<3.12"
ninja = ">=1.11.1,<1.12"
cxx-compiler = ">=1.7.0,<1.8"
c-compiler = ">=1.7.0,<1.8"
# ruby is used by the convertSTL.rb script
ruby = ">=3.2.2,<3.3"

0 comments on commit 4e8ed94

Please sign in to comment.