Copyright (c) 2004, 2005 ActivMedia Robotics, LLC.
Copyright (c) 2006, MobileRobots, Inc.
All rights reserverd.
The ArSonarLocalizationTask class works asynchronously to localize a robot in a known (mapped) indoor environment. Besides a prepared line map created and edited with Mapper3 (tm) or similar utility, ArSonarLocalization requires the use of a MobileRobots or ActivMedia robot platform or simulator equipped with ultrasonic range-finding sensors (sonar). (If you have a SICK laser, you can use ArLocalizationTask -- available in ARNL only, not SONARNL -- to do more accurate localization.)
In addition, ArSonarLocalizationTask uses ARIA and contains a full version of ARIA.
Briefly, in order to run the sonar localization task thread, the ArSonarLocalizationTask class needs instantiated and initialized ArRobot, ArSonarDevice 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 ArSonarLocalizationTask class with an instantiated ArRobot, an ArSonarDevice class and a line 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) ArSonarLocalizationTask *myLocaTask = new ArSonarLocalizationTask(myRobot, mySonar, 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, ArSonarLocalizationTask 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 SONARNL's configuration parameters.
ArFunctor1<int> tracking_failed(failed); // note that failed must be defined.
myLocaTask->addFailedLocalizationCB(&trackingFailed);
1.4.0