Apollo 11.0
自动驾驶开放平台
apollo::perception::fusion::Dst类 参考

#include <dst_evidence.h>

apollo::perception::fusion::Dst 的协作图:

Public 成员函数

 Dst (const std::string &app_name)
 
bool SetBbaVec (const std::vector< double > &bba_vec)
 Set the Bba Vec object
 
bool SetBba (const std::map< uint64_t, double > &bba_map)
 Set the Bba object, strictly require the fod in bba_map is valid
 
void ComputeSptPlsUct () const
 
void ComputeProbability () const
 
const std::vector< double > & GetBbaVec () const
 Get the Bba Vec object
 
const size_t GetBbaSize () const
 Get the Bba Size object
 
double GetSubsetBfmass (uint64_t fod_subset) const
 Get the Subset Bfmass object
 
double GetIndBfmass (size_t ind) const
 Get the Ind Bfmass object
 
const std::vector< double > & GetSupportVec () const
 Get the Support Vec object
 
const std::vector< double > & GetPlausibilityVec () const
 Get the Plausibility Vec object
 
const std::vector< double > & GetUncertaintyVec () const
 Get the Uncertainty Vec object
 
const std::vector< double > & GetProbabilityVec () const
 Get the Probability Vec object
 
std::string PrintBba () const
 
std::string Name () const
 

友元

Dst operator+ (const Dst &lhs, const Dst &rhs)
 
Dst operator* (const Dst &dst_evidence, double w)
 

详细描述

在文件 dst_evidence.h 第 151 行定义.

构造及析构函数说明

◆ Dst()

apollo::perception::fusion::Dst::Dst ( const std::string &  app_name)
explicit

在文件 dst_evidence.cc 第 195 行定义.

195 : app_name_(app_name) {
196 if (DstManager::Instance()->IsAppAdded(app_name)) {
197 dst_data_ptr_ = DstManager::Instance()->GetAppDataPtr(app_name);
198 // default BBA provide no more evidence
199 bba_vec_.resize(dst_data_ptr_->fod_subsets_.size(), 0.0);
200 bba_vec_[dst_data_ptr_->fod_loc_] = 1.0;
201 }
202}
DstCommonDataPtr GetAppDataPtr(const std::string &app_name)
Get the app data ptr object

成员函数说明

◆ ComputeProbability()

void apollo::perception::fusion::Dst::ComputeProbability ( ) const

在文件 dst_evidence.cc 第 338 行定义.

338 {
339 SelfCheck();
340 probability_vec_.clear();
341 probability_vec_.resize(bba_vec_.size(), 0.0);
342 const auto &combination_relations = dst_data_ptr_->combination_relations_;
343 const std::vector<size_t> &fod_subset_cardinalities =
344 dst_data_ptr_->fod_subset_cardinalities_;
345 for (size_t i = 0; i < combination_relations.size(); ++i) {
346 const auto &combination_pairs = combination_relations[i];
347 double intersection_card = static_cast<double>(fod_subset_cardinalities[i]);
348 for (auto combination_pair : combination_pairs) {
349 size_t a_ind = combination_pair.first;
350 size_t b_ind = combination_pair.second;
351 probability_vec_[a_ind] +=
352 intersection_card /
353 static_cast<double>(fod_subset_cardinalities[b_ind]) *
354 bba_vec_[b_ind];
355 }
356 }
357}
std::vector< size_t > fod_subset_cardinalities_
std::vector< std::vector< std::pair< size_t, size_t > > > combination_relations_

◆ ComputeSptPlsUct()

void apollo::perception::fusion::Dst::ComputeSptPlsUct ( ) const

在文件 dst_evidence.cc 第 305 行定义.

305 {
306 SelfCheck();
307 auto resize_space = [](std::vector<double> &vec, size_t size) {
308 vec.clear();
309 vec.resize(size, 0.0);
310 };
311 size_t size = bba_vec_.size();
312 resize_space(support_vec_, size);
313 resize_space(plausibility_vec_, size);
314 resize_space(uncertainty_vec_, size);
315 const std::vector<std::vector<size_t>> &subset_relations =
316 dst_data_ptr_->subset_relations_;
317 const std::vector<std::vector<size_t>> &inter_relations =
318 dst_data_ptr_->inter_relations_;
319 for (size_t i = 0; i < size; ++i) {
320 double &spt = support_vec_[i];
321 double &pls = plausibility_vec_[i];
322 double &uct = uncertainty_vec_[i];
323 const auto &subset_inds = subset_relations[i];
324 const auto &inter_inds = inter_relations[i];
325 // AINFO << boost::format("inter_size: (%d %d)") % i % inter_inds.size();
326 for (auto subset_ind : subset_inds) {
327 spt += bba_vec_[subset_ind];
328 }
329 for (auto inter_ind : inter_inds) {
330 pls += bba_vec_[inter_ind];
331 }
332 // AINFO << boost::format("pls: (%d %lf)") % i % pls;
333 uct = pls - spt;
334 }
335}
std::vector< std::vector< size_t > > subset_relations_
std::vector< std::vector< size_t > > inter_relations_

◆ GetBbaSize()

const size_t apollo::perception::fusion::Dst::GetBbaSize ( ) const
inline

Get the Bba Size object

返回
const size_t

在文件 dst_evidence.h 第 197 行定义.

197{ return bba_vec_.size(); }

◆ GetBbaVec()

const std::vector< double > & apollo::perception::fusion::Dst::GetBbaVec ( ) const
inline

Get the Bba Vec object

返回
const std::vector<double>&

在文件 dst_evidence.h 第 190 行定义.

190{ return bba_vec_; }

◆ GetIndBfmass()

double apollo::perception::fusion::Dst::GetIndBfmass ( size_t  ind) const

Get the Ind Bfmass object

参数
ind
返回
double

在文件 dst_evidence.cc 第 220 行定义.

220 {
221 SelfCheck();
222 return bba_vec_[ind];
223}

◆ GetPlausibilityVec()

const std::vector< double > & apollo::perception::fusion::Dst::GetPlausibilityVec ( ) const
inline

Get the Plausibility Vec object

返回
const std::vector<double>&

在文件 dst_evidence.h 第 227 行定义.

227 {
228 return plausibility_vec_;
229 }

◆ GetProbabilityVec()

const std::vector< double > & apollo::perception::fusion::Dst::GetProbabilityVec ( ) const
inline

Get the Probability Vec object

返回
const std::vector<double>&

在文件 dst_evidence.h 第 245 行定义.

245 {
246 return probability_vec_;
247 }

◆ GetSubsetBfmass()

double apollo::perception::fusion::Dst::GetSubsetBfmass ( uint64_t  fod_subset) const

Get the Subset Bfmass object

参数
fod_subset
返回
double

在文件 dst_evidence.cc 第 214 行定义.

214 {
215 SelfCheck();
216 size_t idx = DstManager::Instance()->FodSubsetToInd(app_name_, fod_subset);
217 return bba_vec_[idx];
218}
size_t FodSubsetToInd(const std::string &app_name, const uint64_t &fod_subset)

◆ GetSupportVec()

const std::vector< double > & apollo::perception::fusion::Dst::GetSupportVec ( ) const
inline

Get the Support Vec object

返回
const std::vector<double>&

在文件 dst_evidence.h 第 220 行定义.

220{ return support_vec_; }

◆ GetUncertaintyVec()

const std::vector< double > & apollo::perception::fusion::Dst::GetUncertaintyVec ( ) const
inline

Get the Uncertainty Vec object

返回
const std::vector<double>&

在文件 dst_evidence.h 第 236 行定义.

236 {
237 return uncertainty_vec_;
238 }

◆ Name()

std::string apollo::perception::fusion::Dst::Name ( ) const
inline
返回
std::string

在文件 dst_evidence.h 第 279 行定义.

279{ return app_name_; }

◆ PrintBba()

std::string apollo::perception::fusion::Dst::PrintBba ( ) const
返回
std::string

在文件 dst_evidence.cc 第 272 行定义.

272 {
273 SelfCheck();
274 static constexpr size_t total_res_size = 10000;
275 static constexpr size_t row_res_size = 1000;
276 static auto print_row = [](const std::string &row_header,
277 const std::vector<double> &data) {
278 std::string row_str = (boost::format("%19s ") % row_header).str();
279 row_str.reserve(row_res_size);
280 for (auto flt : data) {
281 row_str += (boost::format("%20.6lf") % (flt * 100)).str();
282 }
283 row_str += "\n";
284 return row_str;
285 };
286 std::string res;
287 res.reserve(total_res_size);
288 res += "\n";
289 // output table header
290 std::string header = (boost::format("%20s") % " ").str();
291 header.reserve(row_res_size);
292 const std::vector<std::string> &fod_subset_names =
293 dst_data_ptr_->fod_subset_names_;
294 for (const auto &fod_subset_name : fod_subset_names) {
295 header += (boost::format("%20s") % fod_subset_name).str();
296 }
297 res += header + "\n";
298 res += print_row("belief_mass", bba_vec_);
299 // res += print_row("support", support_vec_);
300 // res += print_row("uncertainty", uncertainty_vec_);
301 // res += print_row("probability", probability_vec_);
302 return res;
303}
std::vector< std::string > fod_subset_names_

◆ SetBba()

bool apollo::perception::fusion::Dst::SetBba ( const std::map< uint64_t, double > &  bba_map)

Set the Bba object, strictly require the fod in bba_map is valid

参数
bba_map
返回
true
false

在文件 dst_evidence.cc 第 246 行定义.

246 {
247 SelfCheck();
248 std::vector<double> bba_vec(dst_data_ptr_->fod_subsets_.size(), 0.0);
249 const auto &subsets_ind_map = dst_data_ptr_->subsets_ind_map_;
250 for (auto bba_map_iter : bba_map) {
251 uint64_t fod_subset = bba_map_iter.first;
252 double belief_mass = bba_map_iter.second;
253 auto find_res = subsets_ind_map.find(fod_subset);
254 if (find_res == subsets_ind_map.end()) {
255 AERROR << "the input bba map has invalid fod subset";
256 return false;
257 }
258 if (belief_mass < 0.0) {
259 AWARN << boost::format("belief mass: %lf is not valid. Dst name: %s") %
260 belief_mass % app_name_;
261 return false;
262 }
263 bba_vec[find_res->second] = belief_mass;
264 }
265 // reset
266 // *this = Dst(app_name_);
267 bba_vec_ = bba_vec;
268 Normalize();
269 return true;
270}
#define AERROR
Definition log.h:44
#define AWARN
Definition log.h:43
std::map< uint64_t, size_t > subsets_ind_map_

◆ SetBbaVec()

bool apollo::perception::fusion::Dst::SetBbaVec ( const std::vector< double > &  bba_vec)

Set the Bba Vec object

参数
bba_vec
返回
true
false

在文件 dst_evidence.cc 第 225 行定义.

225 {
226 SelfCheck();
227 if (bba_vec.size() != dst_data_ptr_->fod_subsets_.size()) {
228 AERROR << boost::format("input bba_vec size: %d != Dst subsets size: %d") %
229 bba_vec.size() % dst_data_ptr_->fod_subsets_.size();
230 return false;
231 }
232 // check belief mass valid
233 for (auto belief_mass : bba_vec) {
234 if (belief_mass < 0.0) {
235 AWARN << boost::format(" belief mass: %lf is not valid") % belief_mass;
236 return false;
237 }
238 }
239 // reset
240 // *this = Dst(app_name_);
241 bba_vec_ = bba_vec;
242 Normalize();
243 return true;
244}

友元及相关函数文档

◆ operator*

Dst operator* ( const Dst &  dst_evidence,
double  w 
)
friend
参数
dst_evidence
w
返回
Dst

在文件 dst_evidence.cc 第 396 行定义.

396 {
397 dst.SelfCheck();
398 Dst res(dst.app_name_);
399 // check w
400 if (w < 0.0 || w > 1.0) {
401 AERROR << boost::format(
402 "the weight of bba %lf is not valid, return default bba") %
403 w;
404 return res;
405 }
406 size_t fod_loc = dst.dst_data_ptr_->fod_loc_;
407 std::vector<double> &resbba_vec_ = res.bba_vec_;
408 const std::vector<double> &bba_vec = dst.bba_vec_;
409 for (size_t i = 0; i < resbba_vec_.size(); ++i) {
410 if (i == fod_loc) {
411 resbba_vec_[i] = 1.0 - w + w * bba_vec[i];
412 } else {
413 resbba_vec_[i] = w * bba_vec[i];
414 }
415 }
416 return res;
417}
Dst(const std::string &app_name)

◆ operator+

Dst operator+ ( const Dst &  lhs,
const Dst &  rhs 
)
friend
参数
lhs
rhs
返回
Dst

在文件 dst_evidence.cc 第 370 行定义.

370 {
371 CHECK_EQ(lhs.app_name_, rhs.app_name_)
372 << boost::format("lhs Dst(%s) is not equal to rhs Dst(%s)") %
373 lhs.app_name_ % rhs.app_name_;
374 lhs.SelfCheck();
375 rhs.SelfCheck();
376 Dst res(lhs.app_name_);
377 std::vector<double> &resbba_vec_ = res.bba_vec_;
378 const auto &combination_relations = lhs.dst_data_ptr_->combination_relations_;
379 for (size_t i = 0; i < resbba_vec_.size(); ++i) {
380 const auto &combination_pairs = combination_relations[i];
381 // AINFO << "pairs size: " << combination_pairs.size();
382 double &belief_mass = resbba_vec_[i];
383 belief_mass = 0.0;
384 for (auto combination_pair : combination_pairs) {
385 // AINFO << boost::format("(%d %d)") % combination_pair.first
386 // % combination_pair.second;
387 belief_mass += lhs.GetIndBfmass(combination_pair.first) *
388 rhs.GetIndBfmass(combination_pair.second);
389 }
390 // AINFO << boost::format("belief_mass: %lf") % belief_mass;
391 }
392 res.Normalize();
393 return res;
394}

该类的文档由以下文件生成: