Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do the world positions of AnchorNode and Node determine the drift of the location marker? #128

Open
Lilyxxzjzljy opened this issue Dec 31, 2020 · 1 comment

Comments

@Lilyxxzjzljy
Copy link

when using ARCore-Location to implement an app which places AR labels at specific gps locations,I meet some issues.
1、when the phone is still,the location marker pops on the screen sometimes,with the world position of the AnchorNode changing.
2、when I move the phone(but the pose of the phone does not change,just hold the phone and walk straight on the path),the world position of the AnchorNode does not change,but the location marker moves along with the phone.it does not pop,it seems like that it sticks on the screen and moves with the phone.
I am confused that by logging i find world position of the node presenting the gps location is consistent over the session,because the position is set just as below when the node is the child of the anchorNode:

            n.setWorldPosition(new Vector3(n.getWorldPosition().x, getHeight(), n.getWorldPosition().z));
            //Log.i("LocationScene","node x:"+n.getWorldPosition().x+" y:"+direction.y+" z:"+n.getWorldPosition().z);

            Quaternion lookRotation = Quaternion.lookRotation(direction, Vector3.up());
            n.setWorldRotation(lookRotation);
            n.setWorldScale(new Vector3(scale, scale, scale));

when the getHeight() returns the constant the world position of the node does not change.
while I log the world position of the AnchorNode,I find it changes when anchorsNeedRefresh is true.

I am confused that I find description like this:
placing an anchor that is not associated with a Trackable object is usually not a good experience. The trackable object (planes, augmented images, oriented points) are update by ARCore to represent the connections between the real world image and the augmented, virtual images. If you place an anchor in the "air", it will drift and move relative to the real world.
in the google-ar/sceneform-android-sdk#185 the implementation like this is just creating an anchor not attached to a trackable object but in the "air",and thus the location marker will drift with the phone?

I do not understand the significance of the code,and why does the world position of anchorNode change over time.If the world coordinate frames is set definite(the origin is on the camera at the start of the session),then to understand the relationship between the node and the camera,the coordinate of AnchorNode should change every time?

Why does the locationMarker moves with phone when the pose and the world position of the anchorNode do not change,just like the locationMarker sticking on the screen?How can i resolve it?

Thanks for any help.

@Lilyxxzjzljy
Copy link
Author

Lilyxxzjzljy commented Dec 31, 2020

Anther issue is that i find the world position of camera changes every frame even when the phone is still.I log the value like this:

          final Vector3 cameraPosition = getScene().getCamera().getWorldPosition();
           Vector3 direction = Vector3.subtract(cameraPosition, n.getWorldPosition());
           Log.i("LocationScene","Camera:x--"+cameraPosition.x+"  y--"+cameraPosition.y+"  z--"+cameraPosition.z+"  
           node:x--"+n.getWorldPosition().x+"  y--"+n.getWorldPosition().y+"  z--"+n.getWorldPosition().z);

Why does this happen?Thanks a lot for any suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant