|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
|
|
#include "config/log_config.h"
|
|
|
|
#include "config/database_config.h"
|
|
|
|
#include "config/kafka_config.h"
|
|
|
|
#include "handler/log_handler.h"
|
|
|
|
#include "handler/database_handler.h"
|
|
|
|
#include "handler/kafka_handler.h"
|
|
|
|
#include "handler/controller_handler.h"
|
|
|
|
|
|
|
|
void loadConfig(const QString& filename){
|
|
|
|
QFile file(filename);
|
|
|
|
if(!file.exists()){
|
|
|
|
qFatal("config file %s is not found!" , qPrintable(filename));
|
|
|
|
}
|
|
|
|
auto configs = new QSettings(filename, QSettings::IniFormat);
|
|
|
|
|
|
|
|
auto logConf = LogConfig::getIns();
|
|
|
|
configs->beginGroup("log");
|
|
|
|
logConf->load(configs);
|
|
|
|
configs->endGroup();
|
|
|
|
|
|
|
|
auto kafkaConf = KafkaConfig::getIns();
|
|
|
|
configs->beginGroup("kafka");
|
|
|
|
kafkaConf->load(configs);
|
|
|
|
configs->endGroup();
|
|
|
|
|
|
|
|
auto databaseConf = DatabaseConfig::getIns();
|
|
|
|
configs->beginGroup("database");
|
|
|
|
databaseConf->load(configs);
|
|
|
|
configs->endGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void init(){
|
|
|
|
// 初始化日志, 开启会记录日志到文件
|
|
|
|
// LogHandler::init();
|
|
|
|
// 初始化数据库
|
|
|
|
// DataBaseHandler::init();
|
|
|
|
// 初始化Kafka
|
|
|
|
KafkaHandler::init();
|
|
|
|
// 初始化Controller
|
|
|
|
ControllerHandler::init();
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "./compute/bessel.h"
|
|
|
|
|
|
|
|
void bessel_test(){
|
|
|
|
// 轨迹关键点
|
|
|
|
vector<Point> points = {{0.0,0.0,0.0}, {200.0, 800.0,7000.0},{400.0,0.0,6800.0},{800.0,800.0,8000.0}};
|
|
|
|
// 计算步长
|
|
|
|
vector<Point> res = Bessel::run(points, 0.001);
|
|
|
|
// 计算结果存储到文件
|
|
|
|
string filename = R"(test_1.csv)";
|
|
|
|
ofstream ofs(filename);
|
|
|
|
ofs << "x,y,z" << endl;
|
|
|
|
for (const auto &item: res){
|
|
|
|
ofs << item.x << "," << item.y << "," << item.z << endl;
|
|
|
|
}
|
|
|
|
ofs.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// TODO 当前是将消息广播全部消费者自行判断是否消费,该种机制是否合理后续在进行论证
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
|
|
|
|
// 加载配置文件
|
|
|
|
// loadConfig(QCoreApplication::applicationDirPath() + "/application.ini");
|
|
|
|
|
|
|
|
// 初始化系统
|
|
|
|
// init();
|
|
|
|
|
|
|
|
/// test -start
|
|
|
|
// qDebug() << "init";
|
|
|
|
// QString msg = "{\"name\":\"张三\"}";
|
|
|
|
// QString key = "loadMap";
|
|
|
|
// auto headers = RdKafka::Headers::create();
|
|
|
|
// headers->add("token", "safdasgdagafgafdsghfsjh");
|
|
|
|
// KafkaHandler::message("test_topic" , msg, key , headers);
|
|
|
|
// boost_test();
|
|
|
|
bessel_test();
|
|
|
|
qDebug() << "sds";
|
|
|
|
/// test -end
|
|
|
|
|
|
|
|
return QCoreApplication::exec();
|
|
|
|
}
|