Check if area is localized in loaded ADF

2019-01-26 02:25发布

问题:

UPDATE:

I found the lines for re-localization, but de the device doesn't localize itself. I always get the status code POSE_INITIALIZING back after loading the ADF. Also the re-localization in the Java Area_Description_Example doesn't work. Anyone with the same problem? The only apps with working re-localozation are "Explorer" and "ADF Inspector", but I don't have the source code for it.

Here is the solution of my first question, the code to check re-localization after loading an ADF:

TangoPoseData lastFramePose = mTango.getPoseAtTime(mRgbTimestampGlThread,
                            FRAME_PAIR);
    if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {

           // Device is re-located!               

           // Update the camera pose from the renderer
           mRenderer.updateRenderCameraPose(lastFramePose);
           mCameraPoseTimestamp = lastFramePose.timestamp;
    } else {
           Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread);
    }

OLD:

In my application the user can decide whether to start a new session or load an previously recorded ADF (area description file). I loaded the ADF (adfUUID) and added it to the Tango class object (mTango) like below:

TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_CURRENT);
config.putString(TangoConfig.KEY_STRING_AREADESCRIPTION, adfUUID);
mTango.setRuntimeConfig(config);

So my question is now, how can I check if the area is localized with the loaded ADF? I want to have a coordinate reference frame to the start of service of the loaded ADF and not of my new session. This are my settings in my connectTango() function:

TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
config.putBoolean(TangoConfig.KEY_BOOLEAN_LOWLATENCYIMUINTEGRATION, true);
config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
config.putBoolean(TangoConfig.KEY_BOOLEAN_LEARNINGMODE, true);
config.putBoolean(TangoConfig.KEY_BOOLEAN_COLORCAMERA, true);
mTango.connect(config);

And the fram pair I used is:

private static final TangoCoordinateFramePair FRAME_PAIR = new TangoCoordinateFramePair(
        TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION,
        TangoPoseData.COORDINATE_FRAME_DEVICE);

回答1:

Both "Loaded ADF on with Learning mode on" and "Load ADF on with Learning mode off" are Good. Currently They are using different location pipeline. So the first one will take much longer time localized than the second ones. ADF Inspector is for Load ADF on with Learning off" Tango Explorer should be Re-localized with with "Load ADF on with Learning on"

for question about how to check the ADF localized please see the example java code:

  // Check for Device wrt ADF pose, Device wrt Start of Service pose,
                // Start of Service wrt ADF pose (This pose determines if the device
                // is relocalized or not).
                if (pose.baseFrame == TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION
                        && pose.targetFrame == TangoPoseData
                        .COORDINATE_FRAME_START_OF_SERVICE) {
                    if (pose.statusCode == TangoPoseData.POSE_VALID) {
                        mIsRelocalized = true;
                    } else {
                        mIsRelocalized = false;
                    }

Pose Data on the third ones:

ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION,
            TangoPoseData.COORDINATE_FRAME_DEVICE));
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION,
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE));


回答2:

I found some pretty similiar questions on the same topic here:

1. question

2. question

3. question

4. question

So I think the answer is the following: Re-localization with an loaded ADF and learning mode on works, but it takes quite a while (up to 3-5 minutes). Walk around and don't give up.

Re-localization with an loaded ADF and learning mode off works.