From 342ab73ecc4f9e9d4775a3587e162400c8c5ccc8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 13 Jun 2021 10:22:51 -0400 Subject: [PATCH 1/2] merge double into Values templates --- gtsam/gtsam.i | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/gtsam/gtsam.i b/gtsam/gtsam.i index 400e98a8e5..94d10953bb 100644 --- a/gtsam/gtsam.i +++ b/gtsam/gtsam.i @@ -2257,6 +2257,7 @@ class Values { void insert(size_t j, const gtsam::PinholeCamera& camera); void insert(size_t j, const gtsam::imuBias::ConstantBias& constant_bias); void insert(size_t j, const gtsam::NavState& nav_state); + void insert(size_t j, double c); void update(size_t j, const gtsam::Point2& point2); void update(size_t j, const gtsam::Point3& point3); @@ -2278,13 +2279,31 @@ class Values { void update(size_t j, const gtsam::NavState& nav_state); void update(size_t j, Vector vector); void update(size_t j, Matrix matrix); - - template, gtsam::imuBias::ConstantBias, gtsam::NavState, Vector, Matrix}> + void update(size_t j, double c); + + template , + gtsam::imuBias::ConstantBias, + gtsam::NavState, + Vector, + Matrix, + double}> T at(size_t j); - /// version for double - void insertDouble(size_t j, double c); - double atDouble(size_t j) const; }; #include From 52bf1cd765f52941cc2ea2394832d2f6a5ae622e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 13 Jun 2021 10:24:15 -0400 Subject: [PATCH 2/2] add cmake command to run GTSAM python tests --- python/CMakeLists.txt | 10 ++++++++++ python/README.md | 8 ++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index fb4d891488..5f51368e6a 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -142,3 +142,13 @@ add_custom_target(${GTSAM_PYTHON_INSTALL_TARGET} COMMAND ${PYTHON_EXECUTABLE} ${GTSAM_PYTHON_BUILD_DIRECTORY}/setup.py install DEPENDS ${GTSAM_PYTHON_DEPENDENCIES} WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY}) + +# Custom make command to run all GTSAM Python tests +add_custom_target( + python-test + COMMAND + ${CMAKE_COMMAND} -E env # add package to python path so no need to install + "PYTHONPATH=${GTSAM_PYTHON_BUILD_DIRECTORY}/$ENV{PYTHONPATH}" + ${PYTHON_EXECUTABLE} -m unittest discover + DEPENDS ${GTSAM_PYTHON_DEPENDENCIES} + WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY}/gtsam/tests) diff --git a/python/README.md b/python/README.md index c485d12bdc..ec9808ce0d 100644 --- a/python/README.md +++ b/python/README.md @@ -35,12 +35,8 @@ For instructions on updating the version of the [wrap library](https://github.co ## Unit Tests The Python toolbox also has a small set of unit tests located in the -test directory. To run them: - - ```bash - cd /python/gtsam/tests - python -m unittest discover - ``` +test directory. +To run them, use `make python-test`. ## Utils