Skip to content

Commit

Permalink
refactor-traffic_light_map_based_detector
Browse files Browse the repository at this point in the history
Signed-off-by: santosh-interplai <[email protected]>
Signed-off-by: karishma <[email protected]>
  • Loading branch information
santosh-interplai authored and karishma1911 committed Jun 3, 2024
1 parent f04d70c commit 92e00c3
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/**:
ros__parameters:
max_vibration_pitch: 0.01745329251 # -0.5 ~ 0.5 deg
max_vibration_yaw: 0.01745329251 # -0.5 ~ 0.5 deg
max_vibration_height: 0.5 # -0.25 ~ 0.25 m
max_vibration_width: 0.5 # -0.25 ~ 0.25 m
max_vibration_depth: 0.5 # -0.25 ~ 0.25 m
max_vibration_pitch: 0.01745329251 # -0.5 ~ 0.5 deg
max_vibration_yaw: 0.01745329251 # -0.5 ~ 0.5 deg
max_vibration_height: 0.5 # -0.25 ~ 0.25 m
max_vibration_width: 0.5 # -0.25 ~ 0.25 m
max_vibration_depth: 0.5 # -0.25 ~ 0.25 m
max_detection_range: 200.0
min_timestamp_offset: 0.0
max_timestamp_offset: 0.0
timestamp_sample_len: 0.01
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Parameters for Traffic Light Map Based Detector",
"type": "object",
"definitions": {
"traffic_light_map_based_detector": {
"type": "object",
"properties": {
"max_vibration_pitch": {
"type": "number",
"default": 0.01745329251,
"description": "Maximum error in pitch direction. If -5~+5, it will be 10."
},
"max_vibration_yaw": {
"type": "number",
"default": 0.01745329251,
"description": "Maximum error in yaw direction. If -5~+5, it will be 10."
},
"max_vibration_height": {
"type": "number",
"default": 0.5,
"description": "Maximum error in height direction. If -5~+5, it will be 10."
},
"max_vibration_width": {
"type": "number",
"default": 0.5,
"description": "Maximum error in width direction. If -5~+5, it will be 10."
},
"max_vibration_depth": {
"type": "number",
"default": 0.5,
"description": "Maximum error in depth direction. If -5~+5, it will be 10."
},
"max_detection_range": {
"type": "number",
"default": 200.0,
"description": "Maximum detection range in meters. Must be positive"
},
"min_timestamp_offset": {
"type": "number",
"default": 0.0,
"description": "Minimum timestamp offset when searching for corresponding tf"
},
"max_timestamp_offset": {
"type": "number",
"default": 0.0,
"description": "Maximum timestamp offset when searching for corresponding tf"
},
"timestamp_sample_len": {
"type": "number",
"default": 0.01,
"description": "sampling length between min_timestamp_offset and max_timestamp_offset"
}
},
"required": [
"max_vibration_pitch",
"max_vibration_yaw",
"max_vibration_height",
"max_vibration_width",
"max_vibration_depth",
"max_detection_range",
"min_timestamp_offset",
"max_timestamp_offset",
"timestamp_sample_len"
]
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/traffic_light_map_based_detector"
}
},
"required": ["ros__parameters"]
}
},
"required": ["/**"]
}
18 changes: 9 additions & 9 deletions perception/traffic_light_map_based_detector/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ MapBasedDetector::MapBasedDetector(const rclcpp::NodeOptions & node_options)
using std::placeholders::_1;

// parameter declaration needs default values: are 0.0 goof defaults for this?
config_.max_vibration_pitch = declare_parameter<double>("max_vibration_pitch", 0.0);
config_.max_vibration_yaw = declare_parameter<double>("max_vibration_yaw", 0.0);
config_.max_vibration_height = declare_parameter<double>("max_vibration_height", 0.0);
config_.max_vibration_width = declare_parameter<double>("max_vibration_width", 0.0);
config_.max_vibration_depth = declare_parameter<double>("max_vibration_depth", 0.0);
config_.min_timestamp_offset = declare_parameter<double>("min_timestamp_offset", 0.0);
config_.max_timestamp_offset = declare_parameter<double>("max_timestamp_offset", 0.0);
config_.timestamp_sample_len = declare_parameter<double>("timestamp_sample_len", 0.01);
config_.max_detection_range = declare_parameter<double>("max_detection_range", 200.0);
config_.max_vibration_pitch = declare_parameter<double>("max_vibration_pitch");
config_.max_vibration_yaw = declare_parameter<double>("max_vibration_yaw");
config_.max_vibration_height = declare_parameter<double>("max_vibration_height");
config_.max_vibration_width = declare_parameter<double>("max_vibration_width");
config_.max_vibration_depth = declare_parameter<double>("max_vibration_depth");
config_.min_timestamp_offset = declare_parameter<double>("min_timestamp_offset");
config_.max_timestamp_offset = declare_parameter<double>("max_timestamp_offset");
config_.timestamp_sample_len = declare_parameter<double>("timestamp_sample_len");
config_.max_detection_range = declare_parameter<double>("max_detection_range");

if (config_.max_detection_range <= 0) {
RCLCPP_ERROR_STREAM(
Expand Down

0 comments on commit 92e00c3

Please sign in to comment.