CMPedometer not counting floors

I'm not getting any values from the floorsAscended or floorsDescended properties of CMPedometerData. I tested it by walking up and down a flight of stairs twice while monitoring for pedometer updates for 60 seconds. I also queried for the pedometer data separately at the end of the time period in case there were any updates I missed.

I'm using an iPhone 13 pro for my tests and I did check to make sure CMPedometer.isFloorCountingAvailable() is true, and I am getting other kinds of pedometer data such as distance, pace, and steps.

Is there something else I need to do in order to enable floor counting?

Thanks, Frank

According to this, "A single floor has a height of approximately three meters". So that would make me think that anything falling under that tolerance is ignored. This is also approximatley the limitation of the GPS data itself and I think it is less accurate vertically. My brother and I walk about 10-12 miles a day on vacation and my phone always gives me more credit than his despite no real difference in where we go. I'm not exactly sure why. I do tend to do the navigating and he mostly keeps his in his pocket. I think the data can only be used to track your own relative performance than be accurate enough to compare to others. If Apple's Fitness app isn't picking up the difference either, I'd say it's just a limitation. It wouldn't surprise me if you went one floor and didn't get credit for it but two floor and got credit for both as that would form a trend over two points.

Thanks for the response. This is certainly a disappointment. My goal is to count the number of floors a person can climb or descend within a time limit such as one minute. I was assuming that the pedometer would be able to give me fractional values instead of just whole numbers of floors.

I was also under the impression that these functions use the motion sensor rather than GPS to figure out what the person is doing.

Is there another way I can accomplish my goal? If I know that the person is climbing stairs, can I just use the step counter?

Frank

For direction and distance, it needs GPS data in this case. And that accuracy is largely outside of Apple's control. It's looking for two points for a direction vector and if the second is within three meters of the first, it's only seeing the one point. Yes, while it might not work for one flight, as long as you get data to establish the user is climbing or descending, you could extrapolate what the step data means. The API uses this to determine if the user is taking the steps or using an elevator. You could also take the start and end GPS data directly and apply your own analysis of what is occurring between these points. But this 3 meter accuracy will still be an issue. The device is capable of obtaining a more accurate picture of its surroundings but then that's not really practical for your case. You probably don't want the user to start their exercise by doing a room scan. It's the old trade off of speed/accuracy/convenience. I'd try to determine how sensitive it really is by looking at the raw GPS data. You might get by with some trick like having the user press start with the device on the floor. Or just explaining to the user the need to move further or otherwise show them when they hit a new GPS point to qualify them.

CMPedometer not counting floors
 
 
Q