Fix leak in LandmarkCostFunctionTest. (#902)
parent
9793542957
commit
cf01184114
|
@ -15,8 +15,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cartographer/mapping_2d/pose_graph/landmark_cost_function.h"
|
#include "cartographer/mapping_2d/pose_graph/landmark_cost_function.h"
|
||||||
#include "cartographer/transform/rigid_transform.h"
|
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "cartographer/transform/rigid_transform.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
@ -39,7 +41,8 @@ TEST(LandmarkCostFunctionTest, SmokeTest) {
|
||||||
next_node.time = common::FromUniversal(10);
|
next_node.time = common::FromUniversal(10);
|
||||||
next_node.gravity_alignment = Eigen::Quaterniond::Identity();
|
next_node.gravity_alignment = Eigen::Quaterniond::Identity();
|
||||||
|
|
||||||
auto* cost_function = LandmarkCostFunction::CreateAutoDiffCostFunction(
|
std::unique_ptr<ceres::CostFunction> cost_function(
|
||||||
|
LandmarkCostFunction::CreateAutoDiffCostFunction(
|
||||||
LandmarkObservation{
|
LandmarkObservation{
|
||||||
0 /* trajectory ID */,
|
0 /* trajectory ID */,
|
||||||
common::FromUniversal(5) /* time */,
|
common::FromUniversal(5) /* time */,
|
||||||
|
@ -47,7 +50,7 @@ TEST(LandmarkCostFunctionTest, SmokeTest) {
|
||||||
1. /* translation_weight */,
|
1. /* translation_weight */,
|
||||||
2. /* rotation_weight */,
|
2. /* rotation_weight */,
|
||||||
},
|
},
|
||||||
prev_node, next_node);
|
prev_node, next_node));
|
||||||
|
|
||||||
const std::array<double, 3> prev_node_pose{{2., 0., 0.}};
|
const std::array<double, 3> prev_node_pose{{2., 0., 0.}};
|
||||||
const std::array<double, 3> next_node_pose{{0., 2., 0.}};
|
const std::array<double, 3> next_node_pose{{0., 2., 0.}};
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cartographer/mapping_3d/pose_graph/landmark_cost_function.h"
|
#include "cartographer/mapping_3d/pose_graph/landmark_cost_function.h"
|
||||||
#include "cartographer/transform/rigid_transform.h"
|
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "cartographer/transform/rigid_transform.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
@ -37,7 +39,8 @@ TEST(LandmarkCostFunctionTest, SmokeTest) {
|
||||||
NodeData next_node;
|
NodeData next_node;
|
||||||
next_node.time = common::FromUniversal(10);
|
next_node.time = common::FromUniversal(10);
|
||||||
|
|
||||||
auto* cost_function = LandmarkCostFunction::CreateAutoDiffCostFunction(
|
std::unique_ptr<ceres::CostFunction> cost_function(
|
||||||
|
LandmarkCostFunction::CreateAutoDiffCostFunction(
|
||||||
LandmarkObservation{
|
LandmarkObservation{
|
||||||
0 /* trajectory ID */,
|
0 /* trajectory ID */,
|
||||||
common::FromUniversal(5) /* time */,
|
common::FromUniversal(5) /* time */,
|
||||||
|
@ -45,7 +48,7 @@ TEST(LandmarkCostFunctionTest, SmokeTest) {
|
||||||
1. /* translation_weight */,
|
1. /* translation_weight */,
|
||||||
2. /* rotation_weight */,
|
2. /* rotation_weight */,
|
||||||
},
|
},
|
||||||
prev_node, next_node);
|
prev_node, next_node));
|
||||||
|
|
||||||
const std::array<double, 4> prev_node_rotation{{1., 0., 0., 0.}};
|
const std::array<double, 4> prev_node_rotation{{1., 0., 0., 0.}};
|
||||||
const std::array<double, 3> prev_node_translation{{0., 0., 0.}};
|
const std::array<double, 3> prev_node_translation{{0., 0., 0.}};
|
||||||
|
|
Loading…
Reference in New Issue