Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Octave Mex support #305

Merged
merged 7 commits into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ before_script:
# install dependencies using the codyco-superbuild script
- chmod +x ./.ci/travis-deps.sh
- sh .ci/travis-deps.sh
# On Ubuntu, make sure not to use openblas as blas backend, see
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install libatlas-base-dev; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo update-alternatives --set libblas.so.3 /usr/lib/atlas-base/atlas/libblas.so.3 ; fi
# On macOS, install ipopt from homebrew
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ipopt; fi
- mkdir build
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are not interested in installing all the CoDyCo software it is still poss
https://github.com/robotology-playground/iDynTree-superbuild . Please check the README of that repo for information on how to install iDynTree and all its dependencies. Note that the `codyco-superbuild` is much more used then the `iDynTree-superbuild`, so it may be easier for you (especially if people working on your lab already use the `codyco-superbuild`) to just use the `codyco-superbuild` for consistency.

### Bindings
To compile bindings to iDynTree in several scriping languages, you should enable them using the `IDYNTREE_USES_PYTHON`, `IDYNTREE_USES_LUA`, `IDYNTREE_USES_MATLAB` CMake options.
To compile bindings to iDynTree in several scriping languages, you should enable them using the `IDYNTREE_USES_PYTHON`, `IDYNTREE_USES_LUA`, `IDYNTREE_USES_MATLAB`, `IDYNTREE_USES_OCTAVE` CMake options.

Several examples for using the bindigs are available in https://github.com/robotology-playground/idyntree/blob/master/doc/geometric_classes.md .

Expand All @@ -37,18 +37,24 @@ export PYTHONPATH=$PYTHONPATH:~/src/codyco-superbuild/build/install/lib/python2.

#### Matlab
You should add to Matlab path the `{CMAKE_INSTALL_PREFIX}/mex` directory. By default this directory should be `/usr/local/mex`, or if you used a [YCM](https://github.com/robotology/ycm/) superbuild something like `SUPERBUILD_BUILD_DIRECTORY/install/mex`.
You can modify the installation location for Matlab bindings files using the `IDYNTREE_INSTALL_MATLAB_LIBDIR` and `IDYNTREE_INSTALL_MATLAB_MFILESDIR` CMake options.

##### Matlab bindings modifications
#### Octave
You should add to Octave path the `{CMAKE_INSTALL_PREFIX}/octave` directory. By default this directory should be `/usr/local/octave`, or if you used a [YCM](https://github.com/robotology/ycm/) superbuild something like `SUPERBUILD_BUILD_DIRECTORY/install/octave`.
You can modify the installation location for Octave bindings files using the `IDYNTREE_INSTALL_OCTAVE_LIBDIR` and `IDYNTREE_INSTALL_OCTAVE_MFILESDIR` CMake options.


##### Matlab/Octave bindings modifications
All the other bindings (Python,Lua, ...) are generated by SWIG and compiled on the fly by the user,
by enabling the `IDYNTREE_USES_LANGUAGE` option. The Matlab bindings are an exception because they
by enabling the `IDYNTREE_USES_LANGUAGE` option. The Matlab and Octave bindings are an exception because they
rely on an experimental version of Swig, developed for providing Matlab bindings for the [casadi](https://github.com/casadi/casadi/wiki) project. For this reason, usually the Matlab bindigs
are not generated by the users, but by iDynTree developers that have a special experimental Swig
version installed. The bindings code is then committed to the repository, and the `IDYNTREE_USES_MATLAB`
option simply enables *compilation* of the bindings. If you want to regenerate the Matlab bindings,
for example because you modified some iDynTree classes, you can install the experimental
version of Swig with Matlab support at https://github.com/casadi/casadi/wiki/matlab (just follow
the first 4 points in the guide) and then enable Matlab bindings generation with the `IDYNTREE_GENERATE_MATLAB` options.
Currently we are commiting to the repo the matlab bindings generated with this commit of `matlab-swig`: https://github.com/jaeandersson/swig/commit/5d3770e452b71265162001c2249dea7961660629 .
Currently we are commiting to the repo the matlab bindings generated with this commit of `matlab-swig`: https://github.com/jaeandersson/swig/commit/260ed47c4414e61c66ae84a639707b1fef916ba8 .
For more info on how to modify the matlab bindings, see https://github.com/robotology/idyntree/blob/master/doc/dev/faqs.md#how-to-add-wrap-a-new-class-or-function-with-swig .

#### Dependencies
Expand Down
20 changes: 7 additions & 13 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
## about this list, any SWIG-supported language should work - take a
## look at e.g. ruby code below for how to do it.

option(IDYNTREE_USES_PYTHON "Do you want to create the Python interface" FALSE)
option(IDYNTREE_USES_LUA "Do you want to create the Lua interface" FALSE)
option(IDYNTREE_USES_MATLAB "Do you want to create the MATLAB Interface" FALSE)
option(IDYNTREE_USES_OCTAVE "Do you want to create the MATLAB Interface" FALSE)
option(IDYNTREE_USES_PYTHON "Do you want to create the Python bindings" FALSE)
option(IDYNTREE_USES_LUA "Do you want to create the Lua bindings" FALSE)
option(IDYNTREE_USES_MATLAB "Do you want to create the MATLAB bindings" FALSE)
option(IDYNTREE_USES_OCTAVE "Do you want to create the OCTAVE bindings" FALSE)
option(IDYNTREE_GENERATE_MATLAB "Enable if you have the experimental version of SWIG necessary for generating the Matlab wrapper" FALSE)

if(IDYNTREE_USES_PYTHON OR
Expand All @@ -21,8 +21,8 @@ if(IDYNTREE_USES_PYTHON OR
endif()

find_package(SWIG)
# It is possible to compile matlab bindings without using SWIG
if(SWIG_FOUND OR IDYNTREE_USES_MATLAB)
# It is possible to compile matlab/octave bindings without using SWIG
if(SWIG_FOUND OR IDYNTREE_USES_MATLAB OR IDYNTREE_USES_OCTAVE)
include(UseSWIG)

set_source_files_properties(iDynTree.i PROPERTIES CPLUSPLUS ON)
Expand Down Expand Up @@ -51,19 +51,13 @@ if(SWIG_FOUND OR IDYNTREE_USES_MATLAB)
add_subdirectory(python)
endif(IDYNTREE_USES_PYTHON)

if(IDYNTREE_USES_MATLAB OR IDYNTREE_GENERATE_MATLAB)
if(IDYNTREE_USES_MATLAB OR IDYNTREE_GENERATE_MATLAB OR IDYNTREE_USES_OCTAVE)
add_subdirectory(matlab)
endif()

if(IDYNTREE_USES_OCTAVE)
add_subdirectory(octave)
endif(IDYNTREE_USES_OCTAVE)

endif()

if(IDYNTREE_USES_PYTHON OR
IDYNTREE_USES_LUA OR
IDYNTREE_USES_OCTAVE OR
IDYNTREE_GENERATED_MATLAB)
if(NOT SWIG_FOUND)
MESSAGE(FATAL_ERROR "Swig not found, impossible to compile or generate iDynTree bindings.")
Expand Down
3 changes: 0 additions & 3 deletions bindings/matlab/+iDynTree/ForwardAccKinematics.m

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/matlab/+iDynTree/ForwardPosVelAccKinematics.m

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/matlab/+iDynTree/ForwardPositionKinematics.m

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/matlab/+iDynTree/ForwardVelAccKinematics.m

This file was deleted.

123 changes: 0 additions & 123 deletions bindings/matlab/+iDynTree/IJoint.m

This file was deleted.

32 changes: 0 additions & 32 deletions bindings/matlab/+iDynTree/LinkTraversalsCache.m

This file was deleted.

44 changes: 0 additions & 44 deletions bindings/matlab/+iDynTree/ModelVisualization.m

This file was deleted.

46 changes: 0 additions & 46 deletions bindings/matlab/+iDynTree/MovableJointImpl2.m

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/matlab/+iDynTree/RNEADynamicPhase.m

This file was deleted.

Loading