Hi Miguel, I am working on something similar, although with less of a
focus on the camera, maybe we can combine forces a bit here.  I found
a very smooth filter in the open source code for "Marine Compass" --
check it out in the market, it's one of the smoothest filters out of
the various filtering approaches I have tried.  The source is at:

http://www.pierrox.net/cmsms/open-source/marine-compass-2.html

A search of the google group will also reveal some blog postings about
applying filters as I'm sure you may have seen, do a search for
"orientation" and you may find some more.  The above approach is the
smoothest that I've seen.

You may also find that there is some uncontrollable jitter using the
magnetometer + accelerometer as the pitch of the phone approaches 90
degrees, and it may also behave differently as yaw approaches 90 when
the phone is in landscape mode.  My approach is to hard limit the
pitch so that it does not go beyond a certain amount, but this is not
really ideal and I would love to really be able to get the "skymap"
type experience as well.  I went to a talk by the 2 skymap engineers a
year or 2 ago, and they mentioned difficulties with moving the phone
360 degrees, but unfortunately I cannot recall what they ultimately
wound up doing, and would also love to know.  IIRC one of the things
they said they did was plot data in excel to come up with a response
curve to apply, after taking the dot product of pitch + roll.  Don't
quote me on that though, my memory is hazy on it, and that was also
for 1.5, I'm sure it's been rewritten since..





On Mar 27, 8:20 am, miguel <[email protected]> wrote:
> If it can help, what I have already implemented is something like
> this:
>
> I have a main activity. This activity instanciates 2 services that
> feeds the main activity wih data. One is for the location and one is
> for the sensors.
> The main activity has a frame view holding the surface for the camera
> preview and a customview that holds the radar, the bottom panels (and
> its information) and the POIs.
> For now, the first time the location service catchs a location, the
> main activity gets it and unbinds the service.
> Also, each time the sensor service feeds with data, I pass that
> information down to the views of the hierarchy wich need to update its
> own state.
> I don use any thread and also, I call invalidate after the primary
> onDraw method of the customview. The onDraw method of my customView
> (Its actually called ARView) calls the onDraw method of all of the
> child views.
>
> I use a responsability chain for the POIs view and other for the radar
> points.
>
> My problem is that I dont know if I may have a surface holder, another
> thread to paint the POIs and just them.
> Also I dont know if I should use the timestamp of the sensor events to
> smooth the movement as in the Accelerometer play sample.
>
> So now Im tottally stuck, cannot continue.
> The fact is that, for example, a 40 degrees AR visor in landscape mode
> (ie. 480 px) has 8 px for each degree. That means when I move the
> device one degree, the POI view jumps from 8 to 8 px so the movement
> is not smooth.
> So I started to use float instead of integers and got rid of the
> layout() method, just call for the draw. It gets a bit finer but seems
> to work bad as well.
>
> The Kalman filter I use has:
> p = 0.05f (tried from 0.5 to 0.05) and q = 1-p
> p is for the recieved value and q is for the old state.
>
> That still makes jumps and noise. If I move fast the device, ie 20
> degrees, my POI view directly skips some of the px, just jumps from
> one position to another. Dont know how to fix it. When the device move
> is soft and slow the POI moves (not smooth) but at least does not
> jump.
> I also tried to put a kalman filter to the coordinates in the display
> of the POI view but it doesnt behavie better at all.
>
> So please, any kind of tip? I think that my main problem is that I
> dont know how to apply the rotation matrix to a view.
>
> Regards and thanks for your time. If someone wants the full code, just
> ask.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to