borglab / gtsam

GTSAM is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision, using factor graphs and Bayes networks as the underlying computing paradigm rather than sparse matrices.
http://gtsam.org
Other
2.62k stars 767 forks source link

Matlab Toolbox issue - Unrecognized function or variable 'NonlinearFactorGraph'. #1218

Closed teku45 closed 2 years ago

teku45 commented 2 years ago

High,

I followed the build and install instructions for the matlab toolbox and am getting unrecognized function errors in matlab when I try to run gtsamExamples.m.

Running Ubuntu 18.04 with the latest version of Boost and Cmake. Python 3.6.9

Here is the matlab error output:

Unrecognized function or variable 'NonlinearFactorGraph'.

Error in OdometryExample (line 21)
graph = NonlinearFactorGraph;

Error in gtsamExamples>gtsamExamples_OpeningFcn (line 60)
OdometryExample;

Error in gui_mainfcn (line 220)
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in gtsamExamples (line 42)
    gui_mainfcn(gui_State, varargin{:});

My install output seems like the matlab toolbox installed fine? It properly compiled the gtsam_wrapper.mexa64 file

Here is my installer output:

[  2%] Built target CppUnitLite
[ 18%] Built target metis-gtsam
[ 57%] Built target gtsam
[ 60%] Built target easyPoint2KalmanFilter
[ 60%] Built target StereoVOExample
[ 60%] Built target SelfCalibrationExample
[ 60%] Built target StereoVOExample_large
[ 63%] Built target UGM_chain
[ 63%] Built target VisualISAMExample
[ 63%] Built target ShonanAveragingCLI
[ 63%] Built target SolverComparer
[ 63%] Built target SFMExample_SmartFactorPCG
[ 65%] Built target SFMExample
[ 68%] Built target SFMExample_bal
[ 68%] Built target RangeISAMExample_plaza2
[ 71%] Built target LocalizationExample
[ 71%] Built target METISOrderingExample
[ 71%] Built target SimpleRotation
[ 73%] Built target ISAM2Example_SmartFactor
[ 73%] Built target SFMExampleExpressions_bal
[ 73%] Built target ImuFactorsExample2
[ 73%] Built target Pose2SLAMStressTest
[ 73%] Built target UGM_small
[ 73%] Built target SFMExample_SmartFactor
[ 73%] Built target InverseKinematicsExampleExpressions
[ 73%] Built target CameraResectioning
[ 73%] Built target VisualISAM2Example
[ 73%] Built target SFMExampleExpressions
[ 73%] Built target IMUKittiExampleGPS
[ 73%] Built target CombinedImuFactorsExample
[ 73%] Built target Pose2SLAMExample_graph
[ 73%] Built target DiscreteBayesNetExample
[ 73%] Built target ImuFactorsExample
[ 76%] Built target FisheyeExample
[ 76%] Built target Pose2SLAMExample_graphviz
[ 76%] Built target CreateSFMExampleData
[ 76%] Built target SFMExample_bal_COLAMD_METIS
[ 76%] Built target HMMExample
[ 76%] Built target PlanarSLAMExample
[ 76%] Built target Pose2SLAMwSPCG
[ 76%] Built target Pose2SLAMExample
[ 76%] Built target TimeTBB
[ 76%] Built target Pose3SLAMExample_initializePose3Chordal
[ 78%] Built target Pose2SLAMExample_lago
[ 81%] Built target Pose2SLAMExampleExpressions
[ 81%] Built target DiscreteBayesNet_FG
[ 81%] Built target Pose3SLAMExample_initializePose3Gradient
[ 81%] Built target Pose3Localization
[ 81%] Built target OdometryExample
[ 81%] Built target Pose3SLAMExampleExpressions_BearingRangeWithTransform
[ 84%] Built target Pose3SLAMExample_changeKeys
[ 84%] Built target Pose2SLAMExample_g2o
[ 84%] Built target Pose3SLAMExample_g2o
[ 84%] Built target gtsam_matlab_wrapper
[ 94%] Built target gtsam_unstable
[ 97%] Built target schedulingExample
[ 97%] Built target GncPoseAveragingExample
[ 97%] Built target ConcurrentCalibration
[ 97%] Built target schedulingQuals12
[ 97%] Built target schedulingQuals13
[ 97%] Built target ConcurrentFilteringAndSmoothingExample
[ 97%] Built target SmartRangeExample_plaza2
[ 97%] Built target TimeOfArrivalExample
[ 97%] Built target SmartStereoProjectionFactorExample
[ 97%] Built target SmartRangeExample_plaza1
[ 97%] Built target FixedLagSmootherExample
[100%] Built target SmartProjectionFactorExample
[100%] Built target ISAM2_SmartFactorStereo_IMU
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/lib/cmake/GTSAM/gtsam_extra.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM/GTSAMConfigVersion.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM/GTSAM-exports.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM/GTSAM-exports-release.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM_UNSTABLE/gtsam_extra.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM_UNSTABLE/GTSAM_UNSTABLEConfig.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM_UNSTABLE/GTSAM_UNSTABLEConfigVersion.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM_UNSTABLE/GTSAM_UNSTABLE-exports.cmake
-- Up-to-date: /usr/local/lib/cmake/GTSAM_UNSTABLE/GTSAM_UNSTABLE-exports-release.cmake
-- Up-to-date: /usr/local/include/gtsam/3rdparty/metis/metis.h
-- Up-to-date: /usr/local/lib/libmetis-gtsam.so
-- Up-to-date: /usr/local/include/CppUnitLite/Failure.h
-- Up-to-date: /usr/local/include/CppUnitLite/Test.h
-- Up-to-date: /usr/local/include/CppUnitLite/TestHarness.h
-- Up-to-date: /usr/local/include/CppUnitLite/TestRegistry.h
-- Up-to-date: /usr/local/include/CppUnitLite/TestResult.h
-- Up-to-date: /usr/local/lib/libCppUnitLite.a
-- Up-to-date: /usr/local/include/gtsam/global_includes.h
-- Up-to-date: /usr/local/include/gtsam/precompiled_header.h
-- Up-to-date: /usr/local/include/gtsam/config.h
-- Up-to-date: /usr/local/include/gtsam/dllexport.h
-- Up-to-date: /usr/local/lib/libgtsam.so.4.1.1
-- Up-to-date: /usr/local/lib/libgtsam.so.4
-- Up-to-date: /usr/local/lib/libgtsam.so
-- Up-to-date: /usr/local/include/gtsam/3rdparty/CCOLAMD/ccolamd.h
-- Up-to-date: /usr/local/include/gtsam/3rdparty/SuiteSparse_config/SuiteSparse_config.h
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Cholesky
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/CholmodSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Core
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Dense
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Eigen
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Eigenvalues
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Geometry
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Householder
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/IterativeLinearSolvers
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Jacobi
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/LU
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/MetisSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/OrderingMethods
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/PaStiXSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/PardisoSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/QR
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/QtAlignedMalloc
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SPQRSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SVD
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/Sparse
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SparseCholesky
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SparseCore
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SparseLU
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SparseQR
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/StdDeque
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/StdList
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/StdVector
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/SuperLUSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen/UmfPackSupport
-- Up-to-date: /usr/local/include/gtsam/3rdparty/Eigen/Eigen
.
.
.
(everything says Up to date but output is too long to paste)
varunagrawal commented 2 years ago

Did you run addpath('<path to gtsam_toolbox>') first before running the examples? E.g. I run addpath('/usr/local/gtsam_toolbox') since my install location is /usr/local.

varunagrawal commented 2 years ago

@teku45 any updates? Please reopen this if the issue still persists.

ClaudioCimarelli commented 2 years ago

I have the same issue with gtsam 4.1.1. I have installed it in a local folder under $HOME. It appears that the gtsam_toolbox folder missed some *.m files needed to use those functions. Is it possible that it is due to switching off the unstable build CMake option?