π‘ Target Detection#
The Target Detection is a plugin-based framework that enables robots to detect the presence of any Target in the environment and estimate its position relative to the robot.
In this framework, each plugin allows the robot to detect a different type of target using the available sensors. In the same way, by creating a new plugin, one can use a new sensor or a new algorithm to detect a new type of target.
The entrypoint for the target detection is the /detect_target action, which is implemented in the target_detector_server node. This Action Server allows selecting a specific detector plugin among the available ones and the specific ID of the target to detect and returns the targetβs position.
Available Detectors#
Laser Target Detector#
This plugin is a target detection system engineered to identify specific, predefined patterns,
facilitating target localization in the robotβs surroundings.
Laser scan data is received through a subscription to the relevant topic, where each new scan message
triggers the detection process. At this point, laser scan data is converted into an image for pattern analysis,
using configurable parameters to adjust the conversion. Finally, the PatternMatcher
is used to identify
the presence and location of the target pattern within the generated image, based on comparison with a predefined
pattern image.
To list all the available patterns you can use the command:
ls /opt/pal/${PAL_DISTRO}/share/pal_nav2_laser_target_detector/patterns/data
To list the corresponding ID of each pattern, you can use the command:
cat /opt/pal/${PAL_DISTRO}/share/pal_nav2_laser_target_detector/patterns/registry.yaml
To configure this detector, please refer to Laser Detector API section.
This detector is particularly useful for autonomous robot charging applications. For more information on autonomous robot docking, please refer to the docking section.
ArUco Target Detector#
This plugin is a target detection system based on ArUco markers.
Leveraging the ArUco library, this detector excels in identifying markers and calculating
their poses relative to the camera, applying optionally an ImageFilter
to the input image in order to improve
the detection reliability.
To learn how to configure this detector, please refer to ArUco Detector API section.
Simple Target Detector#
This plugin subscribes to the /target_detector/goal topic and acts as a bridge between
any kind of detector that you want to develop, or that you already have available, and the
target_detector_server node.
You can develop your own Detector plugin either by creating a C++ class that inherits from the
pal_nav2_core::TargetDetector
class as shown in the 𧩠Target Detection Plugins section, or by
creating any node, using any programming language, that publishes a message of type
pal_nav2_msgs/msg/Target
on the /target_detector/goal topic.
This way, you can use your Detector plugin with the /detect_target action and with the /navigate_to_target action.
auto target_msg_pub_ = node->create_publisher<pal_nav2_msgs::msg::Target>("/target_dector/goal", 10);
pal_nav2_msgs::msg::Target target_msg_;
target_msg_.id = <SOME-ID>; // int
target_msg_.transform = <SOME-TRANSFORM>; // geometry_msgs::msg::Transform
target_msg_.accuracy = <SOME-ACCURACY>; // float
target_msg_pub_->publish(target_msg_);
target_msg_pub = node.create_publisher(pal_nav2_msgs.msg.Target, '/target_detector/goal', 10)
target_msg = pal_nav2_msgs.msg.Target()
target_msg.id = <SOME-ID> # int
target_msg.transform = <SOME-TRANSFORM> # geometry_msgs.msg.Transform
target_msg.accuracy = <SOME-ACCURACY> # float
target_msg_pub.publish(target_msg)
See also#
To continue learning about the Target Detection, how to implement your Detector and how to interact with the available ones, check the sections: