Apollo 11.0
自动驾驶开放平台
bin_map_generator.cc 文件参考
#include "gflags/gflags.h"
#include "modules/common_msgs/map_msgs/map.pb.h"
#include "cyber/common/file.h"
#include "cyber/common/log.h"
#include "modules/map/hdmap/hdmap_util.h"
bin_map_generator.cc 的引用(Include)关系图:

浏览源代码.

函数

 DEFINE_string (output_dir, "/tmp", "output map directory")
 A map tool to transform .txt map to .bin map
 
int main (int argc, char *argv[])
 

函数说明

◆ DEFINE_string()

DEFINE_string ( output_dir  ,
"/tmp"  ,
"output map directory"   
)

A map tool to transform .txt map to .bin map

◆ main()

int main ( int  argc,
char *  argv[] 
)

在文件 bin_map_generator.cc 第 30 行定义.

30 {
31 google::InitGoogleLogging(argv[0]);
32 FLAGS_alsologtostderr = true;
33
34 google::ParseCommandLineFlags(&argc, &argv, true);
35
36 const auto map_filename = FLAGS_map_dir + "/base_map.txt";
37 apollo::hdmap::Map pb_map;
38 if (!apollo::cyber::common::GetProtoFromFile(map_filename, &pb_map)) {
39 AERROR << "Failed to load txt map from " << map_filename;
40 return -1;
41 } else {
42 AINFO << "Loaded txt map from " << map_filename;
43 }
44
45 const std::string output_bin_file = FLAGS_output_dir + "/base_map.bin";
46 if (!apollo::cyber::common::SetProtoToBinaryFile(pb_map, output_bin_file)) {
47 AERROR << "Failed to generate binary base map";
48 return -1;
49 }
50
51 pb_map.Clear();
52 ACHECK(apollo::cyber::common::GetProtoFromFile(output_bin_file, &pb_map))
53 << "Failed to load generated binary base map";
54
55 AINFO << "Successfully converted .txt map to .bin map: " << output_bin_file;
56
57 return 0;
58}
#define ACHECK(cond)
Definition log.h:80
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
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,...
Definition file.cc:132
bool SetProtoToBinaryFile(const google::protobuf::Message &message, const std::string &file_name)
Sets the content of the file specified by the file_name to be the binary representation of the input ...
Definition file.cc:111