1%> @brief
this function performs a zero velocity detection on the provided data.
3%> @param data - data structured as defined in @ref
jumpReadData
4%> @param options.plot -
boolean to enable plotting (
default: false)
5%> @param options.method - method to use for zero velocity detection (default:
"movstd_acc_gyr")
6%> @param options.windowSize - window size for the moving standard deviation (default: 100)
7%> @param options.threshold_acc - threshold for the acceleration (default: 0.15 m/s^2)
8%> @param options.threshold_gyr - threshold for the angular velocity (default: 0.15 deg/s)
10%> @retval zv - logical vector indicating zero velocity (1) and movement (0)
12%> @details The methods works as follows:
13%> - movstd_acc_gyr: calculates the moving standard deviation of the acceleration
14%> and angular velocity. If the standard deviation is below the threshold for both
15%> acceleration and angular velocity, the data is considered zero velocity.
19%> @copyright see the file @ref LICENSE in the root directory of the repository
25 options.plot (1,1) logical =
false;
26 options.method (1,1)
string =
"movstd_acc_gyr";
27 options.windowSize (1,1)
double = 100;
28 options.threshold_acc (1,1)
double = 0.15;
29 options.threshold_gyr (1,1)
double = 0.15;
38 std_acc = max(abs(movstd(data.tt.acc, options.windowSize)),[],2);
39 std_gyr = max(abs(movstd(data.tt.gyr, options.windowSize)),[],2);
41 zv = std_acc < options.threshold_acc & std_gyr < options.threshold_gyr;
43 error(
"Zero velocity detection failed. Check if the data is correctly structured and the parameters are set correctly.");
46 error(
"Unknown method: %s", method);
51 plt1 = subplot(2,1,1);
53 plot(data.tt.t, data.tt.acc,
"DisplayName",
"acceleration");
54 ylabel(
"acc [m/s^2]");
56 plot(data.tt.t, zv,
'.',
"DisplayName",
"zv");
59 yticklabels([
"movement",
"zero velocity"]);
61 title(
"Zero velocity detection");
62 legend(
"Location",
"best");
64 plt2 = subplot(2,1,2);
66 plot(data.tt.t, data.tt.gyr,
"DisplayName",
"angular velocity");
67 ylabel(
"gyr [deg/s]");
69 plot(data.tt.t, zv,
'.',
"DisplayName",
"zv");
72 yticklabels([
"movement",
"zero velocity"]);
75 legend(
"Location",
"best");
77 linkaxes([plt1, plt2],
"x");
function jumpCheckData(in data)
function jumpReadData(in filePath, in options)
function jumpZeroVelocityDetection(in data, in options)