123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // 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;
- }
- 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");
- 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;
- }
|