18#include "modules/perception/traffic_light_detection/proto/traffic_light_detection_component.pb.h"
27namespace trafficlight {
32 AERROR <<
"TrafficLightDetectComponent InitConfig failed.";
37 AERROR <<
"TrafficLightDetectComponent InitAlgorithmPlugin failed.";
46 auto time_imags = std::to_string(message->timestamp_);
47 AINFO <<
"Enter detection component, message timestamp: " << time_imags;
49 bool status = InternalProc(message);
51 writer_->Write(message);
52 AINFO <<
"Send trafficlight detect output message.";
57int TrafficLightDetectComponent::InitConfig() {
60 AINFO <<
"load trafficlights detection component proto param failed";
65 tl_detector_name_ = plugin_param.name();
66 config_path_ = plugin_param.config_path();
67 config_file_ = plugin_param.config_file();
69 gpu_id_ = traffic_light_param.
gpu_id();
70 AINFO <<
"tl_detector_name: " << tl_detector_name_ <<
" config_path: " << config_path_
71 <<
" config_file: " << config_file_ <<
" gpu_id: " << gpu_id_;
78bool TrafficLightDetectComponent::InitAlgorithmPlugin() {
79 trafficlight::BaseTrafficLightDetector* detector
80 = trafficlight::BaseTrafficLightDetectorRegisterer::GetInstanceByName(tl_detector_name_);
81 CHECK_NOTNULL(detector);
82 detector_.reset(detector);
83 ACHECK(detector_ !=
nullptr);
84 detector_init_options_.
gpu_id = gpu_id_;
88 if (!detector_->Init(detector_init_options_)) {
89 AERROR <<
"Trafficlight detector init failed";
96bool TrafficLightDetectComponent::InternalProc(
const std::shared_ptr<TrafficDetectMessage const>& message) {
98 bool status = detector_->Detect(message->traffic_light_frame_.get());
bool GetProtoConfig(T *config) const
std::shared_ptr< Node > node_
bool Proc(const std::shared_ptr< TrafficDetectMessage > &message) override
Trigger the detection process based on the traffic detect message.
bool Init() override
Initialize configuration files, algorithm plug-ins.
#define PERF_FUNCTION(...)
optional string detection_output_channel_name
optional perception::PluginParam plugin_param