simon-heinen / droidar

DroidAR Mobile Locationbased Augmented Reality Framework for Android
GNU General Public License v3.0
225 stars 274 forks source link

Behaviour Not As Expected #14

Open ThreeMarks opened 11 years ago

ThreeMarks commented 11 years ago

I've spawned an arrow object at a gps location. I have also used a location listener to move the GLCamera around using the current GPS location of the device.

What I'd expect is for the arrow to remain where it is, and for the camera to "see" the object as I move around it.

However, what I get is the object seemingly remaining in the same position relative to the camera, and therefore I am unable to "move around" my arrow,

Here is the code I am using:

        @Override
        public void addObjectsTo(GL1Renderer renderer, World world,
                GLFactory objectFactory) {
            GeoObj locationObject = EventManager.getInstance().getCurrentLocationObject();

            if (locationObject != null) {                   
                double latitude = 54.62614;
                double longitude = -1.28055;
                double altitude = 0;

                GeoObj geoObj = new GeoObj(latitude, longitude, altitude);
                MeshComponent arrow = objectFactory.newArrow();

                geoObj.setComp(arrow);

                world.add(geoObj);
            }
        }

        @Override
        public void _c_addActionsToEvents(EventManager eventManager,
                CustomGLSurfaceView arView, SystemUpdater updater) {
            super._c_addActionsToEvents(eventManager, arView, updater);
            eventManager.addOnLocationChangedAction(new LocationEventListener() {

                    @Override
                    public boolean onLocationChanged(Location location) {
                        GeoObj locationObject = new GeoObj(location.getLatitude(), location.getLongitude(), location.getAltitude());                            
                        camera.setGpsPos(locationObject);

                        return true;
                    }
                });
        }
    });     
simon-heinen commented 11 years ago

here are some things you should think about/check:

ThreeMarks commented 11 years ago

I see the arrow fine, once I adjust the camera Z distance using the up/down buttons on the DefaultARSetup.

What I'm not achieving, is the movement of the arrow object in the screen as I move the tablet around.

For example, I place an object at a gps location such that it's placed in the middle of a field. When I walk around the field with my tablet and my camera pointing at the field, my object moves across the screen such that it seemingly remains in the same place.

simon-heinen commented 11 years ago
ThreeMarks commented 11 years ago

Here is a dump of my logcat. It seems that the location is changing and I note that the arrow drifts slightly when I use the DefualtSetup.

11-09 13:30:27.432: D/SimpleLocationManager(13586): Step detected 11-09 13:30:27.432: D/SimpleLocationManager(13586): > compassAngle=210.44808959960938 11-09 13:30:27.432: D/SimpleLocationManager(13586): > distance=0.9 11-09 13:30:27.432: I/SimpleLocationManager(13586): location.getAccuracy()=5.893334 11-09 13:30:27.432: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:27.440: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625988,-1.280576 acc=5 t=?!? et=?!? alt=25.89673641392293] 11-09 13:30:27.440: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:27.440: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625992,-1.280577 acc=4 t=?!? et=?!? alt=21.58001135540342] 11-09 13:30:27.440: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:27.440: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625990,-1.280578 acc=3 t=?!? et=?!? alt=17.263349135264487] 11-09 13:30:27.448: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:27.448: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625989,-1.280580 acc=3 t=?!? et=?!? alt=12.947036274612591] 11-09 13:30:28.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:28.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625991,-1.280580 acc=3 t=?!? et=?!? alt=12.946460538337655] 11-09 13:30:29.448: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:29.448: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625991,-1.280581 acc=3 t=?!? et=?!? alt=17.26171803854579] 11-09 13:30:30.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:30.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625991,-1.280584 acc=4 t=?!? et=?!? alt=21.576667205915005] 11-09 13:30:31.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:31.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625993,-1.280587 acc=4 t=?!? et=?!? alt=25.891230919646055] 11-09 13:30:32.409: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:32.417: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625996,-1.280591 acc=4 t=?!? et=?!? alt=30.2054817926771] 11-09 13:30:33.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:33.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625997,-1.280591 acc=4 t=?!? et=?!? alt=30.203695922609494] 11-09 13:30:34.417: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:34.417: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625998,-1.280593 acc=4 t=?!? et=?!? alt=34.517255935611] 11-09 13:30:35.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:35.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626000,-1.280593 acc=5 t=?!? et=?!? alt=38.830484062602146] 11-09 13:30:36.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:36.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625997,-1.280593 acc=5 t=?!? et=?!? alt=43.14324625270054] 11-09 13:30:37.409: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:37.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625994,-1.280591 acc=5 t=?!? et=?!? alt=47.45552842268653] 11-09 13:30:38.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:38.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625992,-1.280590 acc=5 t=?!? et=?!? alt=47.451752041332156] 11-09 13:30:39.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:39.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.625994,-1.280591 acc=6 t=?!? et=?!? alt=51.76274524504145] 11-09 13:30:40.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:40.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626004,-1.280590 acc=6 t=?!? et=?!? alt=56.073031608051295] 11-09 13:30:41.409: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:41.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626013,-1.280588 acc=6 t=?!? et=?!? alt=60.382536370560935] 11-09 13:30:42.401: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:42.401: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626027,-1.280584 acc=6 t=?!? et=?!? alt=64.69122996487143] 11-09 13:30:43.409: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:43.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626023,-1.280582 acc=6 t=?!? et=?!? alt=64.68368413427795] 11-09 13:30:44.425: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:44.432: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626020,-1.280581 acc=6 t=?!? et=?!? alt=64.67524988182812] 11-09 13:30:45.440: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:45.440: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626022,-1.280580 acc=6 t=?!? et=?!? alt=64.66614749444715] 11-09 13:30:46.425: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:46.432: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626020,-1.280578 acc=6 t=?!? et=?!? alt=64.65642337542732] 11-09 13:30:47.409: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:47.409: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626017,-1.280577 acc=6 t=?!? et=?!? alt=64.64600072304742] 11-09 13:30:48.393: D/ConcreteSimpleLocationManager(13586): Calculating average of 15 locations 11-09 13:30:48.393: D/ConcreteSimpleLocationManager(13586): Average is: Location[AveragePosition 54.626015,-1.280575 acc=6 t=?!? et=?!? alt=64.63492614757581]

ThreeMarks commented 11 years ago

I've also noted that, when trying to move with the touch event, the objects disappear completely. Both in the DroidAR examples and in my own test projects.

simon-heinen commented 11 years ago

Well if the camera moves then its working correctly ;) I added now a small helper method and you now can reduce the location buffering effect with the EventManager.getInstance().setMaxNrOfBufferedLocations() method (default is 16, see the java doc of this method)

bcaudell95 commented 7 years ago

@ThreeMarks I'm having the same sort of problem you seem to be describing here. I build a scene of several GeoObj's and try to "walk around them", expecting my view of them to change. They should remain roughly in-place in the virtual 3d scene, with the virtual camera moving around them. What I see instead, though, is the objects moving themselves to stay in the same position RELATIVE to the camera, meaning my view of them is roughly fixed throughout execution.

When I turn the phone, at first it seems to turn the camera in the scene, but then gradually the objects sort of "swing" back to the same relative positions they started in.

This doesn't seem like intuitive behavior to me either; did you ever find a solution?

simon-heinen commented 7 years ago

@bcaudell95 this "swinging back" is often because the sensors are not calibrated / need to be recalibrated, see https://support.google.com/maps/answer/6145351?hl=en