1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // Created by zx on 23-4-11.
- //
- #include "define/timedlockdata.hpp"
- #include "MPC/navigation_main.h"
- #include "define/TimerRecord.h"
- #include <glog/logging.h>
- #include "tool/pathcreator.h"
- #include "tool/proto_tool.h"
- #include "nav_server.h"
- #include <grpcpp/grpcpp.h>
- int main(int argc,char* argv[])
- {
- if(argc<2)
- {
- printf(" argc must == 2, exe parameter_file\n");
- return -1;
- }
- std::string parameter_file=argv[1];
- NavParameter::Navigation_parameter parameter;
- if(proto_tool::get_instance_pointer()->read_proto_param(parameter_file,parameter)==false)
- {
- printf(" read proto parameter failed:%s\n",parameter_file.c_str());
- return -2;
- }
- // NavParameter::Version nav_version;
- // if(proto_tool::get_instance_pointer()->read_proto_param(parameter_file,nav_version)==false) {
- // return -2;
- // }
- // printf(" version: %s\n",nav_version.version().c_str());
- Navigation* g_navigator= nullptr;
- if(parameter.main_agv()==true)
- g_navigator=new NavigationMain();
- else
- g_navigator=new Navigation();
- if(g_navigator->Init(parameter))
- printf(" navigation inited\n");
- else{
- printf(" navigation init failed\n");
- return -1;
- }
- //启动rpc server
- grpc::ServerBuilder builder;
- NavServer service(g_navigator);
- builder.AddListeningPort(parameter.rpc_ipport(), grpc::InsecureServerCredentials());
- builder.RegisterService(&service);
- std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
- std::cout << "Server Listening on port: " << std::endl;
- server->Wait();
- delete g_navigator;
- return 0;
- }
|