compass-geolocation

Use native iOS compass within an app

こ雲淡風輕ζ 提交于 2019-11-30 11:47:28
Is it possible to use the native compass that iOS has within my own application? Or do I need to draw and animate my own compass? Keller There is no native compass UIView . In order to use the magnetometer, you'll have to use CoreLocation and the following delegate method: - (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading to rotate a UIView to point North (bearingView is a UIImageView): float heading = newHeading.magneticHeading; //in degrees float headingDegrees = (heading*M_PI/180); //assuming needle points to top of iphone. convert to radians

Android: Problems calculating the Orientation of the Device

送分小仙女□ 提交于 2019-11-30 07:20:35
i'am trying to build a simple Augmented Reality App, so I start working with sensor Data. According to this thread ( Android compass example ) and example ( http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html ), the calculation of the orientation using the Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD doesn't really fit. So I'm not able to get "good" values. The azimut values doesn't make any sense at all, so if I just move the Phone upside the value changes extremly. Even if I just rotate the phone, the values doesn't represent the phones orientation. Has

Compass give me crazy data, is calibration needed or it's the sensor broken?

对着背影说爱祢 提交于 2019-11-29 09:27:21
I'm working with android sensor data. My application use SensorManager.getRotationMatrixFromVector( mRotationMatrix , event.values); and it has been working well until this morning, when the rotation matrix started to send a lot of noise data (Change N to W in a second). It's not a problem with my code, because on friday was working and no changes have been done. I have used a compass app from the market, and the compass is giving random data. I have tested my app on another tablet, and it is working well. Does someone know why is this happening? A problem with the sensor? Does it need a

Android compass example

本秂侑毒 提交于 2019-11-28 19:44:49
I'm searching for a compass example for Android. All I need to do is to get the correct bearing (in portrait & landscape mode). I already found several samples, some use only Sensor.TYPE_ORIENTATION , some use a combination of Sensor.TYPE_ACCELEROMETER & Sensor.TYPE_MAGNETIC_FIELD . Which is the correct & common way to get the bearing for let's say Android 1.6 - 4.0? Dan Sensor.TYPE_ORIENTATION is deprecated. The documentation says you should use SensorManager.getOrientation() instead. So you should read from Sensor.TYPE_ACCELEROMETER as well as from Sensor.TYPE_MAGNETIC_FIELD , and then call

Sensor Fusion on iOS Devices

北城以北 提交于 2019-11-28 19:19:10
问题 I'm trying to find out how could I start to implement sensor fusion on the iPhone. I've started from this talk from David Sachs: Sensor Fusion on Android Devices Although David's talk is very illustrative, it doesn't show any code (it makes sense). I've seen both the GLGravity (to extract the gravity vector) and the AccelerometerGraph examples, but I need some help or at least guidance on how to combine the accelerometer, gyroscope and compass inputs so that the result is similar to what

Android Compass orientation on unreliable (Low pass filter)

拈花ヽ惹草 提交于 2019-11-28 17:06:23
Im creating an application where i need to position a ImageView depending on the Orientation of the device. I use the values from a MagneticField and Accelerometer Sensors to calculate the device orientation with SensorManager.getRotationMatrix(rotationMatrix, null, accelerometerValues, magneticFieldValues) SensorManager.getOrientation(rotationMatrix, values); double degrees = Math.toDegrees(values[0]); My problem is that the positioning of the ImageView is very sensitive to changes in the orientation. Making the imageview constantly jumping around the screen. (because the degrees change) I

How to get Direction in Android (Such as North, West)

随声附和 提交于 2019-11-28 11:23:57
I am new in Android and i want to get direction according to my camera. How can I get direction information according to my camera? Could you give an idea for this? TYPE_ORIENTATION is deprecated We cannot use the Orientation Sensor anymore, we can use the Magnetic Field Sensor and Accelerometer Sensors in tandem to get equivalent functionality. It's more work but it does allow to continue to use a callback to handle orientation changes. Here is a compass sample : http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html Conversion from accelerometer and magnetic field to

Using orientation sensor to point towards a specific location

霸气de小男生 提交于 2019-11-28 06:04:30
I'm trying to implement an arrow that uses the orientation sensor in order to point towards a specific location. Google Places implements this arrow in a ListView for each place it finds. I've managed to get the azimuth, but given a location, I don't know how to proceed to calculate the angle I need. Moreover, I need to make the conversions from real north and magnetic north. Does anybody have an example of such implementation? Thanks in advance. I solved it. float azimuth = // get azimuth from the orientation sensor (it's quite simple) Location currentLoc = // get location from GPS or network

android compass seems unreliable

自作多情 提交于 2019-11-28 05:08:08
I have been working on a small compass app the past couple of days, and have gotten the code up and running, but it seems that the compass reading is not accurate. After calibrating both phones, my first test that i found this in what that i simply held the phone against and flat surface looked at the reading then flipped it horizontally and put it against the same flat surface (a 180* turn) and the value did not change 180* it was closer to 240*. I then tested the reading vs a compass, at times the reading seemed to be close but at other points it was more than 50* off. I even tried to put my

How to make an accurate compass on android

两盒软妹~` 提交于 2019-11-28 03:29:54
my android application shows the direction of a particular place in the world and therefore in needs to get the compass degree. This is the code I've been using to calculate the degrees: public void getDirection() { mySensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); List<Sensor> mySensors = mySensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if(mySensors.size() > 0){ mySensorManager.registerListener(mySensorEventListener, mySensors.get(0), SensorManager.SENSOR_DELAY_UI); } else{ TextView alert = (TextView)findViewById(R.id.instruct); alert.setText(getString(R.string