When utilising a Tango what would I use, callbacks or otherwise to detect when the devise has localised to a previously loaded ADF?
This is mainly for UI purposes in conjunction with Tango UX, telling a user to walk around an environment.
Localization may be detected when your TangoPoseData with a frame of ADF comes back valid.
Look at the Tango Java examples of AreaLearningActivity with this simplified logic:
//tell tango to provide pose for ADF
ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
framePairs.add(new TangoCoordinateFramePair(
TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION,
TangoPoseData.COORDINATE_FRAME_DEVICE));
//register a listener for the frames chosen
mTango.connectListener(framePairs, new OnTangoUpdateListener() {
//listens for updates from tango pose
public void onPoseAvailable(TangoPoseData pose) {
//base frame of ADF provides coordinates relative to the origin of the ADF
if (pose.baseFrame == TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION
&& pose.targetFrame == TangoPoseData.COORDINATE_FRAME_DEVICE)
//if the status is valid then localization has succeeded
if(pose.statusCode == TangoPoseData.POSE_VALID){
Log.i(TAG,"Successfully localized with ADF");
}
}
}
Your config must indicate which ADF is of interest:
config.putString(TangoConfig.KEY_STRING_AREADESCRIPTION,adfId);
This process is not easily observed from the code, but I discovered it debugging the AreaLearningActivity example. The Java API would benefit from a higher level of abstraction making the common scenario you requested more obvious and easier to use:
TangoLocalizer.builder().register(myListener).adfId(myAdfId).build();