Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfx_kalman_filter_src
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
jfx_kalman_filter_src
Commits
25dbfa2c
Commit
25dbfa2c
authored
Feb 23, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交配置读取yaml文件
parent
abf8c4ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
TrackingRos.cpp
TrackingRos.cpp
+38
-12
TrackingRos.h
TrackingRos.h
+3
-0
No files found.
TrackingRos.cpp
View file @
25dbfa2c
...
...
@@ -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
>>>
();
...
...
TrackingRos.h
View file @
25dbfa2c
...
...
@@ -49,4 +49,7 @@ public:
int
m_frameNum
=
0
;
float
m_lidar_x_angle
=
0
.
0
f
;
//修改rot_y的参数,从配置里读取
std
::
string
m_root_dir
;
//存储统一的根目录路径
YAML
::
Node
m_config
;
//配置的yaml文件
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment