Skip to content

Commit

Permalink
First working version (#1)
Browse files Browse the repository at this point in the history
* updated README

* add gitattributes, gitignore and cmakelists

* added models

* added matlab-scripts

* added flight controllers

* ported simulin-gazebo library and renamed

* cleanup jet plugin v1

* Update README.md

* Update README.md

* cleanup of the Simulink library

* Update README.md

* cleaning cmake files

* Update README.md

* Update README.md

* Update README.md

* cleaned up ironcub models

* Update README.md

* lib and models compile with no errors.

* Update README.md

* Update README.md

* Update CMakeLists.txt

* Update CMakeLists.txt

* updating cmakelists.txt

* Update README.md

* fixed matlab-scripts

* updated world files

* controllers and simulink library cleanup and update

* Update README.md

* Update README.md

* Update README.md

* changed robot name in config files folders

* fixing library issues

* flight control with Gazebo is working

* bugfix to run Matlab-only controller

* fix bugs in CMakeLists

* first stable version of the repo

---------

Co-authored-by: Hosameldin <hosameldin.mohamed@iit.it>
  • Loading branch information
gabrielenava and HosameldinMohamed authored Feb 20, 2023
1 parent b91b07f commit 9243d77
Show file tree
Hide file tree
Showing 450 changed files with 76,812 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*.zip filter=lfs diff=lfs merge=lfs -text
*.1 filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.step filter=lfs diff=lfs merge=lfs -text
*.stp filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.prt filter=lfs diff=lfs merge=lfs -text
*.asm filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.smpd filter=lfs diff=lfs merge=lfs -text
*.wmv filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.BMT filter=lfs diff=lfs merge=lfs -text
*.log filter=lfs diff=lfs merge=lfs -text
*.mat filter=lfs diff=lfs merge=lfs -text
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OS X Finder files
.DS_Store

## Matlab: ------------------------------------------
##
## Remove autosaves generated by the Matlab editor
## We have git for backups!
##---------------------------------------------------

# Windows default autosave extension
*.asv

# OSX / *nix default autosave extension
*.m~

# Compiled MEX binaries (all platforms)
*.mex*

# Simulink Code Generation
**/slprj/
*.original
*.slxc
*.r2021b
*.asv

# Matlab binary .mat files
*.mat
!matlab-scripts/jets-pose-optimization/results/*.mat
!matlab-scripts/joint-pos-optimization/results/*.mat

# Matlab figures
*.fig
!flight-controllers-stable/controlAndDataGui/*.fig

# Simulink autosave
*.autosave

# Build directory
build/

# Sublime Text: ------------------------------------
#
# Ignore projects and workspaces.
# url: https://www.sublimetext.com
#---------------------------------------------------
*.sublime-project
*.sublime-workspace

# Compilation folders
/software/build*/
/build/*

# IDE and testing
.vscode
.pytest_cache/**
.json
**/__pycache__/**
**/.venv
**/venv
**/dist
**/.cache/
**/.kdev4/
**/*.kdev4

74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
################################################################################
# #
# Copyright (C) 2018 Fondazione Istitito Italiano di Tecnologia (IIT) #
# All Rights Reserved. #
# #
################################################################################

cmake_minimum_required(VERSION 3.5)
project(ironcub_software
VERSION 0.0.1
LANGUAGES C CXX)

# Disable in source build
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds of ironcub_software are not allowed. "
"Please remove CMakeCache.txt and the CMakeFiles/ directory, then build out-of-source. "
"If you really want to do an in-source build, feel free to comment out this error.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")

# Check the Operative System
if(MSVC OR WIN32)
set(EXPORT_VAR "set")
set(PATH_SEPARATOR "\\")
set(VARIABLE_START "%")
set(VARIABLE_END "%")
set(PATH_LIST_SEPARATOR ";")
set(PLUGIN_FOLDER_NAME "bin")
set(SETUP_SCRIPT_EXTENSION ".bat")
elseif(UNIX)
set(EXPORT_VAR "export")
set(PATH_SEPARATOR "/")
set(VARIABLE_START "$")
set(VARIABLE_END "")
set(PATH_LIST_SEPARATOR ":")
set(PLUGIN_FOLDER_NAME "lib")
set(SETUP_SCRIPT_EXTENSION ".sh")
endif()

option(INSTALL_IRONCUB_MODELS "Install iRonCub models in CMAKE_INSTALL_PREFIX." TRUE)
option(INSTALL_LIBRARY "Install iRonCub gazebo plugin and simulink library." TRUE)
option(USE_NONLINEAR_JET_DYNAMICS_PLUGIN "Install the nonlinear dynamics of the jet" FALSE)
option(USE_FIRST_ORDER_JET_DYNAMICS_PLUGIN "Install the firstorder dynamics of the jet" TRUE)

file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}" IRONCUB_SOURCE_DIR)

# Set paths for using the iRonCub models in Gazebo
set(SETUP_PATH_GAZEBO_MODELS "
${EXPORT_VAR} GAZEBO_MODEL_PATH=${VARIABLE_START}GAZEBO_MODEL_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}
${EXPORT_VAR} GAZEBO_MODEL_PATH=${VARIABLE_START}GAZEBO_MODEL_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}iRonCub-Mk1${PATH_SEPARATOR}iRonCub${PATH_SEPARATOR}robots
${EXPORT_VAR} GAZEBO_MODEL_PATH=${VARIABLE_START}GAZEBO_MODEL_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}iRonCub-Mk1_1${PATH_SEPARATOR}iRonCub${PATH_SEPARATOR}robots
${EXPORT_VAR} GAZEBO_RESOURCE_PATH=${VARIABLE_START}GAZEBO_RESOURCE_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}worlds${PATH_SEPARATOR}iRonCub-Mk1_world
${EXPORT_VAR} GAZEBO_RESOURCE_PATH=${VARIABLE_START}GAZEBO_RESOURCE_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}worlds${PATH_SEPARATOR}iRonCub-Mk1_1_world
${EXPORT_VAR} YARP_DATA_DIRS=${VARIABLE_START}YARP_DATA_DIRS${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}iRonCub-Mk1${PATH_SEPARATOR}iRonCub${PATH_SEPARATOR}
${EXPORT_VAR} YARP_DATA_DIRS=${VARIABLE_START}YARP_DATA_DIRS${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_SOURCE_DIR${VARIABLE_END}${PATH_SEPARATOR}models${PATH_SEPARATOR}iRonCub-Mk1_1${PATH_SEPARATOR}iRonCub${PATH_SEPARATOR}")

# Add jets-plugin to Gazebo plugin path
set(SETUP_PATH_GAZEBO_PLUGINS "${EXPORT_VAR} GAZEBO_PLUGIN_PATH=${VARIABLE_START}GAZEBO_PLUGIN_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}${PLUGIN_FOLDER_NAME}")

# Add Simulink library to MATLAB path
set(SETUP_PATH_SIMULINK_LIBRARY "
${EXPORT_VAR} MATLABPATH=${VARIABLE_START}MATLABPATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}lib${PATH_SEPARATOR}simulink_v1${PATH_SEPARATOR}
${EXPORT_VAR} MATLABPATH=${VARIABLE_START}MATLABPATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}lib${PATH_SEPARATOR}simulink_v1${PATH_SEPARATOR}matlab_src${PATH_SEPARATOR}
${EXPORT_VAR} MATLABPATH=${VARIABLE_START}MATLABPATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}lib${PATH_SEPARATOR}simulink_v1${PATH_SEPARATOR}conf${PATH_SEPARATOR}
${EXPORT_VAR} BLOCKFACTORY_PLUGIN_PATH=${VARIABLE_START}BLOCKFACTORY_PLUGIN_PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}${PLUGIN_FOLDER_NAME}
${EXPORT_VAR} YARP_DATA_DIRS=${VARIABLE_START}YARP_DATA_DIRS${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}lib${PATH_SEPARATOR}simulink_v1${PATH_SEPARATOR}conf${PATH_SEPARATOR}
${EXPORT_VAR} PATH=${VARIABLE_START}PATH${VARIABLE_END}${PATH_LIST_SEPARATOR}${VARIABLE_START}IRONCUB_SOFTWARE_INSTALL_PREFIX${VARIABLE_END}${PATH_SEPARATOR}bin${PATH_SEPARATOR}")

add_subdirectory(lib)
add_subdirectory(models)

# Configure MATLAB startup file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/setup_v1.in ${CMAKE_BINARY_DIR}/share/setup_v1${SETUP_SCRIPT_EXTENSION})
INSTALL(FILES ${CMAKE_BINARY_DIR}/share/setup_v1${SETUP_SCRIPT_EXTENSION} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/ironcub)

127 changes: 125 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,125 @@
# ironcub_software
In this repository we share public iRonCub software used throughout the project.
# iRonCub Software

**WARNING! this repo is under active development, and the software that contains comes with no warranties!**

This repo contains libraries, plugins and controllers to perform dynamics simulations of the flying humanoid robot iRonCub. iRonCub is the world first jet-powered humanoid robot and it is being developed by the [Artificial and Mechanical Intelligence](https://ami.iit.it/) group at the Italian Institute of Technology (IIT). For further information on the project, please visit the [arerial humanoid robotics page](https://ami.iit.it/aerial-humanoid-robotics).

https://user-images.githubusercontent.com/12396934/219008717-117eb146-cca6-4056-8dd1-9a06100e97d1.mp4

## Installation

### Dependencies

- [YARP](https://github.com/robotology/yarp);
- [gazebo-yarp-plugins](https://github.com/robotology/gazebo-yarp-plugins);
- [whole-body-controllers](https://github.com/robotology/whole-body-controllers);
- [Matlab & Simulink](https://it.mathworks.com/products/matlab.html);
- [Gazebo](https://classic.gazebosim.org/download);
- [iDynTree](https://github.com/robotology/idyntree);
- [BlockFactory](https://github.com/robotology/blockfactory);
- [Eigen3](https://eigen.tuxfamily.org/index.php?title=Main_Page);
- [matlab-whole-body-simulator](https://github.com/ami-iit/matlab-whole-body-simulator).

**Note:** the lowest suppported Matlab version is `R2021b`, and the lowest supported Gazebo version is `v.8`. For controllers that use Simulink library blocks from `matlab-whole-body-simulator`, the lowest supported Matlab version is `R2022b`.

The **highly recommended** way for installing all this dependencies (but Matlab and Gazebo) is to use the [robotology-superbuild](https://github.com/robotology/robotology-superbuild), making sure to enable the `ROBOTOLOGY_ENABLE_DYNAMICS` and `ROBOTOLOGY_USES_GAZEBO` CMake options.

A quick way to install the dependencies is via [conda package manager](https://docs.conda.io) which provides binary packages for Linux, macOS and Windows of the software contained in the robotology-superbuild. Relying on the community-maintained [`conda-forge`](https://conda-forge.org/) channel and also the `robotology` conda channel.

Please refer to [the documentation in `robotology-superbuild`](https://github.com/robotology/robotology-superbuild/blob/7d79a44e90fbcedf137ab6c5c1d83b943d6e6839/doc/conda-forge.md) to install and configure a conda distribution. Then, once your environment is set, you can run the following command to install the required dependencies.

```sh
mamba create -n <conda-environment-name>
mamba activate <conda-environment-name>
mamba install -c conda-forge compilers cmake pkg-config make ninja
mamba install -c conda-forge -c robotology icub-models idyntree-matlab-bindings wb-toolbox whole-body-controllers whole-body-estimators gazebo gazebo-yarp-plugins opencv
```

The installation procedure has been tested on Ubuntu 20.04 and Windows 10.

## Compilation

On **Linux** or **macOS**, run:

```bash
cd ironcub_software
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="/path/to/desired/install/dir" .
make install
```

On **Windows**, run:

```cmd
cd ironcub_software
mkdir build
cd build
cmake .. -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX="\path\to\desired\install\dir"
cmake --build . --config Release --target INSTALL
```

## Running the repo on Windows

To run the repository on Windows it is necessary to properly setup a Windows terminal where commands are executed. First, create a file `setup.bat` with the following content:

```cmd
call mamba activate <conda-environment-name>
call <path-to-the-robotology-superbuild>\robotology-superbuild\build\install\share\robotology-superbuild\setup.bat
rem From the iRonCub Software documentation
call <\path\to\desired\install\dir>\share\ironcub\setup-v1.bat
rem Unset the MESA variable (maybe useless on Windows)
set MESA_LOADER_DRIVER_OVERRIDE=
```

In this way the `batch` file will load both the setup script from the `robotology-superbuild` and the `ironcub_software`. Then, download **Windows Terminal** from the _Microsoft Store_.

Launch the Windows Terminal app, go on `settings` and `Create a new profile`, then create a new profile specifying the new name and the tab-name.

Select `Open Json file`.

In the `settings.json` file search for `"list"` inside `"profiles"`, there in the newly generated terminal (easy to find by the `"name"` variable) set the value for `"commandline"` as:

```bash
"commandline": "cmd.exe /k \"<path-to-the-setup-file>\\setup.bat\""
```

**IMPORTANT: in the `"commandline"` path be sure to use `\\` as path separator for the correct `.json` file syntax.**

Now the Windows Terminal has the `setup.bat` file acting in a similar way to the `.bashrc` file on _Linux_ OS.

## Running the repo on Ubuntu

Add to your `.bashrc` file the following line:

```bash
source $IRONCUB_INSTALL_PREFIX/share/ironcub/setup-v1.sh
```

This `sh` file contains the paths that are needed to use this repo.

**For Gazebo simulations:**

To better understand which variables are set by the `setup-v1.sh` script, see also these READMEs:

- https://github.com/ami-iit/ironcub_software/tree/porting_mk1_mk1_1/models/worlds#usage
- https://github.com/ami-iit/ironcub_software/blob/porting_mk1_mk1_1/lib/gazebo/README.md#setting-up-env-variables
- https://github.com/ami-iit/ironcub_software/tree/porting_mk1_mk1_1/models#installation-and-usage

## Content

Documentation entry points for the different folders are in the [wiki](https://github.com/ami-iit/ironcub_software/wiki) of the repo.

- [flight-controllers-stable](flight-controllers-stable): Simulink controllers to run simulations of `iRonCub-Mk1` and `iRonCub-Mk1_1` flying in Gazebo simulator.

- [matlab-scripts](matlab-scripts): Matlab scripts used to determine the optimal jets configuration, robot posture for take off, and similar offline optimizations.

- [models](models): home positions and URDF models of `iRonCub-Mk1` and `iRonCub-Mk1_1`.

- [lib](lib): Gazebo plugins and Simulink library blocks to be used in the flight controllers.

## Maintainer

Gabriele Nava, @gabrielenava
5 changes: 5 additions & 0 deletions cmake/templates/setup_v1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@EXPORT_VAR@ IRONCUB_SOFTWARE_SOURCE_DIR=@IRONCUB_SOURCE_DIR@
@EXPORT_VAR@ IRONCUB_SOFTWARE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@
@SETUP_PATH_SIMULINK_LIBRARY@
@SETUP_PATH_GAZEBO_MODELS@
@SETUP_PATH_GAZEBO_PLUGINS@
Loading

0 comments on commit 9243d77

Please sign in to comment.