54 {
55 lib::MutexLock lock(&mutex_);
56 if (inited_) {
57 return true;
58 }
59
60 nr_dim_per_tmplt_ = 3;
61
63 ObjectTemplateMeta proto;
65 AERROR <<
"Read config failed: " << config_file;
66 return false;
67 }
68
69 ACHECK(proto.has_max_dim_change_ratio());
70
71 ACHECK(proto.has_unknown());
72 ACHECK(proto.has_unknown_movable());
73 ACHECK(proto.has_unknown_unmovable());
78 ACHECK(proto.has_cyclist());
79 ACHECK(proto.has_motorcyclist());
80 ACHECK(proto.has_tricyclist());
81 ACHECK(proto.has_pedestrian());
82 ACHECK(proto.has_trafficcone());
83
84 CHECK_LE(proto.car().dim_size(), 3);
85 CHECK_LE(proto.van().dim_size(), 3);
86 CHECK_LE(proto.truck().dim_size(), 3);
87 CHECK_LE(proto.bus().dim_size(), 3);
88 CHECK_LE(proto.cyclist().dim_size(), 3);
89 CHECK_LE(proto.motorcyclist().dim_size(), 3);
90 CHECK_LE(proto.tricyclist().dim_size(), 3);
91 CHECK_LE(proto.pedestrian().dim_size(), 3);
92 CHECK_LE(proto.trafficcone().dim_size(), 3);
93
94 ACHECK(proto.unknown().has_speed_limit());
95 ACHECK(proto.unknown_movable().has_speed_limit());
96 ACHECK(proto.unknown_unmovable().has_speed_limit());
97 ACHECK(proto.car().has_speed_limit());
98 ACHECK(proto.van().has_speed_limit());
99 ACHECK(proto.truck().has_speed_limit());
100 ACHECK(proto.bus().has_speed_limit());
101 ACHECK(proto.cyclist().has_speed_limit());
102 ACHECK(proto.motorcyclist().has_speed_limit());
103 ACHECK(proto.tricyclist().has_speed_limit());
104 ACHECK(proto.pedestrian().has_speed_limit());
105 ACHECK(proto.trafficcone().has_speed_limit());
106
107 max_dim_change_ratio_ = proto.max_dim_change_ratio();
108
109 total_nr_tmplts_veh_ = proto.car().dim_size() + proto.van().dim_size() +
110 proto.truck().dim_size() + proto.bus().dim_size();
111
112 look_up_table_min_volume_index_.clear();
113 veh_hwl_.resize(0);
115 static_cast<int>(veh_hwl_.size());
116 LoadVehTemplates(proto.car());
118 static_cast<int>(veh_hwl_.size());
119 LoadVehTemplates(proto.van());
121 static_cast<int>(veh_hwl_.size());
122 LoadVehTemplates(proto.truck());
124 static_cast<int>(veh_hwl_.size());
125 LoadVehTemplates(proto.bus());
126
127 min_template_hwl_.clear();
128 mid_template_hwl_.clear();
129 max_template_hwl_.clear();
136 proto.motorcyclist());
138 proto.tricyclist());
140 proto.pedestrian());
142 proto.trafficcone());
143
144 template_hwl_.resize(0);
145 template_hwl_.push_back(min_template_hwl_);
146 template_hwl_.push_back(mid_template_hwl_);
147 template_hwl_.push_back(max_template_hwl_);
148
149 type_speed_limit_.clear();
151 proto.unknown().speed_limit();
153 proto.unknown_movable().speed_limit();
155 proto.unknown_unmovable().speed_limit();
161 proto.cyclist().speed_limit();
163 proto.motorcyclist().speed_limit();
165 proto.tricyclist().speed_limit();
167 proto.pedestrian().speed_limit();
169 proto.trafficcone().speed_limit();
170
174
175 inited_ = true;
176 AINFO <<
"Init object_template_manager success.";
177 return true;
178}
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
std::vector< base::ObjectSubType > kTypeRefinedByTemplate
std::vector< base::ObjectSubType > kTypeCanBeRef
std::vector< base::ObjectSubType > kTypeRefinedByRef
std::string GetCommonConfigFile(const std::string &config_file)
Get the perception common config path