How to get the user's location using the accelerometer, gryoscope and magnetometer in iPhone?

A simple equation for a user's location using the built-in inertia measurement unit (IMU), also called Walking Dead Calculation (PDR), is represented as:

x= x(previous)+step length * sin(heading direction)
y= y(previous)+step length *cos(heading direction )

We can use the motionManager property of the class CMMotionManagerto access the initial values ​​from the accelerometer, gyroscope and magnetometer. In addition, we can get values attitudeslike roll, pitch and yaw. The step length can be calculated as the double square root of the acceleration. However, the course direction confuses me. Some of the published literature used a combination of magnetometer and gyroscope data to estimate course direction. I see that CLHeadingalso provides header information. There are some online tutorials available to evaluate a user's location, especially for the Android platform, such as this . However, he does not give the correct mathematical explanation.

I followed many online resources such as this , this , this and this to create a PDR application. My application can detect steps and gives the step length properly, however its output is filled with errors. I think the mistake is due to the lack of the right course direction. I used the following relation to get the direction from the magnetometer.

magnetometerHeading = atan2(-self.motionManager.magnetometerData.magneticField.y, self.motionManager.magnetometerData.magneticField.x);

Similarly, from a gyroscope:

grysocopeHeading +=-self.motionManager.gyroData.rotationRate.z*180/M_PI;

Finally, I give proportional weight to the previous heading of the heading, grioskung and magnetometer. We say as follows:

headingDriection = (2*headingDirection/5)+(magnetometerHeading/5)+(2*gryospoceHeading/5);

. , . ? , , ?

.

.

, ( /) -. :

CMDeviceMotion *motion = self.motionManager.deviceMotion; [_motionManager startDeviceMotionUpdates]; if(!previousTime) previousTime = motion.timestamp; double deltaTime = motion.timestamp - previousTime; previousTime = motion.timestamp;

:

gyroscopeHeading+= -self.motionManager.gryoData.rotationRate.z*deltaTime*180/M_PI;

. ?

+6

All Articles