I have a stream of (x,y) data that I want to determine velocity and acceleration from.
A new data point comes every 2ms and I would prefer to not accumulate/store unnecessary values so I thought to use a boost::accumulator.
Is there a simpler way to handle this type of task? or perhaps other libraries that already exist which already does this? or am I on the right track with my thinking. Not yet sure what tags I'm going to use but I like the idea that the container keeps an updated value for a given property and doesn't store the old positional data.
Second idea was to use a circular buffer (e.g size 200) and calculate the acceleration based off the last 50 values and velocity based off the buffer size. However if the buffer stores raw positional data this would require looping over all elements every time to calculate the acceleration and velocity. This could be improved by instead keeping some sort of rolling acceleration and velocity value then recalculate by removing the value from the end element and add the value from the new element to insert. However this to me seems like some sort of boost rolling weighted accumulator.
Aucun commentaire:
Enregistrer un commentaire