Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/testcases #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ bool OmniProjection<DISTORTION_T>::keypointToHomogeneous(

Eigen::MatrixBase<DERIVED_JK> & Jk =
const_cast<Eigen::MatrixBase<DERIVED_JK> &>(outJk);
Jk.derived().resize(2, 4);
Jk.derived().resize(4, 2);
Jk.setZero();

Eigen::MatrixBase<DERIVED_P> & p =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ bool PinholeProjection<DISTORTION_T>::keypointToHomogeneous(
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE_OR_DYNAMIC(
Eigen::MatrixBase<DERIVED_JK>, 4, 2);

Eigen::MatrixBase<DERIVED_JK> & Jk =
const_cast<Eigen::MatrixBase<DERIVED_JK> &>(outJk);
Jk.derived().resize(2, 4);
Eigen::MatrixBase<DERIVED_JK> & Jk = const_cast<Eigen::MatrixBase<DERIVED_JK> &>(outJk);

Jk.derived().resize(4, 2);
Jk.setZero();

Eigen::MatrixBase<DERIVED_P> & p =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,6 @@ class CameraGeometryTestHarness {

};

} // namespace cameras
} // namespace cameras
} // namespace asl

8 changes: 4 additions & 4 deletions aslam_cv/aslam_cameras/src/PinholeCameraGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ PinholeCameraGeometry PinholeCameraGeometry::createDistortedTestGeometry() {
return PinholeCameraGeometry(400, 400, 320, 240, 640, 480, 0.2, 0.2, 0.2, 0.2);
}

/**
/**
* \brief Apply distortion to input point (from the normalised plane)
*
*
* \param mx_u undistorted x coordinate of point on the normalised plane
* \param my_u undistorted y coordinate of point on the normalised plane
* \param dx return value, to obtain the distorted point : mx_d = mx_u+dx_u
Expand All @@ -110,7 +110,7 @@ void PinholeCameraGeometry::distortion(double mx_u, double my_u, double *dx_u,
*dy_u = my_u * rad_dist_u + 2 * _p2 * mxy_u + _p1 * (rho2_u + 2 * my2_u);
}

/**
/**
* \brief Apply distortion to input point (from the normalised plane)
* and calculate jacobian
*
Expand Down Expand Up @@ -203,6 +203,6 @@ PinholeCameraGeometry::traits_t::intrinsics_t PinholeCameraGeometry::getIntrinsi
return intrinsics;
}

} // namespace cameras
} // namespace cameras

} // namespace aslam
4 changes: 3 additions & 1 deletion aslam_cv/aslam_cv_backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ find_package(catkin_simple REQUIRED)

catkin_simple()


cs_add_library(${PROJECT_NAME}
src/ReprojectionError.cpp
src/GridCalibrationTargetDesignVariableContainer.cpp
Expand All @@ -22,6 +21,9 @@ catkin_add_gtest(${PROJECT_NAME}_test
test/testReprojectionError.cpp
)

find_package(Boost REQUIRED COMPONENTS system)

target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME})

cs_install()
Expand Down
5 changes: 3 additions & 2 deletions aslam_cv/aslam_cv_serialization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

cmake_minimum_required(VERSION 2.8.3)
project(aslam_cv_serialization)

Expand All @@ -8,13 +9,13 @@ catkin_simple()
INCLUDE(autogen_cameras.cmake)
#INCLUDE(autogen_frames.cmake)

cs_add_library(${PROJECT_NAME}
cs_add_library(${PROJECT_NAME}
# ${AUTOGEN_FRAME_CPP_FILES}
${AUTOGEN_CAMERA_CPP_FILES}
src/FrameBaseSerialization.cpp
)

find_package(Boost REQUIRED COMPONENTS serialization)
find_package(Boost REQUIRED COMPONENTS serialization system)
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})

# Avoid clash with tr1::tuple: https://code.google.com/p/googletest/source/browse/trunk/README?r=589#257
Expand Down
1 change: 1 addition & 0 deletions aslam_cv/aslam_cv_serialization/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<build_depend>sm_opencv</build_depend>
<build_depend>sm_logging</build_depend>
<build_depend>opencv2_catkin</build_depend>
<build_depend>sm_random</build_depend>

<build_depend>eigen</build_depend>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "aslam/calibration/core/IncrementalOptimizationProblem.h"
#include "aslam/calibration/core/OptimizationProblem.h"
#include "aslam/calibration/data-structures/VectorDesignVariable.h"
#include <aslam/Exceptions.hpp>
#include "aslam/calibration/exceptions/OutOfBoundException.h"
#include "aslam/calibration/exceptions/InvalidOperationException.h"

Expand Down Expand Up @@ -158,7 +159,7 @@ TEST(AslamCalibrationTestSuite, testIncrementalOptimizationProblem) {
ASSERT_EQ(incProblem.errorTerm(6), et7.get());
ASSERT_EQ(incProblem.errorTerm(7), et8.get());
ASSERT_EQ(incProblem.errorTerm(8), et9.get());
ASSERT_THROW(incProblem.errorTerm(9), OutOfBoundException<size_t>);
ASSERT_THROW(incProblem.errorTerm(9), aslam::Exception);
ASSERT_EQ(incProblem.getNumGroups(), 2);
ASSERT_EQ(incProblem.getGroupId(dv1.get()), 0);
ASSERT_EQ(incProblem.getGroupId(dv2.get()), 0);
Expand All @@ -181,7 +182,7 @@ TEST(AslamCalibrationTestSuite, testIncrementalOptimizationProblem) {
ASSERT_EQ(incProblem.designVariable(3), dv5.get());
ASSERT_EQ(incProblem.designVariable(4), dv6.get());
ASSERT_EQ(incProblem.designVariable(5), dv3.get());
ASSERT_THROW(incProblem.designVariable(7), OutOfBoundException<size_t>);
ASSERT_THROW(incProblem.designVariable(7), aslam::Exception);
incProblem.setGroupsOrdering({1, 0});
ASSERT_EQ(incProblem.getGroupsOrdering(), std::vector<size_t>({1, 0}));
ASSERT_EQ(incProblem.designVariable(0), dv3.get());
Expand Down Expand Up @@ -213,7 +214,7 @@ TEST(AslamCalibrationTestSuite, testIncrementalOptimizationProblem) {
ASSERT_EQ(incProblem.errorTerm(4), et5.get());
ASSERT_EQ(incProblem.errorTerm(5), et6.get());
ASSERT_EQ(incProblem.errorTerm(6), et7.get());
ASSERT_THROW(incProblem.errorTerm(7), OutOfBoundException<size_t>);
ASSERT_THROW(incProblem.errorTerm(7), aslam::Exception);
Eigen::MatrixXd dv1Param;
Eigen::MatrixXd dv6Param;
incProblem.saveDesignVariables();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "aslam/calibration/core/OptimizationProblem.h"
#include "aslam/calibration/data-structures/VectorDesignVariable.h"
#include <aslam/Exceptions.hpp>
#include "aslam/calibration/exceptions/OutOfBoundException.h"
#include "aslam/calibration/exceptions/InvalidOperationException.h"

Expand Down Expand Up @@ -95,7 +96,7 @@ TEST(AslamCalibrationTestSuite, testOptimizationProblem) {
ASSERT_EQ(problem.designVariable(0), dv2.get());
ASSERT_EQ(problem.designVariable(1), dv3.get());
ASSERT_EQ(problem.designVariable(2), dv1.get());
ASSERT_THROW(problem.designVariable(3), OutOfBoundException<size_t>);
ASSERT_THROW(problem.designVariable(3), aslam::Exception);
problem.permuteDesignVariables({1, 0}, 1);
ASSERT_EQ(problem.designVariable(0), dv3.get());
ASSERT_THROW(problem.permuteDesignVariables({1, 0}, 2),
Expand All @@ -116,7 +117,7 @@ TEST(AslamCalibrationTestSuite, testOptimizationProblem) {
ASSERT_EQ(problem.errorTerm(0), et1.get());
ASSERT_EQ(problem.errorTerm(1), et2.get());
ASSERT_EQ(problem.errorTerm(2), et3.get());
ASSERT_THROW(problem.errorTerm(3), OutOfBoundException<size_t>);
ASSERT_THROW(problem.errorTerm(3), aslam::Exception);
ASSERT_THROW(problem.addErrorTerm(et1), InvalidOperationException);
problem.permuteErrorTerms({2, 1, 0});
auto etsp = problem.getErrorTerms();
Expand Down
2 changes: 1 addition & 1 deletion aslam_offline_calibration/kalibr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ catkin_add_gtest(${PROJECT_NAME}_test
test/test_main.cpp
test/TestErrorTerms.cpp
)
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME}_errorterms)

##################################
# EXPORT
Expand Down
14 changes: 7 additions & 7 deletions aslam_optimizer/aslam_backend_expressions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ include_directories(${EIGEN_INCLUDE_DIRS})
find_package(Boost REQUIRED COMPONENTS system)

cs_add_library(${PROJECT_NAME}
src/RotationExpression.cpp
src/RotationExpression.cpp
src/RotationExpressionNode.cpp
src/RotationQuaternion.cpp
src/MappedRotationQuaternion.cpp
src/Vector2RotationQuaternionExpressionAdapter.cpp

src/MatrixExpression.cpp
src/MatrixExpression.cpp
src/MatrixExpressionNode.cpp
src/MatrixTransformation.cpp

src/TransformationExpression.cpp
src/TransformationExpression.cpp
src/TransformationExpressionNode.cpp
src/TransformationBasic.cpp

src/EuclideanExpression.cpp
src/EuclideanExpression.cpp
src/EuclideanExpressionNode.cpp
src/EuclideanPoint.cpp
src/MappedEuclideanPoint.cpp

src/HomogeneousExpression.cpp
src/HomogeneousExpression.cpp
src/HomogeneousExpressionNode.cpp
src/HomogeneousPoint.cpp
src/MappedHomogeneousPoint.cpp
Expand All @@ -48,7 +48,7 @@ cs_add_library(${PROJECT_NAME}
src/ErrorTermEuclidean.cpp

src/MapTransformation.cpp
)
)

target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})

Expand All @@ -61,7 +61,7 @@ catkin_add_gtest(${PROJECT_NAME}_test
test/HomogeneousExpression.cpp
test/MatrixAndEuclideanExpression.cpp
# \todo reenable after I can talk to Hannes.
test/FixedPointNumberTest.cpp
# test/FixedPointNumberTest.cpp
test/GenericScalarExpressionTest.cpp
test/GenericMatrixExpression.cpp
test/QuaternionExpression.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GenericScalar : public GenericScalarExpressionNode<Scalar_>, public Design
virtual void updateImplementation(const double * dp, int size);

/// \brief the size of an update step
virtual inline constexpr int minimalDimensionsImplementation() const { return MinimalDimension; }
virtual inline int minimalDimensionsImplementation() const { return MinimalDimension; }
private:
virtual Scalar toScalarImplementation() const;
virtual void evaluateJacobiansImplementation(JacobianContainer & outJacobians, const Eigen::MatrixXd * applyChainRule) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ class ExpressionJacobianTestTraits<RotationExpression> {
Eigen::MatrixXd Jest = numdiff.estimateJacobian(dp);

auto JcM = Jc.asSparseMatrix();
sm::eigen::assertNear(Jc.asSparseMatrix(), Jest, expressionTester.getTolerance(), SM_SOURCE_FILE_POS, static_cast<std::stringstream&>(std::stringstream("Testing the RotationExpression's Jacobian (column=") << i <<")").str());
sm::eigen::assertNear(
Jc.asSparseMatrix(),
Jest,
expressionTester.getTolerance(),
SM_SOURCE_FILE_POS,
(std::stringstream("Testing the RotationExpression's Jacobian (column=") << i << ")").str()
);
if (expressionTester.getPrintResult()) {
std::cout << "Jest=\n" << Jest << std::endl;
std::cout << "Jc=\n" << JcM << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ struct RotationQuaternionAsVectorExpressionNode : public VectorExpressionNode<4>
virtual void evaluateJacobiansImplementation(JacobianContainer & outJacobians) const { evaluateJacobiansImplementation(outJacobians, Eigen::Matrix3d::Identity()); };
virtual void evaluateJacobiansImplementation(JacobianContainer & outJacobians, const Eigen::MatrixXd & applyChainRule) const {
if(AssumeLieAlgebraVectorInputInJacobian){
quat.evaluateJacobians(outJacobians, applyChainRule * sm::kinematics::quatOPlus(quat.getQuaternion() * 0.5).topLeftCorner<4,3>());
Eigen::Matrix4d tmp = sm::kinematics::quatOPlus(quat.getQuaternion() * 0.5);
quat.evaluateJacobians(
outJacobians,
applyChainRule * tmp.topLeftCorner<4,3>()
);
}else{
quat.evaluateJacobians(outJacobians, applyChainRule);
}
Expand Down