-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcostMap.h
168 lines (141 loc) · 4.82 KB
/
costMap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#pragma once
#include <iostream>
#include <opencv2/opencv.hpp>
#include"costMapType.h"
class multiObjectTracker
{
public:
multiObjectTracker(float costConfirm):m_costThreshold(costConfirm){ };
~multiObjectTracker() {};
std::vector<ParkSpace> update(std::vector<ParkSpace> newDetections);
public:
std::vector<objectTrack> m_trackers;
float m_costThreshold ;
cv::Mat m_costMatrix;
};
class CostMap
{
public:
/*构造函数*/
CostMap();
/*析构函数*/
~CostMap();
/**
* @brief CostMap构建函数
* @details This is the detail description.
* @param[in] parkingSpaces,世界车位坐标.
* @param [in] resolution分辨率,单位:m / pixel.
* @param[out] outArgName output argument description.
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/02创建
*/
CostMap(std::vector<ParkSpace>& parkingSpaces,float resolution=1);
/**
* @brief 返回全局occupancy矩阵
* @details This is the detail description.
* @param[in] None.
* @param[out] occupancyMatrix返回occupancy像素矩阵.
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/02创建
*/
void getOccupancyMatrix(cv::Mat &occupancyMatrix) const;
/**
* @brief 返回全局occupancy矩阵
* @details This is the detail description.
* @param[in] vecPts全局egoVehicle航点坐标
* @param[out] occupancyMatrix返回全局occupancy像素矩阵.
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/20创建
*/
void CostMap::getOccupancyMatrixFromTrajectory(std::vector<cv::Point2f> vecPts, cv::Mat& occupancyMatrix) const;
/**
* @brief 返回局部occupancy矩阵
* @details This is the detail description.
* @param[in] newDetections输入当前感知的局部车位.
* @param[out] occupancyMatrix返回局部occupancy像素矩阵.
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/20创建
*/
void CostMap::getLocalOccupancyMatrix(std::vector<ParkSpace> newDetections, cv::Mat& occupancyMatrix) const;
/**
* @brief 返回局部occupancy矩阵
* @details This is the detail description.
* @param[in] newDetections输入当前感知的局部车位.
* @param[in] vecWorldTrajPts输入当前egoVehicle的航点坐标.
* @param[out] occupancyMatrix返回局部occupancy像素矩阵.
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/20创建
*/
void CostMap::getLocalOccupancyMatrixFromTrajectory(std::vector<ParkSpace> newDetections, std::vector<cv::Point2f> vecWorldTrajPts, cv::Mat& occupancyMatrix) const;
void CostMap::getAllWorldParkSpace(std::vector<ParkSpace>& sps) const;
void CostMap::getLocalOriginInWorld(double localOriginInWorld[2]) const;
void CostMap::grid2world(int ij[2], double xy[2]) const;
void CostMap::world2grid(double xy[2], int ij[2]) const;
/**
* @brief 保存全局costmap地图
* @details This is the detail description.
* @param[in] filepath:保存文件名,目前必须为json文件
* @param[in] vecOdo:ego vehicle建图走的路径,[x,y],单位:米
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/20创建
*/
void saveCostMap(const char* filepath="./costMapFile.json", std::vector<cv::Point2f>& vecOdo= std::vector<cv::Point2f>());
/**
* @brief 加载全局costmap地图
* @details This is the detail description.
* @param[in] filepath:指定地图文件加载costmap地图
* @param[out] vecOdo:ego vehicle建图走的路径,[x,y],单位:米
* @return 返回值
* @retval 返回值类型
* @par 标识符
* 保留
* @par 其它
*
* @par 修改日志
* cuixingxing于2024/02/20创建
*/
void loadCostMap(const char* filepath="./costMapFile.json", std::vector<cv::Point2f>& vecOdo = std::vector<cv::Point2f>());
private:
float m_resolution; //分辨率,单位:m / pixel.
float m_worldXRange[2];
float m_worldYRange[2];
int m_widthPixels;
int m_heightPixels;
std::vector<ParkSpace> m_parkSpace;
};