From 87df29a696a7997220edafc28dc8cfb1f37c677f Mon Sep 17 00:00:00 2001 From: Patrick de Kok Date: Wed, 13 Aug 2014 14:50:41 +0200 Subject: [PATCH 1/3] CMake finds correct Eigen config in Ubuntu 14.04. The installation tutorial instructs to install Eigen3. A standard Ubuntu installation has no FindEigen.cmake, but only FindEigen3.cmake. Therefore, I instructed CMake to require Eigen3 instead of Eigen. --- Schweizer-Messer/numpy_eigen/CMakeLists.txt | 4 ++-- Schweizer-Messer/sm_eigen/CMakeLists.txt | 6 +++--- Schweizer-Messer/sm_eigen/include/sm/eigen/random.hpp | 1 + Schweizer-Messer/sm_kinematics/CMakeLists.txt | 4 ++-- Schweizer-Messer/sm_matrix_archive/CMakeLists.txt | 4 ++-- Schweizer-Messer/sm_python/CMakeLists.txt | 4 ++-- aslam_cv/aslam_cameras_april/CMakeLists.txt | 2 +- aslam_cv/aslam_imgproc/CMakeLists.txt | 2 +- aslam_offline_calibration/ethz_apriltag2/CMakeLists.txt | 8 ++++---- aslam_optimizer/aslam_backend/CMakeLists.txt | 2 +- aslam_optimizer/aslam_backend_expressions/CMakeLists.txt | 2 +- 11 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Schweizer-Messer/numpy_eigen/CMakeLists.txt b/Schweizer-Messer/numpy_eigen/CMakeLists.txt index 590e351e7..3e6c8aa35 100644 --- a/Schweizer-Messer/numpy_eigen/CMakeLists.txt +++ b/Schweizer-Messer/numpy_eigen/CMakeLists.txt @@ -4,12 +4,12 @@ project(numpy_eigen) find_package(catkin REQUIRED COMPONENTS python_module) include_directories(${catkin_INCLUDE_DIRS}) find_package(Boost REQUIRED COMPONENTS system) -find_package(Eigen REQUIRED) +find_package(Eigen3 REQUIRED) catkin_python_setup() add_definitions(${EIGEN_DEFINITIONS}) -include_directories(include ${Eigen_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) +include_directories(include ${EIGEN3_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) include_directories("${PROJECT_SOURCE_DIR}/include/numpy_eigen") catkin_package( diff --git a/Schweizer-Messer/sm_eigen/CMakeLists.txt b/Schweizer-Messer/sm_eigen/CMakeLists.txt index 5ef34e2aa..175a95dbd 100644 --- a/Schweizer-Messer/sm_eigen/CMakeLists.txt +++ b/Schweizer-Messer/sm_eigen/CMakeLists.txt @@ -4,12 +4,12 @@ project(sm_eigen) find_package(catkin REQUIRED COMPONENTS sm_common sm_random) include_directories(${catkin_INCLUDE_DIRS}) find_package(Boost REQUIRED COMPONENTS system serialization) -find_package(Eigen REQUIRED) +find_package(Eigen3 REQUIRED) -include_directories(include ${Eigen_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) +include_directories(include ${EIGEN3_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) catkin_package( - INCLUDE_DIRS include ${Eigen_INCLUDE_DIRS} + INCLUDE_DIRS include ${EIGEN3_INCLUDE_DIR} LIBRARIES ${PROJECT_NAME} CATKIN_DEPENDS DEPENDS diff --git a/Schweizer-Messer/sm_eigen/include/sm/eigen/random.hpp b/Schweizer-Messer/sm_eigen/include/sm/eigen/random.hpp index 87d062df3..b52fe8c2b 100644 --- a/Schweizer-Messer/sm_eigen/include/sm/eigen/random.hpp +++ b/Schweizer-Messer/sm_eigen/include/sm/eigen/random.hpp @@ -1,5 +1,6 @@ #ifndef SM_EIGEN_RANDOM_HPP #define SM_EIGEN_RANDOM_HPP +#include #include namespace sm { diff --git a/Schweizer-Messer/sm_kinematics/CMakeLists.txt b/Schweizer-Messer/sm_kinematics/CMakeLists.txt index 8bb6417a0..c933f7a8f 100644 --- a/Schweizer-Messer/sm_kinematics/CMakeLists.txt +++ b/Schweizer-Messer/sm_kinematics/CMakeLists.txt @@ -6,8 +6,8 @@ include_directories(${catkin_INCLUDE_DIRS}) find_package(Boost REQUIRED COMPONENTS system serialization filesystem) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) -find_package(Eigen REQUIRED) -include_directories(${EIGEN_INCLUDE_DIRS}) +find_package(Eigen3 REQUIRED) +include_directories(${EIGEN3_INCLUDE_DIR}) add_definitions(${EIGEN_DEFINITIONS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") diff --git a/Schweizer-Messer/sm_matrix_archive/CMakeLists.txt b/Schweizer-Messer/sm_matrix_archive/CMakeLists.txt index a746dbd13..908b8c8f1 100644 --- a/Schweizer-Messer/sm_matrix_archive/CMakeLists.txt +++ b/Schweizer-Messer/sm_matrix_archive/CMakeLists.txt @@ -5,8 +5,8 @@ find_package(catkin REQUIRED COMPONENTS sm_common) include_directories(${catkin_INCLUDE_DIRS}) find_package(Boost REQUIRED COMPONENTS system filesystem) -find_package(Eigen REQUIRED) -include_directories(include ${Eigen_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) +find_package(Eigen3 REQUIRED) +include_directories(include ${EIGEN3_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) catkin_package( INCLUDE_DIRS include ${catkin_INCLUDE_DIRS} diff --git a/Schweizer-Messer/sm_python/CMakeLists.txt b/Schweizer-Messer/sm_python/CMakeLists.txt index e774e5ff7..f4c2ef999 100644 --- a/Schweizer-Messer/sm_python/CMakeLists.txt +++ b/Schweizer-Messer/sm_python/CMakeLists.txt @@ -7,9 +7,9 @@ find_package(catkin REQUIRED COMPONENTS sm_common numpy_eigen sm_kinematics sm_timing sm_logging sm_matrix_archive sm_property_tree python_module) include_directories(${catkin_INCLUDE_DIRS}) -find_package(Eigen REQUIRED) +find_package(Eigen3 REQUIRED) -include_directories(include ${Eigen_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) +include_directories(include ${EIGEN3_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) catkin_package( diff --git a/aslam_cv/aslam_cameras_april/CMakeLists.txt b/aslam_cv/aslam_cameras_april/CMakeLists.txt index 314f953d2..745efb44c 100644 --- a/aslam_cv/aslam_cameras_april/CMakeLists.txt +++ b/aslam_cv/aslam_cameras_april/CMakeLists.txt @@ -7,7 +7,7 @@ catkin_simple() find_package(OpenCV REQUIRED) ADD_DEFINITIONS(-DASLAM_USE_ROS ) -include_directories(${Eigen_INCLUDE_DIRS}) +include_directories(${EIGEN3_INCLUDE_DIR}) cs_add_library(${PROJECT_NAME} diff --git a/aslam_cv/aslam_imgproc/CMakeLists.txt b/aslam_cv/aslam_imgproc/CMakeLists.txt index d14277fc3..851769e7a 100644 --- a/aslam_cv/aslam_imgproc/CMakeLists.txt +++ b/aslam_cv/aslam_imgproc/CMakeLists.txt @@ -7,7 +7,7 @@ catkin_simple() find_package(Boost REQUIRED COMPONENTS system) -include_directories(${Eigen_INCLUDE_DIRS}) +include_directories(${EIGEN3_INCLUDE_DIR}) cs_add_library(${PROJECT_NAME} src/UndistorterBase.cpp) diff --git a/aslam_offline_calibration/ethz_apriltag2/CMakeLists.txt b/aslam_offline_calibration/ethz_apriltag2/CMakeLists.txt index 64f6c43b2..a65ce358c 100644 --- a/aslam_offline_calibration/ethz_apriltag2/CMakeLists.txt +++ b/aslam_offline_calibration/ethz_apriltag2/CMakeLists.txt @@ -5,21 +5,21 @@ project(ethz_apriltag2) find_package(catkin) include_directories(${catkin_INCLUDE_DIRS}) -find_package(Eigen REQUIRED) +find_package(Eigen3 REQUIRED) catkin_package( DEPENDS eigen opencv - INCLUDE_DIRS include ${Eigen_INCLUDE_DIRS} + INCLUDE_DIRS include ${EIGEN3_INCLUDE_DIR} LIBRARIES ${PROJECT_NAME} ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/) -find_package(Eigen REQUIRED) +find_package(Eigen3 REQUIRED) find_package(OpenCV REQUIRED) add_definitions(-fPIC -O3) -include_directories(include ${Eigen_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) +include_directories(include ${EIGEN3_INCLUDE_DIR} ${catkin_INCLUDE_DIRS}) if(NOT APPLE) # The clang compiler (on osx) is somehow much more strict diff --git a/aslam_optimizer/aslam_backend/CMakeLists.txt b/aslam_optimizer/aslam_backend/CMakeLists.txt index f52a6c857..18f340512 100644 --- a/aslam_optimizer/aslam_backend/CMakeLists.txt +++ b/aslam_optimizer/aslam_backend/CMakeLists.txt @@ -6,7 +6,7 @@ catkin_simple() find_package(Boost REQUIRED COMPONENTS system thread) -include_directories(${Eigen_INCLUDE_DIRS}) +include_directories(${EIGEN3_INCLUDE_DIR}) #add_definitions( -fPIC -msse2 -mssse3 -march=nocona -Wextra -Winit-self -Woverloaded-virtual -Wnon-virtual-dtor -Wsign-promo -Wno-long-long -std=c++0x -O3) diff --git a/aslam_optimizer/aslam_backend_expressions/CMakeLists.txt b/aslam_optimizer/aslam_backend_expressions/CMakeLists.txt index e692f709a..5b14a3612 100644 --- a/aslam_optimizer/aslam_backend_expressions/CMakeLists.txt +++ b/aslam_optimizer/aslam_backend_expressions/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(catkin_simple REQUIRED) catkin_simple() -include_directories(${EIGEN_INCLUDE_DIRS}) +include_directories(${EIGEN3_INCLUDE_DIR}) find_package(Boost REQUIRED COMPONENTS system) From e80faaac919d303b154f6e16592e07ce10b92e33 Mon Sep 17 00:00:00 2001 From: Patrick de Kok Date: Wed, 3 Sep 2014 11:27:07 +0200 Subject: [PATCH 2/3] kalibr_bagcreater can now handle short filenames. Previously, filenames had to be at least 10 character, without filetype extension. When a filename was shorter, an empty string would be passed to int(), which results in a ValueError. With this version, when an empty string is encountered, secs is set to 0. --- aslam_offline_calibration/kalibr/python/kalibr_bagcreater | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aslam_offline_calibration/kalibr/python/kalibr_bagcreater b/aslam_offline_calibration/kalibr/python/kalibr_bagcreater index deb4b4c78..764643645 100755 --- a/aslam_offline_calibration/kalibr/python/kalibr_bagcreater +++ b/aslam_offline_calibration/kalibr/python/kalibr_bagcreater @@ -70,7 +70,12 @@ def loadImageToRosMsg(filename): image_np = cv2.imread(filename, cv2.IMREAD_GRAYSCALE) timestamp_nsecs = os.path.splitext(os.path.basename(filename))[0] - timestamp = rospy.Time( secs=int(timestamp_nsecs[0:-9]), nsecs=int(timestamp_nsecs[-9:]) ) + secs = timestamp_nsecs[0:-9] + if len(secs): + secs = int(secs) + else: + secs = 0 + timestamp = rospy.Time( secs=secs, nsecs=int(timestamp_nsecs[-9:]) ) rosimage = Image() rosimage.header.stamp = timestamp From 2c209c13c245c69061f1cea48373a794d89ef5cb Mon Sep 17 00:00:00 2001 From: Patrick de Kok Date: Tue, 9 Sep 2014 15:44:26 +0200 Subject: [PATCH 3/3] Grayscale images sometimes problem in calibration. When the sensor_msgs/Image is converted to its numpy `ndarray` representation, it sometimes has the shape `(n, m, 1)`. This gives an error even though it is a `sensor_msgs::image_encodings::MONO8`. The underlying algorithm only supports 2D arrays, and the images were stored as 3D objects. Error: ``` TypeError: Conversion is only valid for arrays with 1 or 2 dimensions. Argument has 3 dimensions ``` Transforming the image with a reshape if and only if it has a dimension of lenght 1 solves this problem. --- .../kalibr/python/kalibr_common/TargetExtractor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aslam_offline_calibration/kalibr/python/kalibr_common/TargetExtractor.py b/aslam_offline_calibration/kalibr/python/kalibr_common/TargetExtractor.py index 2b7ca395d..108ef7a60 100644 --- a/aslam_offline_calibration/kalibr/python/kalibr_common/TargetExtractor.py +++ b/aslam_offline_calibration/kalibr/python/kalibr_common/TargetExtractor.py @@ -18,6 +18,7 @@ def multicoreExtractionWrapper(detector, taskq, resultq, clearImages, noTransfor stamp = task[1] image = task[2] + image = image.reshape(filter(lambda dim: dim != 1, image.shape)) if noTransformation: success, obs = detector.findTargetNoTransformation(stamp, np.array(image)) else: