iOS CMMotionActivity Manager, how to detect stop signs when the car is stop?

半世苍凉 提交于 2019-12-13 19:02:01

问题


I am working on a project for detecting the user's current motion, and I use the CMMotionActivityManager with these motions includes 'Stationary', 'Walking', 'Automotive', 'Running'. Now there is a requirements for I need to know the location when people parked the car. But the thing is, I only need the location when people parked at last. How to eliminate the influence of the stop signs. Because people always stop when they are driving.

If the car is stopped, then the status will be 'stationary,1,walking,0,running,0,automotive,1,cycling,0'

If the car is in the automotive motion, the status: 'stationary,0,walking,0,running,0,automotive,1,cycling,0'

If the car is in the stationary motion: 'stationary,1,walking,0,running,0,automotive,0,cycling,0'

This is part of the code :

     if (activity.automotive && activity.stationary) {
    //stop signs status
    }
    if (activity.automotive && !activity.stationary) {
    //automotive                      
    }        
    if (!activity.automotive && activity.stationary && activity.confidence == CMMotionActivityConfidenceHigh) {
    //stationary with a high confidence
    }

But the system just cannot be that sensitive, it cannot determine if the user is stopped for a stop sign or finally parked. Since it is not sensitive enough, I do not know how to elevate the accuracy of detecting if people finally stopped the car.


回答1:


A method of signalling when a car is parked could be based off the users next action. Having automotive true and stationary true will tell you that the vehicle has stopped. The subsequent action will tell you what they do next. In the case of a stop sign the next action is to drive off so automotive would be true and stationary false. In the case of parking the user may leave the car and move on foot, so it would be automotive false and walking true.



来源:https://stackoverflow.com/questions/35790497/ios-cmmotionactivity-manager-how-to-detect-stop-signs-when-the-car-is-stop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!