Difference between accuracy with location - objective-c

When setting the location , we would like to get the best battery performance, and the least accuracy( but not using the "significant change" )
When setting the manager i do :
self.locationManager.desiredAccuracy =kCLLocationAccuracyThreeKilometers;
Whats the different between :
kCLLocationAccuracyThreeKilometers
kCLLocationAccuracyKilometer
and the rest of them .
as far as i see, even when the device is on the table, both gives me background locations in same frequency, that is every few seconds .

According to Docs
kCLLocationAccuracyThreeKilometers
Accurate to the nearest three kilometers.
kCLLocationAccuracyKilometer
Accurate to the nearest kilometer
Note : It never says about the updating frequency it is the accuracy parameter depending on the range

Related

How to determine when to accelerate and decelerate to reach a given destination?

I'm creating a computer game in which there is a computer-controlled car that needs to travel along a straight line (thus making this problem effectively 1-dimensional) and reach a destination coming to a rest at 0 velocity. This car "thinks" every second and decides whether (and by how much) to accelerate or decelerate.
To summarize, I want the car to accelerate as strongly as possible and then stop as rapidly as possible.
Here are the variables that the car must respect:
- RemainingDistance = Our current remaining distance to the destination in meters.
- Velocity = Our current velocity towards the destination in meters/second.
- MaxVelocity = The maximum speed the car can reach.
- Acceleration = The change in velocity per second. The car can change its acceleration every second to any number in the range [0, Acceleration].
- Deceleration = The change in velocity per second. The car can change its deceleration every second to any number in the range [0, Deceleration].
So to be as clear as I can, here's the math that runs every second to update the car simulation:
Acceleration = some amount between [Deceleration, Acceleration] as chosen by the computer
Velocity = Velocity + Acceleration
RemainingDistance = RemainingDistance - Velocity
So my question is: Every time the car "thinks", what formula(s) should it use to determine the ideal value of Acceleration in order to reach its destination (with a 0 final velocity) in as little time as possible?
(In the event that the car's initial velocity is too high and it can't decelerate fast enough to achieve 0 velocity by the time it reaches its destination, then it should come to a rest as close as possible to the destination.)
Please let me know if you have any questions.

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

The simple equation for user location using inbuilt inertial measurement unit (IMU) which is also called pedestrian dead reckoning (PDR) is given as:
x= x(previous)+step length * sin(heading direction)
y= y(previous)+step length *cos(heading direction )
We can use the motionManager property of CMMotionManager class to access raw values from accelerometer, gyroscope, and magnetometer. Also, we can get attitudes values as roll, pitch, and yaw. The step length can be calculated as the double square root of acceleration. However, I'm confused with the heading direction. Some of the published literature has used a combination of magnetometer and gyroscope data to estimate the heading direction. I can see that CLHeading also gives heading information. There are some online tutorials especially for an android platform like this to estimate user location. However, it does not give any proper mathematical explanation.
I've followed many online resources like this, this,this, and this to make a PDR app. My app can detect the steps and gives the step length properly however its output is full of errors. I think the error is due to the lack of proper heading direction. I've used the following relation to get heading direction from the magnetometer.
magnetometerHeading = atan2(-self.motionManager.magnetometerData.magneticField.y, self.motionManager.magnetometerData.magneticField.x);
Similarly, from gyroscope:
grysocopeHeading +=-self.motionManager.gyroData.rotationRate.z*180/M_PI;
Finally, I give proportional weight to the previous heading driection, gryoscopeheading, and magnetometerHeading as follows:
headingDriection = (2*headingDirection/5)+(magnetometerHeading/5)+(2*gryospoceHeading/5);
I followed this method from a published journal paper. However, I'm getting lots of error in my work. Is my approach wrong? What exactly should I do to get a proper heading direction such that the localization estimation error would be minimum?
Any help would be appreciated.
Thank you.
EDIT
I noticed that while calculating heading direction using gyroscope data, I didn't multiply the rotation rate (which is in radian/sec) with the delta time. For this, I added following code:
CMDeviceMotion *motion = self.motionManager.deviceMotion;
[_motionManager startDeviceMotionUpdates];
if(!previousTime)
previousTime = motion.timestamp;
double deltaTime = motion.timestamp - previousTime;
previousTime = motion.timestamp;
Then I updated the gyroscope heading with :
gyroscopeHeading+= -self.motionManager.gryoData.rotationRate.z*deltaTime*180/M_PI;
The localization result is still not close to the real location. Is my approach correct?

CorePlot - dynamic x-axis data using two arrays

This is more of an open discussion topic than anything else. Currently I'm storing 50 Float32 values in my NSMutableArray *voltageArray before I refresh my CPTPlot *plot. Every time I obtain 50 values, I remove the previous 50 from the voltageArray and repeat the process....always displaying the 50 values in "real time" on my plot.
However, the data I'm receiving (which is voltage coming from a Cypress BLE module equipped with a pressure transducer) is so quick that any variation (0.4 V to 4.0 V; no pressure to lots of pressure) cannot be seen on my graph. It just shows up as a straight line, varying up and down without showing increased or decreased slopes.
To show overall change, I wanted to take those 50 values, store them in the first index of another NSMutableArray *stampArray and use the index of stampArray to display information. Meanwhile, the numberOfRecordsForPlot: method would look like this:
- (NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plotnumberOfRecords {
return (DATA_PER_STAMP * _stampCount);
}
This would initially be 50, then after 50 pieces of data are captured from the BLE module, _stampCount would increase by one, and the number of records for plot would increase by 50 (till about 2500-10000 range, then I'd refresh the whole the thing and restart the process.)
Is this the right approach? How would I be able to make the first 50 points stay on the graph, while building the next 50, etc.? Imagine an y = x^2 graph, and what the graph looks like when applying integration (the whole breaking the area under the curve into rectangles).
Look at the "Real Time Plot" demo in the Plot Gallery example app included with Core Plot. It starts off with an empty plot, adding a new point each cycle until reaching the maximum number of points. After that, one old point is removed for each new one added so the total number stays constant. The demo uses a timer to pass random data to the plot, but your app can of course collect data from anywhere. Be sure to always interact with the graph from the main thread.
I doubt you'll be able to display 10,000 data points on one plot (does your display have enough pixels to resolve that many points?). If not, you'll get much better drawing performance if you filter and/or smooth the data to remove some of the points before sending them to the plot.

Threshold in Sharepoint Dashboard Designer For Percentage KPI

I have got a SSAS cube, that has a KPI which has a Value as a percentage. I also have a Goal which is also the target percentage to keep the Value below.
I create the KPI fine, but when I import it into the dashboard designer and set the scoring pattern and indicator ( I used tick, exlamation mark, cross - which gives 2 thresholds). It always shows the tick even though its way over the goal.
I have set it to be that decreasing is better and the banding method is "Band by stated score", but it always shows on the scorecard as being On Target.
This is the threshold I currently have.
Is it something to do with having the goal as a percentage? Can anyone explain how Dashboard Designer thresholds work with percentages please??
Update : Seemed to get it to work by setting the thresholds against the actual values in stead.
The percentage works in terms of decimal.
0 = 0%
0.5 = 50%
1 = 100%
In your scenario, you can use -0.01, 0.8, 1, 1.01
Thanks,
Merin
I eventually found the answer to this for anyone who wants to know still.
I did indeed need the "Band by stated score" banding method, the thing I was missing was where does the score come from? This is not immediately obvious but it is in the "Specify the worst value" section when editing the banding settings.
This needs to be set correctly against the threshold values.

how to analyze min max loc returned by opencv's cvMatchTemplate?

I am trying to detect objects in image on an iphone app.
I am using the cvMatchTemplate function, I manage to see some patterns returned by the cvMatchTemplate function (I chose CV_TM_CCOEFF_NORMED).
Positive Results (result image is 163x371):
http://encryptedpixel.files.wordpress.com/2011/07/photo-13-7-11-11-52-19-am.jpeg
cvMinMaxLoc returns: min (102,244) max(11,210)
The min point is making some sense here, the position of the dark spot is really 102,244 in the result image of 163x371
Negative Results:
cvMinMaxLoc returns: min (114,370) max(0,0)
This is not making sense, there is totally no results, why is there still a min point at 114,370?
I need to know how to analyze these results programatically so that I can say "Hey I found the object!" in objectiveC for iPhone app?
Thanks!
cvMinMaxLoc will always return the position of the minimum and maximum values of their input. It only "doesn't make sense" in your particular application. You should check the value at the returned position for the minimum and do something like threshold it to see if that's a probable match for your template. A template match will yield a very low or a very high value, depending on the method you chose.