diff --git a/cpp/graph-inl.h b/cpp/graph-inl.h index 83aeed001..8808911ba 100644 --- a/cpp/graph-inl.h +++ b/cpp/graph-inl.h @@ -124,7 +124,7 @@ public: string key_from = boost::get(boost::vertex_name, g, boost::source(edge, g)); string key_to = boost::get(boost::vertex_name, g, boost::target(edge, g)); Pose relativePose = boost::get(boost::edge_weight, g, edge); - config->insert(key_to, compose(config->get(key_from), relativePose)); + config->insert(key_to, compose(relativePose, config->get(key_from))); } private: diff --git a/cpp/testPose2.cpp b/cpp/testPose2.cpp index ce50ed36b..e58f24db3 100644 --- a/cpp/testPose2.cpp +++ b/cpp/testPose2.cpp @@ -181,6 +181,15 @@ TEST( Pose2, between ) CHECK(assert_equal(numericalH2,actualH2)); } +/* ************************************************************************* */ +TEST( Pose2, round_trip ) +{ + Pose2 p1(1.23, 2.30, 0.2); + Pose2 odo(0.53, 0.39, 0.15); + Pose2 p2 = compose(odo, p1); + CHECK(assert_equal(odo, between(p1, p2))); +} + /* ************************************************************************* */ TEST(Pose2, members) {