Copyright (c) 2004, 2005 ActivMedia Robotics, LLC.
Copyright (c) 2006, MobileRobots, Inc.
All rights reserved.
The ArLocalizationTask class works asynchronously to localize a robot in a known (mapped) indoor environment. Besides a prepared map created and edited with Mapper3 (tm) or similar utility, ArLocalization requires the use of a MobileRobots or ActivMedia robot platform or simulator equipped with a SICK laser range-finding sensor. (To do localization with sonar, use ArSonarLocalizationTask instead.)
In addition, ArLocalizationTask uses ARIA. The ARNL distribution contains ARIA.
Briefly, in order to run the localization task thread, the ArLocalizationTask class needs instantiated and initialized ArRobot, ArSick and ArMap objects. The output of the localization is reflected directly in the pose of the ArRobot, unless explicitly set not to do so.
In order to use localization in your own software, follow these two steps, at minimum and in order:
1. Create a ArLocalizationTask class with an instantiated ArRobot, an ArSick class and a map of the robot's environment, explicitly as a file or from ArMap. For example,
// Create the localization task (it will start its own thread here) ArLocalizationTask *myLocTask = new ArLocalizationTask(myRobot, mySick, mapname);
2. Initialize the robot's location inside the map:
// Set the initial pose to the robot's "Home" position from the map, or // (0,0,0) if none, then let the localization thread take over. myLocaTask->localizeRobotAtHomeBlocking();
You can later reset the robot to a unique "home" pose, as prescribed in the map, any time before or after initialization using the localizeRobotAtHomeBlocking() or localizeRobotAtHomeNonBlocking() functions. Or use the forceUpdatePose() method to place the robot in the map:
// Force the current localization pose
myLocaTask->forceUpdatePose(pose, ns, xstd, ystd, tstd);
Thereafter, ArLocalizationTask thread automatically acts to relocate the robot in the map. To conserve processing resources, automatic localization updates happen only when the robot has moved beyond set translational and/or rotational limits. By default, these limits are set to +-200 mm translation and +-5 degrees rotation but may be changed by modifying ARNL's configuration parameters.
Since the localization task deals with a map and builds its own occupancy grid, the class also provides access to the map and grid using member functions. Get these data by including the related include files and member functions.
ArFunctor1<int> tracking_failed(failed); // note that failed must be defined.
myLocaTask->addFailedLocalizationCB(&trackingFailed);
1.4.0