提交 4126a4a2 编写于 作者: K kechxu 提交者: Calvin Miao

add free move predictor unit test

上级 832191f0
......@@ -38,6 +38,9 @@ class RegionalPredictorTest : public ::testing::Test {
"modules/prediction/testdata/multiple_perception_pedestrians.pb.txt";
apollo::common::util::GetProtoFromFile(file, &perception_obstacles_);
FLAGS_map_file = "modules/prediction/testdata/kml_map.bin";
FLAGS_p_var = 0.1;
FLAGS_q_var = 0.01;
FLAGS_r_var = 0.25;
}
protected:
apollo::perception::PerceptionObstacles perception_obstacles_;
......
......@@ -38,12 +38,35 @@ class FreeMovePredictorTest : public ::testing::Test {
"modules/prediction/testdata/single_perception_vehicle_offlane.pb.txt";
apollo::common::util::GetProtoFromFile(file, &perception_obstacles_);
FLAGS_map_file = "modules/prediction/testdata/kml_map.bin";
FLAGS_p_var = 0.1;
FLAGS_q_var = 0.01;
FLAGS_r_var = 0.25;
}
protected:
apollo::perception::PerceptionObstacles perception_obstacles_;
};
TEST_F(FreeMovePredictorTest, General) {
EXPECT_DOUBLE_EQ(perception_obstacles_.header().timestamp_sec(),
1501183430.161906);
apollo::perception::PerceptionObstacle perception_obstacle =
perception_obstacles_.perception_obstacle(0);
EXPECT_EQ(perception_obstacle.id(), 15);
ObstaclesContainer container;
container.Insert(perception_obstacles_);
Obstacle* obstacle_ptr = container.GetObstacle(15);
EXPECT_TRUE(obstacle_ptr != nullptr);
FreeMovePredictor predictor;
predictor.Predict(obstacle_ptr);
const PredictionObstacle& prediction_obstacle =
predictor.prediction_obstacle();
EXPECT_EQ(prediction_obstacle.trajectory_size(), 1);
EXPECT_NEAR(
prediction_obstacle.trajectory(0).trajectory_point(9).path_point().x(),
-432.459, 0.001);
EXPECT_NEAR(
prediction_obstacle.trajectory(0).trajectory_point(9).path_point().y(),
-156.451, 0.001);
}
} // namespace prediction
......
......@@ -4,7 +4,7 @@ header {
sequence_num: 15839
}
perception_obstacle {
id: 1
id: 15
position {
x: -438.614,
y: -173.366,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册