Hi jinja, thanks for the help I already tried with the fixed point but it still get me the wrong value Are there something filtering that we can use to filter latitude and longitude ? (except kalman filter) Sory for my bad english
On Fri, Mar 16, 2012 at 12:17 AM, Jinja <neiljmar...@gmail.com> wrote: > Hi Concave, > > Okay, I see that you need to keep the values as x1E6 now. However, you are > still multiplying by 1E6 twice, you only need to do it once. Remove the > *1E6 from the following lines, so.. > > smoothLat = (int) (smoothingCoor [0] * 1E6); > smoothLongi = (int) (smoothingCoor [1] * 1E6); > > becomes... > > smoothLat = (int) (smoothingCoor [0]); > smoothLongi = (int) (smoothingCoor [1]); > > Try stepping through your code in the debugger to reveal if your values > now remain in the correct order of magnitude. Until you've fixed the bug in > your filtering code I recommend you lock the GPS to a known value e.g. > insert this at the top of your function... > > newLocation.setLatitude( 49.28214015975995 ); > newLocation.setLongitude( -123.12438011169434 ); > > That's Vancouver, use some location you will recognize as correct. Once > your filter works then you can remove the fixed location and start using > the GPS values again. > > > > > On Thursday, March 15, 2012 6:58:04 AM UTC-7, concave wrote: >> >> Hi, thanks for all the input >> Right now i still don't have any solution for get the best latitude and >> longitude >> I want to use kalman filter at the first, but after read some paper and >> articles kalman filter is need the value from accelorometer >> Unfortunately my requirement for this application is doesn't use any >> sensor except the gps >> >> @jinja : Hi thanks for the input, but i think it's the right way to get >> the gps value. >> Because i need the int type value to put it on GeoPoint methode and get >> the GeoPoint to animateTo (). >> >> >> On Tue, Mar 13, 2012 at 1:47 PM, Yaron Reinharts < >> yaron.reinha...@gmail.com> wrote: >> >>> Hi, >>> >>> There is a section with the title "Maintaining a current best estimate" >>> in the following link, it contains an implementation of a method called " >>> isBetterLocation". >>> http://developer.android.com/**guide/topics/location/** >>> obtaining-user-location.html<http://developer.android.com/guide/topics/location/obtaining-user-location.html> >>> >>> Hope this helps >>> /Yaron >>> >>> -- >>> Yaron Reinharts >>> Smart Drive Applicationshttp://www.poncho.co.il/**gateaway.php >>> <http://www.poncho.co.il/gateaway.php>https://market.android.com/**details?id=com.poncho.gsm.**gate.activities >>> <https://market.android.com/details?id=com.poncho.gsm.gate.activities> >>> >>> >>> >>> On 03/13/2012 05:32 AM, Jinja wrote: >>> >>> Hello, I've never dealt with GPS data before, but having a quick look at >>> your code it looks like you have a mismatch in converting your data to and >>> from integers and doubles. >>> >>> I notice you multiply by 1E6 when extracting the lat/long, presumably >>> this is to maintain some accuracy during the double to int conversion... >>> >>> int lat = (int) (currentPosition.getLatitude()*****1E6); >>> >>> So one fix is to use all doubles and remove all of your *1E6. The >>> other fix is to use /1E6 instead of *1E6 when converting back to doubles... >>> >>> currentPosition.**setLatitude(**smoothingCoor [0] / 1E6); >>> >>> instead of... >>> >>> smoothLat = (int) (smoothingCoor [0] * 1E6); >>> currentPosition.**setLatitude(**smoothLat); >>> >>> I hope that fixes your issue. >>> >>> >>> >>> On Sunday, March 11, 2012 12:46:24 AM UTC-8, concave wrote: >>>> >>>> Hi guys, i've a little problem here. >>>> I'm working with gps data, getting values every second and displaying >>>> current position on a map. >>>> The problem is that sometimes (specially when im using the app on >>>> indoor and not make a move) the values vary a lot, making the current >>>> position to change. >>>> I was wondering about some easy enough method to avoid this. >>>> As a first idea, I thought about discarding values with accuracy >>>> beyond certain threshold, and use Exponential filtering as i use on my >>>> Bearing. But i get up on Antartica. Here's the code that i used to get >>>> the location and filtering it with exponential : >>>> >>>> public void onLocationChanged(Location newLocation) { >>>> // Get previous Location, needed to get >>>> the Bearing Value >>>> **** if(currentPosition != null) >>>> **** { >>>> **** prevLocation = >>>> currentPosition; >>>> **** pLat = (int) >>>> (prevLocation.getLatitude() *1E6); >>>> **** pLongi = (int) >>>> (prevLocation.getLongitude()***1**E6); >>>> >>>> **** } >>>> **** currentPosition = new Location >>>> (newLocation); >>>> **** int lat = (int) >>>> (currentPosition.getLatitude()*****1E6); >>>> **** int longi = (int) >>>> (currentPosition.getLongitude(****)*1E6); >>>> >>>> **** //Smoothing Latitude,Longitude >>>> **** if(lat != 0 && longi != 0){ >>>> **** coor[0] = lat; >>>> **** coor[1] = longi; >>>> **** if (smoothingCoor == >>>> null){ >>>> **** **smoothingCoo**r >>>> = coor; >>>> **** } >>>> **** for (i=0; >>>> i<coor.length;i++){ >>>> **** >>>> **smoo**thingCoor[i] >>>> = smoothingCoor [i] +alpha * (coor[i] - >>>> smoothingCoor[i]); >>>> **** } >>>> **** smoothLat = (int) >>>> (smoothingCoor [0] * 1E6); >>>> **** smoothLongi = >>>> (int) (smoothingCoor [1] * 1E6); >>>> >>>> **** >>>> currentPosition.**setL**atitude(smoothLat); >>>> >>>> **** >>>> currentPosition.**setL**ongitude(smoothLongi); >>>> >>>> **** } >>>> >>>> **** // Get Bearing Value >>>> **** if(prevLocation != null && >>>> currentPosition != null){ >>>> >>>> **** bearing = prevLocation.bearingTo(** >>>> current**Position); >>>> >>>> **** //Smoothing bearing value with >>>> exponential >>>> **** if (smoothingBearing == 0) >>>> { >>>> **smoothingBear**ing = bearing; >>>> **** } else { >>>> **smoothingBear**ing = >>>> smoothingBearing +alpha * (bearing - >>>> smoothingBearing); >>>> } >>>> >>>> **** } >>>> >>>> Hope you can understand my explanataion, and i provide enough >>>> information >>>> Thanks >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@** >>> googlegroups.com <android-developers@googlegroups.com> >>> To unsubscribe from this group, send email to >>> android-developers+**unsubscr...@googlegroups.com<android-developers+unsubscr...@googlegroups.com> >>> For more options, visit this group at >>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@** >>> googlegroups.com <android-developers@googlegroups.com> >>> To unsubscribe from this group, send email to >>> android-developers+**unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>> For more options, visit this group at >>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>> >> >> > On Thursday, March 15, 2012 6:58:04 AM UTC-7, concave wrote: >> >> Hi, thanks for all the input >> Right now i still don't have any solution for get the best latitude and >> longitude >> I want to use kalman filter at the first, but after read some paper and >> articles kalman filter is need the value from accelorometer >> Unfortunately my requirement for this application is doesn't use any >> sensor except the gps >> >> @jinja : Hi thanks for the input, but i think it's the right way to get >> the gps value. >> Because i need the int type value to put it on GeoPoint methode and get >> the GeoPoint to animateTo (). >> >> >> On Tue, Mar 13, 2012 at 1:47 PM, Yaron Reinharts < >> yaron.reinha...@gmail.com> wrote: >> >>> Hi, >>> >>> There is a section with the title "Maintaining a current best estimate" >>> in the following link, it contains an implementation of a method called " >>> isBetterLocation". >>> http://developer.android.com/**guide/topics/location/** >>> obtaining-user-location.html<http://developer.android.com/guide/topics/location/obtaining-user-location.html> >>> >>> Hope this helps >>> /Yaron >>> >>> -- >>> Yaron Reinharts >>> Smart Drive Applicationshttp://www.poncho.co.il/**gateaway.php >>> <http://www.poncho.co.il/gateaway.php>https://market.android.com/**details?id=com.poncho.gsm.**gate.activities >>> <https://market.android.com/details?id=com.poncho.gsm.gate.activities> >>> >>> >>> >>> On 03/13/2012 05:32 AM, Jinja wrote: >>> >>> Hello, I've never dealt with GPS data before, but having a quick look at >>> your code it looks like you have a mismatch in converting your data to and >>> from integers and doubles. >>> >>> I notice you multiply by 1E6 when extracting the lat/long, presumably >>> this is to maintain some accuracy during the double to int conversion... >>> >>> int lat = (int) (currentPosition.getLatitude()*****1E6); >>> >>> So one fix is to use all doubles and remove all of your *1E6. The >>> other fix is to use /1E6 instead of *1E6 when converting back to doubles... >>> >>> currentPosition.**setLatitude(**smoothingCoor [0] / 1E6); >>> >>> instead of... >>> >>> smoothLat = (int) (smoothingCoor [0] * 1E6); >>> currentPosition.**setLatitude(**smoothLat); >>> >>> I hope that fixes your issue. >>> >>> >>> >>> On Sunday, March 11, 2012 12:46:24 AM UTC-8, concave wrote: >>>> >>>> Hi guys, i've a little problem here. >>>> I'm working with gps data, getting values every second and displaying >>>> current position on a map. >>>> The problem is that sometimes (specially when im using the app on >>>> indoor and not make a move) the values vary a lot, making the current >>>> position to change. >>>> I was wondering about some easy enough method to avoid this. >>>> As a first idea, I thought about discarding values with accuracy >>>> beyond certain threshold, and use Exponential filtering as i use on my >>>> Bearing. But i get up on Antartica. Here's the code that i used to get >>>> the location and filtering it with exponential : >>>> >>>> public void onLocationChanged(Location newLocation) { >>>> // Get previous Location, needed to get >>>> the Bearing Value >>>> **** if(currentPosition != null) >>>> **** { >>>> **** prevLocation = >>>> currentPosition; >>>> **** pLat = (int) >>>> (prevLocation.getLatitude() *1E6); >>>> **** pLongi = (int) >>>> (prevLocation.getLongitude()***1**E6); >>>> >>>> **** } >>>> **** currentPosition = new Location >>>> (newLocation); >>>> **** int lat = (int) >>>> (currentPosition.getLatitude()*****1E6); >>>> **** int longi = (int) >>>> (currentPosition.getLongitude(****)*1E6); >>>> >>>> **** //Smoothing Latitude,Longitude >>>> **** if(lat != 0 && longi != 0){ >>>> **** coor[0] = lat; >>>> **** coor[1] = longi; >>>> **** if (smoothingCoor == >>>> null){ >>>> **** **smoothingCoo**r >>>> = coor; >>>> **** } >>>> **** for (i=0; >>>> i<coor.length;i++){ >>>> **** >>>> **smoo**thingCoor[i] >>>> = smoothingCoor [i] +alpha * (coor[i] - >>>> smoothingCoor[i]); >>>> **** } >>>> **** smoothLat = (int) >>>> (smoothingCoor [0] * 1E6); >>>> **** smoothLongi = >>>> (int) (smoothingCoor [1] * 1E6); >>>> >>>> **** >>>> currentPosition.**setL**atitude(smoothLat); >>>> >>>> **** >>>> currentPosition.**setL**ongitude(smoothLongi); >>>> >>>> **** } >>>> >>>> **** // Get Bearing Value >>>> **** if(prevLocation != null && >>>> currentPosition != null){ >>>> >>>> **** bearing = prevLocation.bearingTo(** >>>> current**Position); >>>> >>>> **** //Smoothing bearing value with >>>> exponential >>>> **** if (smoothingBearing == 0) >>>> { >>>> **smoothingBear**ing = bearing; >>>> **** } else { >>>> **smoothingBear**ing = >>>> smoothingBearing +alpha * (bearing - >>>> smoothingBearing); >>>> } >>>> >>>> **** } >>>> >>>> Hope you can understand my explanataion, and i provide enough >>>> information >>>> Thanks >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@** >>> googlegroups.com <android-developers@googlegroups.com> >>> To unsubscribe from this group, send email to >>> android-developers+**unsubscr...@googlegroups.com<android-developers+unsubscr...@googlegroups.com> >>> For more options, visit this group at >>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@** >>> googlegroups.com <android-developers@googlegroups.com> >>> To unsubscribe from this group, send email to >>> android-developers+**unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >>> For more options, visit this group at >>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>> >> >> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en