Apollo
6.0
Open source self driving car software
|
The data structure of the base map. More...
#include <base_map.h>
Public Member Functions | |
BaseMap (BaseMapConfig *map_config) | |
The constructor. More... | |
virtual | ~BaseMap () |
The destructor. More... | |
virtual void | InitMapNodeCaches (int cacheL1_size, int cahceL2_size) |
Init load threadpool and preload threadpool. More... | |
BaseMapNode * | GetMapNode (const MapNodeIndex &index) |
Get the map node, if it's not in the cache, return false. More... | |
BaseMapNode * | GetMapNodeSafe (const MapNodeIndex &index) |
Return the map node, if it's not in the cache, safely load it. More... | |
bool | IsMapNodeExist (const MapNodeIndex &index) const |
Check if the map node in the cache. More... | |
bool | SetMapFolderPath (const std::string folder_path) |
Set the directory of the map. More... | |
void | AddDataset (const std::string dataset_path) |
Add a dataset path to the map config. More... | |
virtual void | PreloadMapArea (const Eigen::Vector3d &location, const Eigen::Vector3d &trans_diff, unsigned int resolution_id, unsigned int zone_id) |
Preload map nodes for the next frame location calculation. It will forecasts the nodes by the direction of the car moving. Because the progress of loading will cost a long time (over 100ms), it must do this for a period of time in advance. After the index of nodes calculate finished, it will create loading tasks, but will not wait for the loading finished, eigen version. More... | |
virtual bool | LoadMapArea (const Eigen::Vector3d &seed_pt3d, unsigned int resolution_id, unsigned int zone_id, int filter_size_x, int filter_size_y) |
Load map nodes for the location calculate of this frame. If the forecasts are correct in last frame, these nodes will be all in cache, if not, then need to create loading tasks, and wait for the loading finish, in order to the nodes which the following calculate needed are all in the memory, eigen version. More... | |
void | AttachMapNodePool (BaseMapNodePool *p_map_node_pool) |
Attach map node pointer. More... | |
void | WriteBinary (FILE *file) |
Write all the map nodes to a single binary file stream. It's for binary streaming or packing. More... | |
void | LoadBinary (FILE *file, std::string map_folder_path="") |
Load all the map nodes from a single binary file stream. It's for binary streaming or packing. More... | |
const BaseMapConfig & | GetConfig () const |
Get the map config. More... | |
BaseMapConfig & | GetConfig () |
Get the map config. More... | |
Protected Member Functions | |
void | LoadMapNodes (std::set< MapNodeIndex > *map_ids) |
Load map node by index. More... | |
void | PreloadMapNodes (std::set< MapNodeIndex > *map_ids) |
Load map node by index. More... | |
void | LoadMapNodeThreadSafety (MapNodeIndex index, bool is_reserved=false) |
Load map node by index, thread_safety. More... | |
Protected Attributes | |
BaseMapConfig * | map_config_ |
The map settings. More... | |
std::list< MapNodeIndex > | map_nodes_disk_ |
All the map nodes in the Map (in the disk). More... | |
MapNodeCache< MapNodeIndex, BaseMapNode >::DestroyFunc | destroy_func_lvl1_ |
MapNodeCache< MapNodeIndex, BaseMapNode >::DestroyFunc | destroy_func_lvl2_ |
MapNodeCache< MapNodeIndex, BaseMapNode > * | map_node_cache_lvl1_ |
The cache for map node preload. More... | |
MapNodeCache< MapNodeIndex, BaseMapNode > * | map_node_cache_lvl2_ |
BaseMapNodePool * | map_node_pool_ |
The map node memory pool pointer. More... | |
std::set< MapNodeIndex > | map_preloading_task_index_ |
boost::recursive_mutex | map_load_mutex_ |
The mutex for preload map node. More... | |
The data structure of the base map.
|
explicit |
The constructor.
|
virtual |
The destructor.
void apollo::localization::msf::BaseMap::AddDataset | ( | const std::string | dataset_path | ) |
Add a dataset path to the map config.
void apollo::localization::msf::BaseMap::AttachMapNodePool | ( | BaseMapNodePool * | p_map_node_pool | ) |
Attach map node pointer.
|
inline |
Get the map config.
|
inline |
Get the map config.
BaseMapNode* apollo::localization::msf::BaseMap::GetMapNode | ( | const MapNodeIndex & | index | ) |
Get the map node, if it's not in the cache, return false.
BaseMapNode* apollo::localization::msf::BaseMap::GetMapNodeSafe | ( | const MapNodeIndex & | index | ) |
Return the map node, if it's not in the cache, safely load it.
|
virtual |
Init load threadpool and preload threadpool.
bool apollo::localization::msf::BaseMap::IsMapNodeExist | ( | const MapNodeIndex & | index | ) | const |
Check if the map node in the cache.
void apollo::localization::msf::BaseMap::LoadBinary | ( | FILE * | file, |
std::string | map_folder_path = "" |
||
) |
Load all the map nodes from a single binary file stream. It's for binary streaming or packing.
<map_folder_path> | The new map folder path to save the map. |
<return> | The size read (the real size of body). |
|
virtual |
Load map nodes for the location calculate of this frame. If the forecasts are correct in last frame, these nodes will be all in cache, if not, then need to create loading tasks, and wait for the loading finish, in order to the nodes which the following calculate needed are all in the memory, eigen version.
Reimplemented in apollo::localization::msf::LosslessMap, apollo::localization::msf::NdtMap, and apollo::localization::msf::LossyMap2D.
|
protected |
Load map node by index.
|
protected |
Load map node by index, thread_safety.
|
virtual |
Preload map nodes for the next frame location calculation. It will forecasts the nodes by the direction of the car moving. Because the progress of loading will cost a long time (over 100ms), it must do this for a period of time in advance. After the index of nodes calculate finished, it will create loading tasks, but will not wait for the loading finished, eigen version.
Reimplemented in apollo::localization::msf::LosslessMap, apollo::localization::msf::NdtMap, and apollo::localization::msf::LossyMap2D.
|
protected |
Load map node by index.
bool apollo::localization::msf::BaseMap::SetMapFolderPath | ( | const std::string | folder_path | ) |
Set the directory of the map.
void apollo::localization::msf::BaseMap::WriteBinary | ( | FILE * | file | ) |
Write all the map nodes to a single binary file stream. It's for binary streaming or packing.
<buf,buf_size> | The buffer and its size. |
<return> | The required or the used size of is returned. |
|
protected |
|
protected |
|
protected |
The map settings.
|
protected |
The mutex for preload map node.
|
protected |
The cache for map node preload.
|
protected |
brief The dynamic map node preloading thread pool pointer.
|
protected |
The map node memory pool pointer.
|
protected |
All the map nodes in the Map (in the disk).
|
protected |
Keep the index of preloading nodes.