![]() ![]() Just let the handler onSensorChanged() coded with a conditional, and start a thread on the onCreate() handler, which will set a boolean to true, after some seconds. ![]() Because not everybody says that the compass is calibrated as shown in this video: and obviously you can not do anything else than advise the user to calibrate before using the program or when you get too much changes.įor example going left and right 90 degrees in about 25 ms.Īnyway I think it's good to give some seconds to the app before start taking data, because it gives some unstable values (too high and low in short time without movement) at the app loading moment. I think the question was if calibration could be done without sending any data to compass. And if that doesn't do a good job there are lots of algorithms on the web for you to choose from. This means that the sudden changes in the sensor reading are filtered out. You could try apply a low pass filter to the sensor. It should give an accurate reading provided your GPS signal is good.Įxtra 3: Another thought just occurred to me. Looks silly but it does calibrate it properly.Įxtra 2: Would it be possible/practical to use the compass bearing of your GPS? It would require that the device be moving (walking speed should be fine) but you would not need to worry about any interference. Rotate the phone a few times in each axis. go somewhere in the open, like a park or field, away from any potential interference and power lines, (if you have one bring a real compass to check that the GPS status app is pointing the right way), and see if your compass works as you'd expect.Įxtra: The answer from is also important when calibrating. The two devices are interfering with each other. The real compass is now pointing everywhere but magnetic North. Even the magnetic content of nearby rocks can interfere with the compass.Īs a further test I've just placed a real (orienteering) compass over my phone which has a compass app installed. The device's compass is assigning itself with the strongest magnetic field. I found in the past that moving the phone a few inches to the right completely changed its reading. The information is completely unreliable. no filtering).ĭo the calibration (figure of 8 wavy stuff) and then move the phone around your desk. If you stand beside a large lump of metal the compass will be attracted to it and point to it rather than the magnetic north pole. At the end of the day a compass is just a magnet. From electrical equipment interference to the metal structure holding up a building. ![]() There are magnetic fields interfering with the earth's magnetic fields all the time. Instead it could very well be a problem with your environment. I've worked quite a lot with these electronic compasses on mobile phones and its quite possible that there is nothing wrong with your code or sensor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |