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

Behaviour Not As Expected #14

Open
ThreeMarks opened this issue Nov 9, 2013 · 8 comments
Open

Behaviour Not As Expected #14

ThreeMarks opened this issue Nov 9, 2013 · 8 comments

Comments

@ThreeMarks
Copy link

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
Copy link
Owner

here are some things you should think about/check:

  • the code to create and place the arrow looks fine
  • in the default ar setup the arcamera is already moved automatically by the event manager as soon as it gets gps updates, so you dont have to move it manually
  • use your own additional LocationEventListener only for checking if the event manager realy gets gps updates, so use the log cat and also read the other log outputs the droidar framework does
  • you can simulate gps events using eventManager.onLocationUpdate(..) something like this, i'm not sure if you already do this for your tests
  • finally use the debugger if reading the logcat output does not help. did you also check the existing demo setups? there is one in there where i also manuall set gps positions via the event manager and it works fine for me

@ThreeMarks
Copy link
Author

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
Copy link
Owner

  • does the logcat show any warnings?
  • the virtual camera will only move if the gps signal gives a new position or the step detection registers a new step so check in the log if that works. do you test in an environment where you have a good gps signal?

@ThreeMarks
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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
Copy link

@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
Copy link
Owner

@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

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

3 participants