Skip to content

Matlab Wrapper Function 'matlab_wrap' Not Working For GPMP2  #136

@mattking-smith

Description

@mattking-smith

Description

I am trying to use the wrap repository to generate the MATLAB interface to the GPMP2 repository, but I am running into an error when trying to run the matlab_wrap() function. I have been able to create this MATLAB interface with the help of @gchenfc (which I currently have working on a development computer), but that was some time ago and I am worried possibly there may have been changes to the wrapper implementation.

Steps to reproduce error

  1. In the command prompt run:
git clone https://github.com/gtrll/gpmp2.git 
cd gpmp2 && mkdir build && cd build
sudo cmake -DGPMP2_BUILD_MATLAB_TOOLBOX:=ON ..
  1. However, I found that that this produced and error due to and outdated CMakeLists.txt file.
    Specifically, in lines 66-74 of the GPMP2 CMakeLists.txt has:
# Wrapping to MATLAB
if(GPMP2_BUILD_MATLAB_TOOLBOX)
  # wrap
  include(GtsamMatlabWrap)
  wrap_and_install_library(gpmp2.h ${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}" "")
  
  # install matlab functions and scripts
  add_subdirectory(matlab)
endif()

So I changed these lines in the CMakeLists.txt file to the following:

find_package(gtwrap REQUIRED)

# Wrapping to MATLAB
if(GPMP2_BUILD_MATLAB_TOOLBOX)

  include(MatlabWrap)
  matlab_wrap(gpmp2.h ${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}" "" "")
  
  # install matlab functions and scripts
  add_subdirectory(matlab)
endif()

However, after making this change, calling sudo cmake -DGPMP2_BUILD_MATLAB_TOOLBOX:=ON .. in the command prompt results in the error during the cmake generation:

CMake Error at CMakeLists.txt:71 (matlab_wrap):
  matlab_wrap Function invoked with incorrect arguments for function named:
  matlab_wrap

Outstanding Question

Am I using the matlab_wrap() function incorrectly? On my computer with the work GPMP2 + GTSAM + Matlab toolbox, my CMakeLists.txt file appears as the way I modified the CMakeLists.txt.

Has there been a modification to the way I am suppose to use matlab_wrap()?

Any thoughts on this @gchenfc?

Environment

Linux OS: Ubuntu 20.04
MATLAB version: 2021a
Standard GPMP2 + MATLAB Toolbox build.

Metadata

Metadata

Labels

bugSomething isn't workingcmakeCMake issuematlab

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions