From 9585c55c747a184a04f8875dd6ecef2bd1af3f10 Mon Sep 17 00:00:00 2001 From: batuhanbeytekin Date: Thu, 19 Sep 2024 12:02:40 +0300 Subject: [PATCH] refactor(dummy_perception_publisher): rework parameters Signed-off-by: batuhanbeytekin refactor(dummy_perception_publisher): rework parameters Signed-off-by: batuhanbeytekin --- simulator/dummy_perception_publisher/README.md | 2 +- .../dummy_perception_publisher.schema.json | 4 +++- .../dummy_perception_publisher/src/node.cpp | 18 +++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/simulator/dummy_perception_publisher/README.md b/simulator/dummy_perception_publisher/README.md index 869084d558094..058934f2c6baa 100644 --- a/simulator/dummy_perception_publisher/README.md +++ b/simulator/dummy_perception_publisher/README.md @@ -25,7 +25,7 @@ This node publishes the result of the dummy detection with the type of perceptio ## Parameters -{{json_to_markdown("simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json)}} +{{json_to_markdown("simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json")}} ### Node Parameters diff --git a/simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json b/simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json index 8e25474668a8f..10821f6054346 100644 --- a/simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json +++ b/simulator/dummy_perception_publisher/schema/dummy_perception_publisher.schema.json @@ -14,7 +14,9 @@ "detection_successful_rate": { "type": "number", "default": 0.8, - "description": "sensor detection rate. (min) 0.0 - 1.0(max)" + "minimum": 0.0, + "maximum": 1.0, + "description": "sensor detection rate." }, "enable_ray_tracing": { "type": "boolean", diff --git a/simulator/dummy_perception_publisher/src/node.cpp b/simulator/dummy_perception_publisher/src/node.cpp index dba230f23f108..d5279dc2e2b75 100644 --- a/simulator/dummy_perception_publisher/src/node.cpp +++ b/simulator/dummy_perception_publisher/src/node.cpp @@ -127,17 +127,17 @@ TrackedObject ObjectInfo::toTrackedObject( DummyPerceptionPublisherNode::DummyPerceptionPublisherNode() : Node("dummy_perception_publisher"), tf_buffer_(this->get_clock()), tf_listener_(tf_buffer_) { - visible_range_ = this->declare_parameter("visible_range", 100.0); - detection_successful_rate_ = this->declare_parameter("detection_successful_rate", 0.8); - enable_ray_tracing_ = this->declare_parameter("enable_ray_tracing", true); - use_object_recognition_ = this->declare_parameter("use_object_recognition", true); - use_base_link_z_ = this->declare_parameter("use_base_link_z", true); + visible_range_ = this->declare_parameter("visible_range"); + detection_successful_rate_ = this->declare_parameter("detection_successful_rate"); + enable_ray_tracing_ = this->declare_parameter("enable_ray_tracing"); + use_object_recognition_ = this->declare_parameter("use_object_recognition"); + use_base_link_z_ = this->declare_parameter("use_base_link_z"); const bool object_centric_pointcloud = - this->declare_parameter("object_centric_pointcloud", false); - publish_ground_truth_objects_ = this->declare_parameter("publish_ground_truth", false); + this->declare_parameter("object_centric_pointcloud"); + publish_ground_truth_objects_ = this->declare_parameter("publish_ground_truth"); const unsigned int random_seed = - static_cast(this->declare_parameter("random_seed", 0)); - const bool use_fixed_random_seed = this->declare_parameter("use_fixed_random_seed", false); + static_cast(this->declare_parameter("random_seed")); + const bool use_fixed_random_seed = this->declare_parameter("use_fixed_random_seed"); if (object_centric_pointcloud) { pointcloud_creator_ =