google-ar / codelab-geospatial

Apache License 2.0
34 stars 34 forks source link

Failed to convert Geospatial Pose to Pose when indicates tracking #17

Open TimmyBest opened 1 year ago

TimmyBest commented 1 year ago

We send the geo pose of a player over the network to synchronize the position. The struct geo pose cannot be serialized and sent as json. So we send the raw values of lat, lon, altitude and so on over the network. On the receiving end we create a new geo pose and feed it with these raw values. Then we want to convert the GeospatialPose into a Pose with the Convert Method in the earthManager. This works for sometime but after a while the convert method starts giving that error (see screenshot). Here is the code snippet that produces the error.

// location is our serializable wrapper class GeoManager.Location location = data.Location; // we pass on the values GeospatialPose.Latitude = location.Position.Lat; GeospatialPose.Longitude = location.Position.Lon; GeospatialPose.Altitude = location.Altitude; GeospatialPose.EunRotation = location.Rotation; // these are the two lines that create the log you see on the first screen shot print("tracking state: " + Core.GeoManager.GeospatialController.EarthManager.EarthTrackingState); Pose pose = Core.GeoManager.GeospatialController.EarthManager.Convert(GeospatialPose);

Important note: this is NOT happening consitently, it seems to be cause by bad tracking (camera completely covered, indoors). But the tracking state of the earth manager never changes. so the error might not be in the conversion itself but in the update of the tracking state. (from what i understood from the documentation the conversion MUST not be used when tracking is bad)

Screenshot_20230203-191010