提交 eae167e7 编写于 作者: X xiaohuitu 提交者: Jiangtao Hu

perception: remove dummy fusion

上级 7fa80055
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "perception_obstacle_fusion_dummy",
srcs = [
"dummy_algorithms.cc",
],
hdrs = [
"dummy_algorithms.h",
],
deps = [
"//modules/common:log",
"//modules/perception/obstacle/common:perception_obstacle_common",
"//modules/perception/obstacle/fusion/interface:perception_obstacle_fusion_interface",
"@eigen//:eigen",
"@pcl//:pcl",
],
)
cpplint()
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/perception/obstacle/fusion/dummy/dummy_algorithms.h"
namespace apollo {
namespace perception {
bool DummyFusion::Fuse(const std::vector<SensorObjects> &multi_sensor_objects,
std::vector<ObjectPtr> *fused_objects) {
return result_detect_;
}
} // namespace perception
} // namespace apollo
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PERCEPTION_OBSTACLE_FUSION_DUMMY_DUMMY_ALGORITHMS_H_
#define MODULES_PERCEPTION_OBSTACLE_FUSION_DUMMY_DUMMY_ALGORITHMS_H_
#include <string>
#include <vector>
#include "modules/perception/obstacle/fusion/interface/base_fusion.h"
namespace apollo {
namespace perception {
class DummyFusion : public BaseFusion {
public:
DummyFusion() : BaseFusion() {}
~DummyFusion() = default;
bool Init() override {
return result_init_;
}
bool Fuse(const std::vector<SensorObjects> &multi_sensor_objects,
std::vector<ObjectPtr> *fused_objects) override;
std::string name() const override {
return "DummyFusion";
}
private:
// for unit test
bool result_init_ = true;
bool result_detect_ = true;
DISALLOW_COPY_AND_ASSIGN(DummyFusion);
};
REGISTER_FUSION(DummyFusion);
} // namespace perception
} // namespace apollo
#endif // MODULES_PERCEPTION_OBSTACLE_FUSION_DUMMY_DUMMY_ALGORITHMS_H_
......@@ -68,6 +68,20 @@ void NormalizeRow(Matrixd* prob) {
}
}
void PrintProbability(const std::vector<float>& prob, const std::string& name) {
std::cout << name << ": ";
float max_prob = -DBL_MAX;
std::size_t max_id = 0;
for (std::size_t i = 0; i < prob.size(); ++i) {
std::cout << std::setprecision(3) << prob[i] << " ";
if (prob[i] > max_prob) {
max_prob = prob[i];
max_id = i;
}
}
std::cout << " max_type: " << max_id << std::endl;
}
bool LoadSingleMatrix(std::ifstream& fin, Matrixd* matrix) {
for (std::size_t row = 0; row < VALID_OBJECT_TYPE; ++row) {
for (std::size_t col = 0; col < VALID_OBJECT_TYPE; ++col) {
......
......@@ -77,6 +77,13 @@ void Normalize(Vectord* prob);
*/
void NormalizeRow(Matrixd* prob);
/**
* @brief Print probability
* @param prob Probability to be printed
* @param name Name of probability to be printed
*/
void PrintProbability(const std::vector<float>& prob, const std::string& name);
/**
* @brief Load a matrix from input file stream
* @param fin The input file stream
......
......@@ -44,7 +44,6 @@ cc_library(
"//modules/perception/obstacle/lidar/type_fuser/sequence_type_fuser:perception_obstacle_lidar_type_fuser_sequence_type_fuser",
"//modules/perception/obstacle/lidar/visualizer/opengl_visualizer:perception_obstacle_lidar_opengl_visualizer",
"//modules/perception/obstacle/radar/dummy:perception_obstacle_radar_dummy",
"//modules/perception/obstacle/fusion/dummy:perception_obstacle_fusion_dummy",
"@eigen//:eigen",
"@gtest//:gtest",
"@ros//:ros_common",
......
......@@ -23,7 +23,6 @@
#include "modules/perception/lib/base/timer.h"
#include "modules/perception/obstacle/radar/dummy/dummy_algorithms.h"
#include "modules/perception/obstacle/radar/modest/modest_radar_detector.h"
#include "modules/perception/obstacle/fusion/dummy/dummy_algorithms.h"
#include "modules/perception/obstacle/fusion/probabilistic_fusion/probabilistic_fusion.h"
DEFINE_string(obstacle_show_type, "fused",
......@@ -105,7 +104,6 @@ bool ObstaclePerception::Init() {
void ObstaclePerception::RegistAllAlgorithm() {
RegisterFactoryDummyRadarDetector();
RegisterFactoryDummyFusion();
RegisterFactoryModestRadarDetector();
RegisterFactoryProbabilisticFusion();
......
......@@ -22,7 +22,7 @@
# the fusion method for onboard
# type: string
# candidate: DummyFusion, ProbabilisticFusion
# candidate: only ProbabilisticFusion
--onboard_fusion=ProbabilisticFusion
# enable visualization
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册