简体   繁体   English

从3个轴获得总加速度?

[英]Get total Acceleration from 3 axes?

I get all 3 axes using this 我用这三个轴

timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(Accelerometer) userInfo:nil repeats:YES];
[timer fire];

Edit 编辑

-(void)Accelerometer
{
    float accex1 = motionManager.accelerometerData.acceleration.x;
    float accey1 = motionManager.accelerometerData.acceleration.y;
    float accez1 = motionManager.accelerometerData.acceleration.z;

    float mAccelCurrent1 = sqrtf(pow((accex1 * accex1),2) + pow((accey1 * accey1),2) + pow((accez1 * accez1),2));
    float Acc = fabsf(mAccelCurrent1-Prv_Acceleration);

    Prv_Acceleration = mAccelCurrent1;
    [R1_Changes addObject:[NSString stringWithFormat:@"%f",Acc]];
}

Thanks to Hanno Binder Now i get Accretion. 多亏了Hanno Binder,现在我获得了成长。 Now 现在

Q2. Q2。 How i get total Accretion in 1 Minute or 10 Minute? 我如何在1分钟或10分钟内获得总增生?

Thanks in Advance..... 提前致谢.....

Is what you mean by "total acceleration" perhaps the velocity? 您所说的“总加速度”也许就是速度? If you take every acceleration value and multiply it by the time between the two readings, say every minute as in your example, that would give you an approximation of your velocity (assuming you knew what your starting velocity was). 如果将每个加速度值乘以两个读数之间的时间,例如以您的示例中的每分钟为单位,那么您将获得一个近似的速度(假设您知道起始速度是多少)。

float self.totalAcc = 0.0;  // EDITED HERE
-(void)Accelerometer
{
    float accex1 = motionManager.accelerometerData.acceleration.x;
    float accey1 = motionManager.accelerometerData.acceleration.y;
    float accez1 = motionManager.accelerometerData.acceleration.z;

    float mAccelCurrent1 = sqrtf(pow((accex1 * accex1),2) + pow((accey1 * accey1),2) + pow((accez1 * accez1),2));
    float Acc = fabsf(mAccelCurrent1-Prv_Acceleration);
    totalAcc += (mAccelCurrent1 - prvAcceleration) * timeChange // EDITED HERE
    Prv_Acceleration = mAccelCurrent1;
    [R1_Changes addObject:[NSString stringWithFormat:@"%f",Acc]];
}

Velocity is the time integral of acceleration. 速度是加速度的时间积分。 Not sure how much physics/calculus you've had but you can learn more here: khanAcademy - Integrals 不知道您有多少物理/微积分,但您可以在这里了解更多信息: khanAcademy-积分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM