38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
//
|
|
// Created by xtkuang on 2025/5/6.
|
|
//
|
|
|
|
#include <unistd.h>
|
|
#include <limits.h>
|
|
#include <libgen.h>
|
|
#include <iostream>
|
|
#include <glog/logging.h>
|
|
#include "service/grpc/include/server_runner.h"
|
|
#include "utils/base/include/logger.h"
|
|
#include "common/utils/config_helper/include/config_helper.h"
|
|
using namespace cmvr::service;
|
|
int main(int argc, char* argv[]) {
|
|
std::string config_path;
|
|
if(argc == 1) {
|
|
char exe_path[PATH_MAX] = {0};
|
|
ssize_t count = readlink("/proc/self/exe", exe_path, PATH_MAX);
|
|
if (count == -1) {
|
|
std::cerr << "Failed to read /proc/self/exe" << std::endl;
|
|
return 1;
|
|
}
|
|
std::string exe_dir = dirname(exe_path);
|
|
config_path = exe_dir + "/config/cabin_robot.xml";
|
|
std::cout << "Using default config path: " << config_path << std::endl;
|
|
}
|
|
else if (argc == 2){
|
|
config_path = argv[1];
|
|
}
|
|
|
|
ServerRunner runner;
|
|
const XmlNode config(config_path);
|
|
runner.start(config);
|
|
runner.join();
|
|
google::ShutdownGoogleLogging();
|
|
return 0;
|
|
}
|