auralius / kalman-cpp Goto Github PK
View Code? Open in Web Editor NEWKalman Filter, Extended Kalman Filter, and Unscented Kalman Filter implementation in C++
Home Page: https://auralius.github.io/kalman-cpp/
Kalman Filter, Extended Kalman Filter, and Unscented Kalman Filter implementation in C++
Home Page: https://auralius.github.io/kalman-cpp/
How can I integrate your project in a cmake project? I have linking errors
Friend, I try to run your project but I have errors.
I installed all the necessary packages: ATLAS, ARPACK, LAPACK, BLAS and ARMADILLO.
Which versions do you use?
ERROR:
joahannes@Joahannes:~/Downloads/kalman-cpp-master$ g++ main5.cpp -o test -O2 -larmadillo ekf.cpp
/tmp/ccAJNHBr.o: na função void arma::glue_times_redirect2_helper<false>::apply<arma::Mat<double>, arma::Col<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Col<double>, arma::glue_times> const&)': ekf.cpp:(.text.hot._ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0x12c): referência indefinida para
wrapper_dgemv_'
ekf.cpp:(.text.hot.ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0x2f3): referência indefinida para wrapper_dgemv_' ekf.cpp:(.text.hot._ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0x807): referência indefinida para
wrapper_dgemv'
/tmp/ccAJNHBr.o: na função void arma::glue_times::apply<double, false, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double)': ekf.cpp:(.text.hot._ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x286): referência indefinida para
wrapper_dgemm'
ekf.cpp:(.text.hot.ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4[ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4]+0x4be): referência indefinida para wrapper_dgemv_' /tmp/ccAJNHBr.o: na função
arma::arma_real_only::result arma::op_dot::direct_dot(unsigned int, double const*, double const*)':
ekf.cpp:(.text.hot.ZN4arma6op_dot10direct_dotIdEENS_14arma_real_onlyIT_E6resultEjPKS3_S7[ZN4arma6op_dot10direct_dotIdEENS_14arma_real_onlyIT_E6resultEjPKS3_S7]+0xca): referência indefinida para wrapper_ddot_' /tmp/ccAJNHBr.o: na função
void arma::glue_times::apply<double, false, true, false, arma::Mat, arma::Mat >(arma::Mat&, arma::Mat const&, arma::Mat const&, double)':
ekf.cpp:(.text.hot.ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4[ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4]+0x298): referência indefinida para wrapper_dgemm_' ekf.cpp:(.text.hot._ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x52d): referência indefinida para
wrapper_dgemv_'
ekf.cpp:(.text.hot.ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4[ZN4arma10glue_times5applyIdLb0ELb1ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4]+0x63f): referência indefinida para wrapper_dsyrk_' /tmp/ccAJNHBr.o: na função
void arma::glue_times::apply<double, false, true, false, false, arma::Mat, arma::Mat, arma::Mat >(arma::Mat&, arma::Mat const&, arma::Mat const&, arma::Mat const&, double)':
ekf.cpp:(.text.hot.ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4[ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4]+0x2a1): referência indefinida para wrapper_dgemm_' ekf.cpp:(.text.hot._ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4_]+0x5cf): referência indefinida para
wrapper_dgemv_'
ekf.cpp:(.text.hot.ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4[ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4]+0x689): referência indefinida para wrapper_dgemv_' ekf.cpp:(.text.hot._ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4_[_ZN4arma10glue_times5applyIdLb0ELb1ELb0ELb0ENS_3MatIdEES3_S3_EEvRNS2_IT_EERKT4_RKT5_RKT6_S4_]+0x72c): referência indefinida para
wrapper_dsyrk_'
/tmp/ccAJNHBr.o: na função void arma::glue_times_redirect3_helper<false>::apply<arma::Mat<double>, arma::Op<arma::Mat<double>, arma::op_htrans>, arma::Op<arma::eGlue<arma::Glue<arma::Glue<arma::Mat<double>, arma::Mat<double>, arma::glue_times>, arma::Op<arma::Mat<double>, arma::op_htrans>, arma::glue_times>, arma::Mat<double>, arma::eglue_plus>, arma::op_inv> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Glue<arma::Mat<double>, arma::Op<arma::Mat<double>, arma::op_htrans>, arma::glue_times>, arma::Op<arma::eGlue<arma::Glue<arma::Glue<arma::Mat<double>, arma::Mat<double>, arma::glue_times>, arma::Op<arma::Mat<double>, arma::op_htrans>, arma::glue_times>, arma::Mat<double>, arma::eglue_plus>, arma::op_inv>, arma::glue_times> const&)': ekf.cpp:(.text.hot._ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE[_ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE]+0x38f): referência indefinida para
wrapper_dgetri_'
ekf.cpp:(.text.hot._ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE[ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE]+0x5a3): referência indefinida para wrapper_dgetrf_' ekf.cpp:(.text.hot._ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE[_ZN4arma27glue_times_redirect3_helperILb0EE5applyINS_3MatIdEENS_2OpIS4_NS_9op_htransEEENS5_INS_5eGlueINS_4GlueINS9_IS4_S4_NS_10glue_timesEEES7_SA_EES4_NS_10eglue_plusEEENS_6op_invEEEEEvRNS3_INT_9elem_typeEEERKNS9_INS9_ISH_T0_SA_EET1_SA_EE]+0x963): referência indefinida para
wrapper_dgetri'
collect2: error: ld returned 1 exit status
While trying to use the library with larger matrices I ran into this error:
I've tried replacing the armadillo dependency with a system installed version, tried modifying the armadillo config.hpp header with #define ARMA_USE_LAPACK - but no matter what I try the error keeps happening. Have you ran into this issue before? Any suggestions?
p.s. I am by no means a cpp expert so I apologise if it turns out that this has nothing to do with your library.
lapack and blas have additional dependencies on DLLs that were not installed on my system. I solved by going to:
https://www.intel.com/content/www/us/en/developer/articles/tool/compilers-redistributable-libraries-by-version.html
and downloading "Intel® Fortran Compiler Runtime for Windows* and running the installed. It might save future programmers a few minutes by documenting this dependency.
=======
C:\Downloads\kalman-cpp-master\bin>dumpbin /dependents cbia.lib.lapack.dyn.rel.x64.12.dll
Microsoft (R) COFF/PE Dumper Version 14.26.28806.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file cbia.lib.lapack.dyn.rel.x64.12.dll
File Type: DLL
Image has the following dependencies:
cbia.lib.blas.dyn.rel.x64.12.dll
**libifcoremd.dll**
**libmmd.dll**
MSVCR120.dll
**svml_dispmd.dll**
KERNEL32.dll
Yes, they are different!
The Visual Studio projects (vs2019/ folder) compiled the examples fine for Windows, but if you want to use VSCode and CMake instead, there are some changes needed: include link_directories to libs, add path for header files, remove armadillo lib link and add blas, lapack libs to link :
cmake_minimum_required(VERSION 2.6)
project(kalman-cpp)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_BUILD_TYPE Debug)
link_directories(${CMAKE_SOURCE_DIR}/windows-libs)
add_library (kalman-cpp ./kalman/kf.cpp ./kalman/ekf.cpp ./kalman/ekf2.cpp ./kalman/ukf.cpp ./kalman/fx.cpp)
target_include_directories (kalman-cpp PUBLIC ./kalman ./windows-libs/armadillo/include)
add_executable(demo1 ./samples/main1.cpp)
add_executable(demo2 ./samples/main2.cpp)
add_executable(demo3 ./samples/main3.cpp)
add_executable(demo4 ./samples/main4.cpp)
add_executable(demo5 ./samples/main5.cpp)
add_executable(demo6 ./samples/main6.cpp)
add_executable(demo7 ./samples/main7.cpp)
add_executable(demo8 ./samples/main8.cpp)
add_executable(demo9 ./samples/main9.cpp)
add_executable(demo10 ./samples/main10.cpp)
add_executable(demo11 ./samples/main11.cpp)
install(TARGETS demo1 RUNTIME DESTINATION ../bin)
install(TARGETS demo2 RUNTIME DESTINATION ../bin)
install(TARGETS demo3 RUNTIME DESTINATION ../bin)
install(TARGETS demo4 RUNTIME DESTINATION ../bin)
install(TARGETS demo5 RUNTIME DESTINATION ../bin)
install(TARGETS demo6 RUNTIME DESTINATION ../bin)
install(TARGETS demo7 RUNTIME DESTINATION ../bin)
install(TARGETS demo8 RUNTIME DESTINATION ../bin)
install(TARGETS demo9 RUNTIME DESTINATION ../bin)
install(TARGETS demo10 RUNTIME DESTINATION ../bin)
install(TARGETS demo11 RUNTIME DESTINATION ../bin)
target_link_libraries (demo1 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo2 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo3 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo4 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo5 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo6 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo7 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo8 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo9 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo10 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
target_link_libraries (demo11 LINK_PUBLIC kalman-cpp cbia.lib.lapack.dyn.rel.x64.12 cbia.lib.blas.dyn.rel.x64.12)
Since the blas, lapack dlls are in bin, i changed my VSCode launch configuration like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/debug/demo1.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/bin/",
"environment": [],
"console": "externalTerminal"
}
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.