Commit 4b7e5982 authored by oscar's avatar oscar

修改读取配置逻辑

parent 10afaad8
......@@ -194,44 +194,55 @@ void TrackingRos::Init(ros::NodeHandle& nh)
//std::string file = folder + yaml;
int gpu = 0;
gpu = m_config["kf_gpu"].as<int32_t>();
if(m_config["kf_gpu"])
gpu = m_config["kf_gpu"].as<int32_t>();
else
SDK_LOG(SDK_INFO, "can not load kf_gpu ");
//nh.param<int32_t>("kf_gpu", gpu, 0);
SDK_LOG(SDK_INFO, "kf_gpu = %d",gpu);
m_tracker.SetGPU(gpu);
m_lidar_x_angle = m_config["lidar_x_angle"].as<float>();
if(m_config["lidar_x_angle"])
m_lidar_x_angle = m_config["lidar_x_angle"].as<float>();
//nh.param<float>("lidar_x_angle", m_lidar_x_angle, 354.102);
SDK_LOG(SDK_INFO, "m_lidar_x_angle = %f", m_lidar_x_angle);
float threshold;
threshold = m_config["iou_threshold"].as<float>();
float threshold = 0.00001;
if(m_config["iou_threshold"])
threshold = m_config["iou_threshold"].as<float>();
//nh.param<float>("iou_threshold", threshold, 0.01);
SDK_LOG(SDK_INFO, "iou_threshold = %f", threshold);
m_tracker.SetIouThreshold(threshold);
int max_coastcycles;
max_coastcycles = m_config["max_coastcycles"].as<int32_t>();
int max_coastcycles = 1;
if(m_config["max_coastcycles"])
max_coastcycles = m_config["max_coastcycles"].as<int32_t>();
//nh.param<int32_t>("max_coastcycles", max_coastcycles, 2);
SDK_LOG(SDK_INFO, "max_coastcycles = %d", max_coastcycles);
m_tracker.SetMaxCoastCycles(max_coastcycles);
int update_valid_count;
update_valid_count = m_config["update_valid_count"].as<int32_t>();
int update_valid_count = 2;
if(m_config["update_valid_count"])
update_valid_count = m_config["update_valid_count"].as<int32_t>();
//nh.param<int32_t>("update_valid_count", update_valid_count, 3);
SDK_LOG(SDK_INFO, "update_valid_count = %d", update_valid_count);
m_tracker.SetValidUpdateCount(update_valid_count);
float matrix_angle_r_value;
matrix_angle_r_value = m_config["matrix_angle_r_value"].as<float>();
float matrix_angle_r_value = 1;
if(m_config["matrix_angle_r_value"])
matrix_angle_r_value = m_config["matrix_angle_r_value"].as<float>();
//nh.param<float>("matrix_angle_r_value", matrix_angle_r_value, 0.1);
SDK_LOG(SDK_INFO, "matrix_angle_r_value = %f", matrix_angle_r_value);
std::vector<float> values;
values.push_back(matrix_angle_r_value);
m_tracker.SetValues(values);
auto cfg = config;
m_trans = cfg["TRANS"].as<std::vector<std::vector<double>>>();
if (config["TRANS"])
m_trans = config["TRANS"].as<std::vector<std::vector<double>>>();
else
SDK_LOG(SDK_INFO, "can not load TRANS from yaml");
auto cfg2 = config;
m_kitti2origin = cfg2["KITTI2ORIGIN"].as<std::vector<std::vector<double>>>();
if(config["KITTI2ORIGIN"])
m_kitti2origin = config["KITTI2ORIGIN"].as<std::vector<std::vector<double>>>();
else
SDK_LOG(SDK_INFO, "can not load KITTI2ORIGIN from yaml");
SDK_LOG(SDK_INFO, "trans = [%s]", GetMatrixStr(m_trans, 4, 4).c_str());
SDK_LOG(SDK_INFO, "kitti2origin = [%s]", GetMatrixStr(m_kitti2origin,4,4).c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment