compass-geolocation

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

霸气de小男生 提交于 2019-11-28 02:56:25
问题 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

Show wind direction on Google Maps

时间秒杀一切 提交于 2019-11-27 19:32:45
I calculated the wind direction and now I want to show the wind direction pointing to 144 degrees (on compass). How can I show this arrow on Google Maps? In order to show an arrow over a google map you can create a Rich Marker that embed an image using the google-maps-utility-library-v3 , Next apply a rotation in degree to the image element with css3 tranformations. In example : // content element of a rich marker var richMarkerContent = document.createElement('div'); // arrow image var arrowImage = new Image(); arrowImage.src = 'http://www.openclipart.org/image/250px/' + 'svg_to_png/Anonymous

Compensating compass lag with the gyroscope on iPhone 4

北慕城南 提交于 2019-11-27 17:05:20
I've been experimenting with the compass and gyroscope on iPhone 4 and would like some help with an issue I'm having. I want to compensate for the slowness of the compass by using data from the gyroscope. Using CMMotionManager and its CMDeviceMotion object ( motionManager.deviceMotion ), I get the CMAttitude object. Correct me if I'm wrong (please), but here is what I've deduced from the CMAttitude object's yaw property (I don't need pitch nor roll for my purposes): yaw ranges from 0 to PI when the phone is pointing downwards (as indicated by deviceMotion.gravity.z ) and swinging

Android compass example

若如初见. 提交于 2019-11-27 12:31:02
问题 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? 回答1: Sensor.TYPE_ORIENTATION is deprecated. The documentation says you should use SensorManager.getOrientation() instead. So

How to rotate a Direction Arrow to particular location

别等时光非礼了梦想. 提交于 2019-11-27 11:58:58
In my app I have a latitude-longitude of 1 fix location. Now user with iPhone device can move anywhere and even he rotate his device, the arrow (some uiimageview) should point to that fix location so User will get direction to that location every time. I tried as follows. -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocationCoordinate2D here = newLocation.coordinate; [self calculateUserAngle:here]; } -(void) calculateUserAngle:(CLLocationCoordinate2D)user { NSLog(@"my destination is %f ; %f",

Get direction (compass) with two longitude/latitude points

核能气质少年 提交于 2019-11-27 11:29:53
I'm working on a "compass" for a mobile-device. I have the following points: point 1 (current location): Latitude = 47.2246, Longitude = 8.8257 point 2 (target location): Latitude = 50.9246, Longitude = 10.2257 Also I have the following information (from my android-phone): The compass-direction in degree, wich bears to the north. For example, when I direct my phone to north, I get 0° How can I create a "compass-like" arrow wich shows me the direction to the point? Is there a mathematic-problem for this? thanks! EDIT: Okay I found a solution, it looks like this: /** * Params: lat1, long1 =>

Android Compass orientation on unreliable (Low pass filter)

拟墨画扇 提交于 2019-11-27 10:11:32
问题 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

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

為{幸葍}努か 提交于 2019-11-27 06:08:36
问题 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? 回答1: 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

android compass seems unreliable

狂风中的少年 提交于 2019-11-27 05:30:20
问题 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

How to make an accurate compass on android

时光总嘲笑我的痴心妄想 提交于 2019-11-27 05:09:00
问题 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