1% =========================================================================== %
2%> @example jumpSensorExample.m
4%> This example shows how to use the
JumpSensor class to generate data from
5%> the sensor. The example generates data
for a sensor laying on a flat
6%> surface, a sensor in free fall and a sensor in free fall with rotation.
7%> The data is then plotted.
8% =========================================================================== %
17%% first simple data: sensor laying on a flat surface
18% the sensor is laying on a flat surface, so it is not accelerating nor
21% create ground truth data
22acc = zeros(numsamples,3);
23gyr = zeros(numsamples,3);
24ori = quaternion.ones(numsamples,1);
25%ori = quaternion(repmat([0,1,0,0], numsamples,1)); % z axis pointing upwards
26%ori = quaternion(repmat([1/sqrt(2), 0, 1/sqrt(2), 0], numsamples,1)); % x axis pointing towards the sky
27%ori = quaternion(repmat([1/sqrt(2), 1/sqrt(2), 0, 0], numsamples,1)); % y axis pointing downwards
30out1 = js.generate(acc, gyr, ori, simulate_hig=
false);
33plotData(out1,
'Sensor laying on a flat surface');
35%% second simple data: sensor in free fall
36% the sensor is in free fall, so it is accelerating downwards, but not
37% rotating (Assuming Vacuum)
39% create ground truth data (NED frame)
40acc = repmat([0, 0, 9.81], numsamples, 1);
41gyr = zeros(numsamples,3);
42ori = quaternion.ones(numsamples,1);
45out2 = js.generate(acc, gyr, ori);
48plotData(out2,
'Sensor in free fall');
50% =========================================================================== %
51%> @brief plots the data generated by the
JumpSensor class
53%> @param data:
struct with the data generated by the
JumpSensor class
56%> @param titName: title of the figure
59% =========================================================================== %
61 figure(
'WindowState',
'maximized',
'Name', titName);
65 plot(data.tt.t, data.tt.acc, data.tt.t, data.tt.hig);
66 title(
"Accelerometer data");
68 ylabel(
'Acceleration [m/s^2]');
69 legend(
'x_{mpu}',
'y_{mpu}',
'z_{mpu}',
'x_{hig}',
'y_{hig}',
'z_{hig}');
74 plot(data.tt.t, data.tt.gyr);
75 title(
'Gyroscope data');
77 ylabel(
'Angular velocity [°/s]');
78 legend(
'x',
'y',
'z');
83 plot(data.tt.t, data.tt.mag);
84 title(
'Magnetometer data');
86 ylabel(
'Magnetic field [uT]');
87 legend(
'x',
'y',
'z');
90 % pressure and temperature
92 plot(data.tt.t, data.tt.prs);
93 title(
'Pressure and temperature data');
95 ylabel(
'Pressure [hPa]');
97 plot(data.tt.t, data.tt.tmp);
98 ylabel(
'Temperature [°C]');
99 legend(
'Pressure',
'Temperature');
JumpSensor is a simulation of the JUMP sensor of the ZurichMove Project.
function jumpReadData(in filePath, in options)
function plotData(in data, in titName)
plots the data generated by the JumpSensor class