gpt4 book ai didi

ios - Apple Watch 的心率数据非常不准确

转载 作者:行者123 更新时间:2023-11-28 21:09:54 25 4
gpt4 key购买 nike

我有一个 iOS 健身应用,可以从蓝牙胸带收集心率数据。我最近添加了一个 Apple Watch 扩展,并利用 watch 的心率传感器作为胸带的替代品。不幸的是,我发现它非常不准确,以至于基本上没有用。这是一个 3 英里远足的示例,其中红线显示从胸带收集的数据,蓝线显示从 Apple Watch 收集的数据:

watch versus chest strap chart

我可以看出胸带数据是两者中更准确的一个,因为当叠加在海拔数据上时,较高的心率与上坡路段非常接近。 (另外,我不希望我的心率像 Apple Watch 显示的那样从 60 跳到 120 或 110 跳到 160……也不会一次保持相同的值一分钟。)

这是我用来收集 watch 数据的代码。是否有另一种方法来配置它以获得更准确的数据,或者它是否与此硬件一样好?

- (void)startWorkoutSession {
if (self.workoutSession) {
return;
}

// configure a HealthKit workout
HKWorkoutConfiguration *configuration = [[HKWorkoutConfiguration alloc] init];
configuration.activityType = HKWorkoutActivityTypeHiking;
configuration.locationType = HKWorkoutSessionLocationTypeOutdoor;

// start the workout
NSError *error = nil;
self.workoutSession = [[HKWorkoutSession alloc] initWithConfiguration:configuration error:&error];
if (!self.workoutSession) {
//NSLog(@"*** Unable to create the workout session: %@ ***", error.localizedDescription);
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
@"createWorkoutSession", @"error",
error.localizedDescription, @"description",
nil];
[self.iosApp sendMessage:data replyHandler:nil errorHandler:^(NSError * _Nonnull error) {
// maybe show a local alert here?
}];
return;
}
self.workoutSession.delegate = self;
[self.healthStore startWorkoutSession:self.workoutSession];

// update the controls view and show the tracking view
self.controls.status = StatusStarted;
if (![self.activeController isEqual:self.tracking]) {
[self.tracking becomeCurrentPage];
}
}

- (void)workoutSession:(HKWorkoutSession *)workoutSession didChangeToState:(HKWorkoutSessionState)toState fromState:(HKWorkoutSessionState)fromState date:(NSDate *)date {
// required method
if (toState == HKWorkoutSessionStateRunning) {
[self requestHeartRate:date];
}
}

- (void)requestHeartRate:(NSDate *)date {
__weak typeof(self) weakSelf = self;
NSPredicate *predicate = [HKQuery predicateForSamplesWithStartDate:date endDate:nil options:HKQueryOptionNone];
HKSampleType *heartRateType = [HKSampleType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate];
HKAnchoredObjectQuery *query = [[HKAnchoredObjectQuery alloc] initWithType:heartRateType predicate:predicate anchor:0 limit:0 resultsHandler:^(HKAnchoredObjectQuery *query, NSArray<HKSample *> *samples, NSArray<HKDeletedObject *> *deletedObjects, HKQueryAnchor *anchor, NSError *error) {
if ((!error)&&(samples.count > 0)) {
[weakSelf receiveHeartRate:(HKQuantitySample *)[samples objectAtIndex:0]];
} else {
NSLog(@"error with initial heart rate query: %@", error);
}
}];
[query setUpdateHandler:^(HKAnchoredObjectQuery *query, NSArray<HKSample *> *samples, NSArray<HKDeletedObject *> *deletedObjects, HKQueryAnchor *anchor, NSError *error) {
if ((!error)&&(samples.count > 0)) {
[weakSelf receiveHeartRate:(HKQuantitySample *)[samples objectAtIndex:0]];
} else {
NSLog(@"error with updated heart rate query: %@", error);
}
}];
[self.healthStore executeQuery:query];
}

- (void)receiveHeartRate:(HKQuantitySample *)sample {
HKQuantity *quantity = sample.quantity;
int value = (int)[quantity doubleValueForUnit:[HKUnit unitFromString:@"count/min"]];
//NSLog(@"got heart rate %i", value);

// display the heart rate in the tracking view
[self.tracking updateHeartRate:value];
}

更新:

我在看 this comparison chart作为我对 Apple Watch 期望的准确性的指示。现在我意识到这只是将 Apple Watch 与另一个基于 watch (手腕)的传感器进行比较。因此,也许该图表只是表明这两种基于手腕的模型都同样不准确。

这很令人困惑,因为您可以在网上搜索“Apple Watch 心率准确度”并找到很多关于它准确度的故事,但没有人显示像我看到的那样的结果,我认为这很差。

最佳答案

要提高 Apple Watch 上的心率报告频率和准确性,您的应用唯一可以做的就是使用准确的 HKWorkoutActivityType 记录锻炼类(class)。因为看起来你已经在这样做了,所以你应该 file a radar与 Apple 讨论测量的准确性。

关于ios - Apple Watch 的心率数据非常不准确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43990802/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com