LocalizationWorker
-
class LocalizationWorker : public Localization, public Worker
The threaded Localization worker periodically calculates the robot pose using the default localization strategy on the currently available data.
The camera workers register the QueueTags function in their callback and populate this object with tag data each time they receive an image frame. The Execute function in the LocalizationWorker periodically checks the freshness of all tag data and removes any stale tag poses (>150ms old), then applies the localization strategy to calculate the robot pose.
Public Functions
-
LocalizationWorker(bool pose_logging = false)
Initialize the worker, set the strategy to be MeanLocalizationStrategy.
-
bool QueueTags(TagArray &raw_tagarray)
Add multiple tag poses to be used in the localization calculation.
- Parameters:
raw_tagarray – The tags to be added
- Returns:
true if all tags were successfully added, false otherwise.
-
bool QueueTag(Pose raw_pose)
Add a single tag pose to be used in the localization calculation.
- Parameters:
raw_pose – The single tag to be added
- Returns:
true if the tag was successfully added, false otherwise.
-
RobotPose GetRobotPose()
Get the current calculation of the robot’s pose.
- Returns:
The fresh calculated robot pose in the global frame.
-
void LogStats(bool log_stats)
Enable stats logging every 500ms off by default.
- Parameters:
log_stats – true to enable stats logging, false to disable.
-
LocalizationWorker(bool pose_logging = false)