google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.97k stars 1.22k forks source link

generic::unavailable: redwood::INVALID_ARGUMENT: Passed timestamp is too old #530

Closed weatherfish closed 3 years ago

weatherfish commented 6 years ago

08-14 17:50:13.992 4350-4350/com.sf.rule E/native: status.cc:155 generic::unavailable: redwood::INVALID_ARGUMENT: Passed timestamp is too old 08-14 17:50:14.002 4350-4350/com.sf.rule E/AndroidRuntime: FATAL EXCEPTION: main Process: com.sf.rule, PID: 4350 com.google.ar.core.exceptions.FatalException at com.google.ar.core.U.a(Unknown Source:2) at com.google.ar.core.Session.throwExceptionFromArStatus(Unknown Source:4) at com.google.ar.core.HitResult.nativeCreateAnchor(Native Method) at com.google.ar.core.HitResult.createAnchor(Unknown Source:6) at com.sf.rule.Main3Activity.drawPoint(Main3Activity.kt:180) at com.sf.rule.Main3Activity.getPoints(Main3Activity.kt:155) at com.sf.rule.Main3Activity.access$getPoints(Main3Activity.kt:33) at com.sf.rule.Main3Activity$onCreate$4.onClick(Main3Activity.kt:96) at android.view.View.performClick(View.java:6597) at android.view.View.performClickInternal(View.java:6574) at android.view.View.access$3100(View.java:778) at android.view.View$PerformClick.run(View.java:25885) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

inio commented 6 years ago

Are you holding onto Frame objects and using them to create anchors later? You should only create anchors (and do hit tests) using the Frame returned from the most recent call to ArSession.update()

However, that should have thrown a DeadlineExceededException instead of a FatalException, so I filed an internal bug on that.

weatherfish commented 6 years ago

Hello @inio

I don't hold onto Frame . but I'm holding arScenceView and using it to get a arFrame to create anchors just like below:

private fun screen2HitResult(arSceneView: ArSceneView?, x: Float, y: Float): HitResult? {
        val list = arSceneView?.arFrame?.hitTest(x, y)
        if (list == null || list.isEmpty()) {
            Log.e("++++", "list is null")
            return null
        }
        Log.e("+++pose+++", list[0].hitPose.toString())
        return list[0]
    }

    private fun drawPoint(hitResult: HitResult?) {
        if (renderable == null)  {
            Log.e("++++", "renderable is null")
            return
        }
        if (hitResult == null) {
            Log.e("++++", "hitResult is null")
            return
        }
        val anchor = hitResult.trackable.createAnchor(hitResult.hitPose)
        val anchorNode = AnchorNode(anchor)
        anchorNode.setParent(arSceneView?.scene)
        val node = Node()
        node.renderable = renderable
        node.setParent(anchorNode)
    }
weatherfish commented 6 years ago

And I tried change val list = arSceneView?.arFrame?.hitTest(x, y) to val list = arSceneView?.session?.update?.hitTest(x, y)

but it doesn't work!

aayc commented 6 years ago

I've been facing a similar issue.

inio commented 6 years ago

@weatherfish that won't help. I've looked into the sceneform code and SceneView.getArFrame() seems like it should be definitely returning the last Frame returned by update(). This seems like an actual bug.

@aayc are you using SceneForm as well?

inio commented 6 years ago

Could you please provide the build fingerprint of the device you're using? Use adb shell getprop ro.build.fingerprint to get it.

aayc commented 6 years ago

I'm using SceneForm too, yes.

weatherfish commented 6 years ago

@inio

I used adb shell getprop ro.build.fingerprint to got that:

google/sailfish/sailfish:9/PPR1.180610.010/4900720:user/release-keys

devbridie commented 3 years ago

As a part of ongoing efforts to maintain ARCore repositories, I’m closing this issue as stale since it hasn’t had activity in more than 6 months. If this issue is still relevant, please feel free to file a new bug using the latest version of the SDK.