Commit 25dbfa2c authored by oscar's avatar oscar

提交配置读取yaml文件

parent abf8c4ff
......@@ -161,41 +161,67 @@ TrackingRos::~TrackingRos()
void TrackingRos::Init(ros::NodeHandle& nh)
{
std::string folder,yaml;
nh.param<std::string>("project_path", folder, "/home/nvidia/catkin_ws/src/jfxrosperceiver");
nh.param<std::string>("yaml_config", yaml, "/jfx_tracking/config/7-1.yaml");
std::string file = folder + yaml;
SDK_LOG(SDK_INFO, "load yaml file = %s",file.c_str());
nh.param<std::string>("root_dir", m_root_dir, "/home/nvidia/oscar/catkin_ws/src/jfx_yolo5/");
int run_mode = 0;
nh.param<int>("run_mode", run_mode, 1);
std::string config_yaml;
std::string yaml_config;
if (run_mode == 1)
{
std::string entry_yaml;
private_nh.param<std::string>("entry_yaml", entry_yaml, "/home/nvidia/oscar/catkin_ws/src/jfx_yolo5/");
}
else
{
private_nh.param<std::string>("unittest_yaml", config_yaml, "");
private_nh.param<std::string>("yaml_config", yaml_config, "");
}
m_config = YAML::LoadFile(config_yaml);
//std::string folder,yaml;
//nh.param<std::string>("project_path", folder, "/home/nvidia/catkin_ws/src/jfxrosperceiver");
//nh.param<std::string>("yaml_config", yaml, "/jfx_tracking/config/7-1.yaml");
//std::string file = folder + yaml;
SDK_LOG(SDK_INFO, "load yaml file = %s", yaml_config.c_str());
int gpu = 0;
nh.param<int32_t>("kf_gpu", gpu, 0);
gpu = m_config["kf_gpu"].as<int32_t>();
//nh.param<int32_t>("kf_gpu", gpu, 0);
SDK_LOG(SDK_INFO, "kf_gpu = %d",gpu);
m_tracker.SetGPU(gpu);
nh.param<float>("lidar_x_angle", m_lidar_x_angle, 354.102);
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;
nh.param<float>("iou_threshold", threshold, 0.01);
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;
nh.param<int32_t>("max_coastcycles", max_coastcycles, 2);
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;
nh.param<int32_t>("update_valid_count", update_valid_count, 3);
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;
nh.param<float>("matrix_angle_r_value", matrix_angle_r_value, 0.1);
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);
YAML::Node config = YAML::LoadFile(file.c_str());
YAML::Node config = YAML::LoadFile(yaml_config.c_str());
auto cfg = config["TRACKING"];
m_trans = cfg["TRANS"].as<std::vector<std::vector<double>>>();
......
......@@ -49,4 +49,7 @@ public:
int m_frameNum = 0;
float m_lidar_x_angle = 0.0f;//修改rot_y的参数,从配置里读取
std::string m_root_dir;//存储统一的根目录路径
YAML::Node m_config;//配置的yaml文件
};
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