xioTechnologies/Gait-Tracking-With-x-IMU

Real Time System. Speed correction

Opened this issue · 2 comments

Hello, I am trying to implement this algorithm in real time. Faced the problem of speed correction. How can I calculate speed drift in real time? Or do I need to use a different algorithm or approach?

This implementation will not work in realtime:

velDrift = zeros(size(vel));
stationaryStart = find([0; diff(stationary)] == -1);
stationaryEnd = find([0; diff(stationary)] == 1);
for i = 1:numel(stationaryEnd)
driftRate = vel(stationaryEnd(i)-1, :) / (stationaryEnd(i) - stationaryStart(i));
enum = 1:(stationaryEnd(i) - stationaryStart(i));
drift = [enum'*driftRate(1) enum'*driftRate(2) enum'*driftRate(3)];
velDrift(stationaryStart(i):stationaryEnd(i)-1, :) = drift;
end

A real time implementation must have a latency of one stride to allow for the velocity drift correction. I suggest you work with the more recent, Python implementation as the code is simpler.

Thank you so much!