Skip to content

Commit 23eb56d

Browse files
refactor(object_merger): rework parameters (#7337)
* Deleted the default values in the source code, updated .param.yaml files, created schema.json files, updated readme. Signed-off-by: Boyang <tby@udel.edu> * style(pre-commit): autofix --------- Signed-off-by: Boyang <tby@udel.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e96334c commit 23eb56d

File tree

6 files changed

+142
-17
lines changed

6 files changed

+142
-17
lines changed

perception/object_merger/README.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ The successive shortest path algorithm is used to solve the data association pro
2525

2626
## Parameters
2727

28-
| Name | Type | Description |
29-
| --------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30-
| `can_assign_matrix` | double | Assignment table for data association |
31-
| `max_dist_matrix` | double | Maximum distance table for data association |
32-
| `max_area_matrix` | double | Maximum area table for data association |
33-
| `min_area_matrix` | double | Minimum area table for data association |
34-
| `max_rad_matrix` | double | Maximum angle table for data association |
35-
| `base_link_frame_id` | double | association frame |
36-
| `distance_threshold_list` | `std::vector<double>` | Distance threshold for each class used in judging overlap. The class order depends on [ObjectClassification](https://github.com/autowarefoundation/autoware_msgs/blob/main/autoware_perception_msgs/msg/ObjectClassification.msg). |
37-
| `generalized_iou_threshold` | `std::vector<double>` | Generalized IoU threshold for each class |
28+
{{ json_to_markdown("perception/object_merger/schema/object_association_merger.schema.json") }}
29+
{{ json_to_markdown("perception/object_merger/schema/data_association_matrix.schema.json") }}
30+
{{ json_to_markdown("perception/object_merger/schema/overlapped_judge.schema.json") }}
3831

3932
## Tips
4033

perception/object_merger/config/object_association_merger.param.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
ros__parameters:
33
sync_queue_size: 20
44
precision_threshold_to_judge_overlapped: 0.4
5+
recall_threshold_to_judge_overlapped: 0.5
56
remove_overlapped_unknown_objects: true
7+
base_link_frame_id: base_link
8+
priority_mode: 3 # PriorityMode::Confidence
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Data Association Matrix Parameters",
4+
"type": "object",
5+
"properties": {
6+
"ros__parameters": {
7+
"type": "object",
8+
"properties": {
9+
"can_assign_matrix": {
10+
"type": "array",
11+
"items": {
12+
"type": "number"
13+
},
14+
"description": "Assignment table for data association"
15+
},
16+
"max_dist_matrix": {
17+
"type": "array",
18+
"items": {
19+
"type": "number"
20+
},
21+
"description": "Maximum distance table for data association"
22+
},
23+
"max_rad_matrix": {
24+
"type": "array",
25+
"items": {
26+
"type": "number"
27+
},
28+
"description": "Maximum angle table for data association. If value is greater than pi, it will be ignored."
29+
},
30+
"min_iou_matrix": {
31+
"type": "array",
32+
"items": {
33+
"type": "number"
34+
},
35+
"description": "Minimum IoU threshold matrix for data association. If value is negative, it will be ignored."
36+
}
37+
},
38+
"required": ["can_assign_matrix", "max_dist_matrix", "max_rad_matrix", "min_iou_matrix"]
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Parameters for Object Association Merger Node",
4+
"type": "object",
5+
"definitions": {
6+
"object_association_merger": {
7+
"type": "object",
8+
"properties": {
9+
"sync_queue_size": {
10+
"type": "integer",
11+
"description": "The size of the synchronization queue.",
12+
"default": 20
13+
},
14+
"precision_threshold_to_judge_overlapped": {
15+
"type": "number",
16+
"description": "The precision threshold to judge if objects are overlapped.",
17+
"default": 0.4
18+
},
19+
"recall_threshold_to_judge_overlapped": {
20+
"type": "number",
21+
"description": "The recall threshold to judge if objects are overlapped.",
22+
"default": 0.5
23+
},
24+
"remove_overlapped_unknown_objects": {
25+
"type": "boolean",
26+
"description": "Flag to remove overlapped unknown objects.",
27+
"default": true
28+
},
29+
"base_link_frame_id": {
30+
"type": "string",
31+
"description": "The frame ID of the association frame.",
32+
"default": "base_link"
33+
},
34+
"priority_mode": {
35+
"type": "integer",
36+
"description": "Index for the priority_mode.",
37+
"default": 3,
38+
"enum": [0, 1, 2, 3]
39+
}
40+
},
41+
"required": [
42+
"sync_queue_size",
43+
"precision_threshold_to_judge_overlapped",
44+
"recall_threshold_to_judge_overlapped",
45+
"remove_overlapped_unknown_objects",
46+
"base_link_frame_id",
47+
"priority_mode"
48+
]
49+
}
50+
},
51+
"properties": {
52+
"/**": {
53+
"type": "object",
54+
"properties": {
55+
"ros__parameters": {
56+
"$ref": "#/definitions/object_association_merger"
57+
}
58+
},
59+
"required": ["ros__parameters"]
60+
}
61+
},
62+
"required": ["/**"]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Overlapped Judge Parameters",
4+
"type": "object",
5+
"properties": {
6+
"ros__parameters": {
7+
"type": "object",
8+
"properties": {
9+
"distance_threshold_list": {
10+
"type": "array",
11+
"items": {
12+
"type": "number"
13+
},
14+
"description": "Distance threshold for each class used in judging overlap."
15+
},
16+
"generalized_iou_threshold": {
17+
"type": "array",
18+
"items": {
19+
"type": "number"
20+
},
21+
"description": "Generalized IoU threshold for each class."
22+
}
23+
},
24+
"required": ["distance_threshold_list", "generalized_iou_threshold"]
25+
}
26+
}
27+
}

perception/object_merger/src/object_association_merger/node.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,14 @@ ObjectAssociationMergerNode::ObjectAssociationMergerNode(const rclcpp::NodeOptio
8080
object1_sub_(this, "input/object1", rclcpp::QoS{1}.get_rmw_qos_profile())
8181
{
8282
// Parameters
83-
base_link_frame_id_ = declare_parameter<std::string>("base_link_frame_id", "base_link");
84-
priority_mode_ = static_cast<PriorityMode>(
85-
declare_parameter<int>("priority_mode", static_cast<int>(PriorityMode::Confidence)));
86-
sync_queue_size_ = declare_parameter<int>("sync_queue_size", 20);
87-
remove_overlapped_unknown_objects_ =
88-
declare_parameter<bool>("remove_overlapped_unknown_objects", true);
83+
base_link_frame_id_ = declare_parameter<std::string>("base_link_frame_id");
84+
priority_mode_ = static_cast<PriorityMode>(declare_parameter<int>("priority_mode"));
85+
sync_queue_size_ = declare_parameter<int>("sync_queue_size");
86+
remove_overlapped_unknown_objects_ = declare_parameter<bool>("remove_overlapped_unknown_objects");
8987
overlapped_judge_param_.precision_threshold =
9088
declare_parameter<double>("precision_threshold_to_judge_overlapped");
9189
overlapped_judge_param_.recall_threshold =
92-
declare_parameter<double>("recall_threshold_to_judge_overlapped", 0.5);
90+
declare_parameter<double>("recall_threshold_to_judge_overlapped");
9391
overlapped_judge_param_.generalized_iou_threshold =
9492
convertListToClassMap(declare_parameter<std::vector<double>>("generalized_iou_threshold"));
9593

0 commit comments

Comments
 (0)