// // Created by zx on 2020/6/18. // #include #include #include "setting.pb.h" #include "lidar_locate/Locate_communicator.h" #include #include #include using google::protobuf::io::FileInputStream; using google::protobuf::io::FileOutputStream; using google::protobuf::io::ZeroCopyInputStream; using google::protobuf::io::CodedInputStream; using google::protobuf::io::ZeroCopyOutputStream; using google::protobuf::io::CodedOutputStream; using google::protobuf::Message; bool read_proto_param(std::string file, ::google::protobuf::Message& parameter) { int fd = open(file.c_str(), O_RDONLY); if (fd == -1) return false; FileInputStream* input = new FileInputStream(fd); bool success = google::protobuf::TextFormat::Parse(input, ¶meter); delete input; close(fd); return success; } int main(int argc,char* argv[]) { //读取配置 /// setting::global_setting parameter; if(false==read_proto_param("",parameter)) { LOG(ERROR)<<"read setting file failed"; return 0; } //创建各个模块的通讯对象 setting::locate_setting locate_parameter=parameter.locate_parameter(); Error_manager code=Locate_communicator::create_locate_communicator(locate_parameter.ip(),locate_parameter.port()); if(code!=SUCCESS) { LOG(ERROR)<locate_request(request,result); if(code!=SUCCESS) { LOG(ERROR)<