Apollo  6.0
Open source self driving car software
util.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <fstream>
19 #include <functional>
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include "Eigen/Dense"
25 
28 
29 namespace apollo {
30 namespace perception {
31 namespace lidar {
32 
33 enum {
35 };
36 
37 typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, 1> Vectord;
38 typedef Eigen::Matrix<int, VALID_OBJECT_TYPE, 1> Vectori;
39 typedef Eigen::Matrix<double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE> Matrixd;
40 
41 namespace util {
42 
43 void FromStdToVector(const std::vector<float>& src_prob, Vectord* dst_prob);
44 
45 void FromEigenToVector(const Vectord& src_prob, std::vector<float>* dst_prob);
46 
47 void ToLog(Vectord* prob);
48 
49 void ToExp(Vectord* prob);
50 
51 void ToExpStable(Vectord* prob);
52 
53 void Normalize(Vectord* prob);
54 
55 void NormalizeRow(Matrixd* prob);
56 
57 bool LoadSingleMatrix(std::ifstream& fin, Matrixd* matrix);
58 
59 bool LoadSingleMatrixFile(const std::string& filename, Matrixd* matrix);
60 
62  const std::string& filename,
64 
65 } // namespace util
66 } // namespace lidar
67 } // namespace perception
68 } // namespace apollo
Eigen::Matrix< int, VALID_OBJECT_TYPE, 1 > Vectori
Definition: util.h:38
void FromStdToVector(const std::vector< float > &src_prob, Vectord *dst_prob)
Eigen::Matrix< double, VALID_OBJECT_TYPE, 1 > Vectord
Definition: util.h:37
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::map< T, EigenType, std::less< T >, Eigen::aligned_allocator< std::pair< const T, EigenType > >> EigenMap
Definition: eigen_defs.h:36
bool LoadSingleMatrixFile(const std::string &filename, Matrixd *matrix)
Eigen::Matrix< double, VALID_OBJECT_TYPE, VALID_OBJECT_TYPE > Matrixd
Definition: util.h:39
void ToExpStable(Vectord *prob)
void FromEigenToVector(const Vectord &src_prob, std::vector< float > *dst_prob)
void NormalizeRow(Matrixd *prob)
bool LoadMultipleMatricesFile(const std::string &filename, apollo::common::EigenMap< std::string, Matrixd > *matrices)
bool LoadSingleMatrix(std::ifstream &fin, Matrixd *matrix)
void Normalize(Vectord *prob)