2016년 12월 5일 월요일

Navigation


i would use the location sensor for a specific way of "navigation". My wish is that i can pass a specific house and then the aplication ring. My Problem is that this isnt work as i wish...
How can i make this?
- Variables 
- Coordinates
- Compare the Coordinates
...
I ve just started to make this kind of aplication.
But there is another problem. I can pass the house near or far and doesnt pass the coordinates i ve written...
Thanks for help!



-- 
I think the problem here is that you are testing for an EXACT match on longitude and latitude.
That is very unlikely to happen unless you are standing at the exact spot where the measurement was originally taken.
A better approach might be to use a range of acceptable values.

So rather than doing
   get longitude =  -93.1256 and ...

Try something like

  get longitude >= -93.1255 and longitude <= -93.1257 ...

And adjust those values  so that a match is detected within an acceptable range.

Do the same for latitude.

-- 
is the rest so fine (picture)

-- 
I did it just like you said...
But it is still lacking :-(
Now he isnt looking for even GPS.
What he had done before. Whats wrong? How it works with the App Inventor navigations aplication?
Please help me :-)

-- 

Thats what i ve make...

-- 
To understand how the LocationSensor works  please read this article and do the two Projects 

Exploring with Location Sensor in AI2


The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device.  The sensor can also work with network/wifi location services.  Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.

Your simple app does not work for a variety of reasons:
1) You initially tried to find an exact latitude and longitude ...Scott explained why that does not work.
2)  A property of the LocationSensor called Accuracy (explained in the tutorial).  When you read the tutorial it explains that the GPS frequently does not know exactly where the Android is with any precision.
3) Your present code is an attempt to create a ring-fence; determining whether the device is within that fence is problematical.  The app might not be working for a variety of reasons depending on how often you program the LS to get a satellite fix or you are located South or North of the equator or to the West or East of the Prime Meridian (that affects how you set up your logic blocks) ..and you obscured the most important part of your geocoordinates. Also, the TTS code might be creating an issue with timing...AI2 is event driven,
4) Other things can go wrong:   Does your device have a GPS receiver?   If it does not and you depend on network, Accuracy is terrible .   Do you use the most accurate geolocation method   Provider = gps   and then lock it or do you use no settings and let the LS select what method it wants to use?  Do you see the GPS icon flashing occassionally at the top of your device screen..that shows the GPS receiver is trying to obtain a satellite fix.
5) the GPS receiver itself in many devices is not very precise, unless you monitor Accuracy continually, you will never know whether the GPS has a poor or very good satellite fix.

When finished with the LS tutorial perhaps read and do this tutorial 

AI2 Static Maps 104…calculate distances between points and add an Accuracy Square  

The Maps 104 tutorial describes Accuracy in a different way than the LS tutorial.

There are several solutions to your original problem, knowing when you arrive at a particular location.
Solutions include:
1) Making a ring-fence.   The following shows how to use a ring-fence properly http://www.appinventor.org/bookChapters/chapter18.pdf  in the section called Programming Complex Conditions
2) Using the LS DistanceInterval property to determine how close your device is to a certain point  (google the forum for a discussion that mentioned   Halte Alarm ..Christophe solved his problem that way.  DistanceInterval is discussed in the LS tutorial
3) Calculate the distance from the Android's current location to the desired location every minute or so, when the distance is small, you are there  (the second tutorial demonstrates several ways to calculate distance).  You will have to write code to poll the calculation.
4) You can use a Google Static map to display both the location you are interested in and the Android location  so you can see on a map ..look at the tutorials here https://appinventorforfun.wordpress.com/tag/mapping/ 
5) When all else fails look at a paper map, phone the residents of the house and ask them if they see your Android outside perhaps?

Hope this helps Nico.  When a developer realizes the GPS in phones is basically stupid, he/she can program around the device's limitations when he understands how the hardware and software tools work.

-- 
I have used the first option with the ring fence. It works but not perfect...
In the first picture i show wich coordinates i used. If this were the house i search and cross the street by the house the phone must be ring.
The black points are my coordinates...
Then i look wich coordinate is higher an place them into the field (second picture)



Must the fence be smaller?

-- 
It MAY work, but the problem is that you have a loop in your code. The code will make tts talk over and over again as long as you are in that are.

I have an app that will be releasing in the market next week with MANY gps features.

-- 
Without seeing the interval of your ring fence, I cannot comment as to whether the ring-fence should be smaller or not. See below-you will have to experiment with how small the box you monitor is to get the best results. From the points on the map, it appears the box is fairly small, possibly it actually needs to be larger ...experiment.

The area you are in has tall buildings.  Using your GPS there is like using the GPS in a canyon.  Buildings are probably preventing your GPS from getting a satellite fix with a lot of satellites.  When very few satellites are used in a 'fix', the Accuracy value increases dramatically.  It is easily possible your GPS reports a location that is as much as 50 meters away from where the GPS says it is.   Are you monitoring the Accuracy?  You read about it in the links provided.  If you monitor accuracy, you can eliminate geocoordinate readings that are more than say 5 or 10 meters distant from the true location. 

You read the LocationSensor tutorial, you recall that the metric way of looking at   0.00001 of a degree of latitude is that 0.00001 deg converts  to 0.9144 meters. The measurement tells us, satellite positional information can be reported is to a precision of 0.9 meters.  The satellites report positional data using five decimal place precision.  Does this mean that when a GPS gets a fix on multiple satellites that the smallest distance resolved should be 0.9144 meters?  No.  For other reasons, the best accuracy possible with specialized GPS receivers is on the order of  three  meters.  

Depending on how frequently you update the LocationSensor, Hossein's comment might be correct.   The TTS can interfere with the LocationChanged depending on timings. I would put the TTS in a separate block that controls how often the LocationSensor is updated.

Is it possible to do what you want, getting the phone to vibrate or the TTS to speak.  The high buildings means the Accuracy is going to probably be a large value.

-- 

댓글 없음:

댓글 쓰기