Skip to content

Commit aa42ba9

Browse files
authored
Add files via upload
1 parent 8931534 commit aa42ba9

19 files changed

+171
-39
lines changed

SensorModel/Debug/SensorModel.exe

512 Bytes
Binary file not shown.

SensorModel/Debug/SensorModel.ilk

23.8 KB
Binary file not shown.

SensorModel/Debug/SensorModel.pdb

232 KB
Binary file not shown.

SensorModel/SensorModel.VC.db

12 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
 main.cpp
22
SensorModel.cpp
3-
c:\users\dave\desktop\imusensormodels-master\tmp\sensormodel\sensormodel\sensormodel.cpp(200): warning C4101: 'sig_eta': unreferenced local variable
4-
c:\users\dave\desktop\imusensormodels-master\tmp\sensormodel\sensormodel\sensormodel.cpp(201): warning C4101: 'eta': unreferenced local variable
5-
c:\users\dave\desktop\imusensormodels-master\tmp\sensormodel\sensormodel\sensormodel.cpp(199): warning C4101: 'b_d': unreferenced local variable
6-
c:\users\dave\desktop\imusensormodels-master\tmp\sensormodel\sensormodel\sensormodel.cpp(198): warning C4101: 'a_d': unreferenced local variable
3+
c:\users\dave\desktop\imusensormodels-master\sensormodel\sensormodel\sensormodel.cpp(200): warning C4101: 'sig_eta': unreferenced local variable
4+
c:\users\dave\desktop\imusensormodels-master\sensormodel\sensormodel\sensormodel.cpp(201): warning C4101: 'eta': unreferenced local variable
5+
c:\users\dave\desktop\imusensormodels-master\sensormodel\sensormodel\sensormodel.cpp(199): warning C4101: 'b_d': unreferenced local variable
6+
c:\users\dave\desktop\imusensormodels-master\sensormodel\sensormodel\sensormodel.cpp(198): warning C4101: 'a_d': unreferenced local variable
77
Generating Code...
8-
SensorModel.vcxproj -> C:\Users\Dave\Desktop\IMUSensorModels-master\tmp\SensorModel\Debug\SensorModel.exe
9-
SensorModel.vcxproj -> C:\Users\Dave\Desktop\IMUSensorModels-master\tmp\SensorModel\Debug\SensorModel.pdb (Partial PDB)
8+
SensorModel.vcxproj -> C:\Users\Dave\Desktop\IMUSensorModels-master\SensorModel\Debug\SensorModel.exe
9+
SensorModel.vcxproj -> C:\Users\Dave\Desktop\IMUSensorModels-master\SensorModel\Debug\SensorModel.pdb (Partial PDB)
7.41 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2-
Debug|Win32|C:\Users\Dave\Desktop\IMUSensorModels-master\tmp\SensorModel\|
2+
Debug|Win32|C:\Users\Dave\Desktop\IMUSensorModels-master\SensorModel\|
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.12 KB
Binary file not shown.
96 KB
Binary file not shown.
8 KB
Binary file not shown.

SensorModel/SensorModel/SensorModel.cpp

+105
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,111 @@ void SensorModel::SensorModelOutput(void)
248248
}
249249
}
250250
/*----------------- End SensorModelOutput ----------------*/
251+
252+
/*-------------------- Set value of B --------------------*/
253+
// Set the mean square value of bias instability.
254+
void SensorModel::SetB(double B_input)
255+
{
256+
B = B_input;
257+
}
258+
/*------------------ End Set value of B ------------------*/
259+
260+
/*-------------------- Set value of K --------------------*/
261+
// Set the mean square value of rate random walk
262+
void SensorModel::SetK(double K_input)
263+
{
264+
K = K_input;
265+
}
266+
/*------------------ End Set value of K ------------------*/
267+
268+
/*-------------------- Set value of T --------------------*/
269+
// Set the time window at minimum of Allan variance
270+
void SensorModel::SetT(double T_input)
271+
{
272+
T = T_input;
273+
}
274+
/*------------------ End Set value of T ------------------*/
275+
276+
/*------------------- Set value of freq ------------------*/
277+
// Set the frequency of sensor measurements
278+
void SensorModel::Setfreq(double freq_input)
279+
{
280+
freq = freq_input;
281+
}
282+
/*----------------- End Set value of freq ----------------*/
283+
284+
/*----------------- Set value of sig_meas ----------------*/
285+
// Set the standard deviation of total sensor measurement (assuming error of mean zero)
286+
void SensorModel::Setsig_meas(double sig_meas_input)
287+
{
288+
sig_meas = sig_meas_input;
289+
}
290+
/*--------------- End Set value of sig_meas --------------*/
291+
292+
/*------------------ Set value of sig_w ------------------*/
293+
// Set the standard deviation used in rate random walk contribution so that
294+
// low frequency of RRW PSD matches low frequency of the PSD from dataset of sensor data
295+
void SensorModel::Setsig_w(double sig_w_input)
296+
{
297+
sig_w = sig_w_input;
298+
}
299+
/*---------------- End Set value of sig_w ----------------*/
300+
301+
/*------------------- Set value of bias ------------------*/
302+
// Set the current value of bias instability contribution
303+
void SensorModel::Setbias(double bias_input)
304+
{
305+
bias = bias_input;
306+
}
307+
/*---------------- End Set value of bias -----------------*/
308+
309+
/*------------------- Set value of rrw -------------------*/
310+
// Set the current value of rate random walk contribution
311+
void SensorModel::Setrrw(double rrw_input)
312+
{
313+
rrw = rrw_input;
314+
}
315+
/*----------------- End Set value of rrw -----------------*/
316+
317+
/*-------------------- Set value of S --------------------*/
318+
// Set the scale factor error.
319+
void SensorModel::SetS(double S_input)
320+
{
321+
S = S_input;
322+
}
323+
/*------------------ End Set value of S ------------------*/
324+
325+
/*-------------------- Set value of Bf -------------------*/
326+
// Set the measurement bias
327+
void SensorModel::SetBf(double Bf_input)
328+
{
329+
Bf = Bf_input;
330+
}
331+
/*------------------ End Set value of Bf -----------------*/
332+
333+
/*--------- Set value of true sensor measurement ---------*/
334+
// Set the true sensor value that will be corrupted by stochastic errors and deterministic errors
335+
void SensorModel::SetSensorMeasTrue(double SensorMeasTrue_input)
336+
{
337+
SensorMeasTrue = SensorMeasTrue_input;
338+
}
339+
/*------- End Set value of true sensor measurement -------*/
340+
341+
/*------------------- Get value of freq ------------------*/
342+
// Get the frequency of sensor measurements
343+
double SensorModel::Getfreq(void)
344+
{
345+
return freq;
346+
}
347+
/*----------------- End Get value of freq ----------------*/
348+
349+
/*------------- Get Corrupted Sensor Output --------------*/
350+
// Get the corrupted sensor output value
351+
double SensorModel::GetSensorOutput(void)
352+
{
353+
return SensorOutput;
354+
}
355+
/*----------- End Get Corrupted Sensor Output ------------*/
251356
/*-----------------------------------------------------------------------------*/
252357
/*------------------------------ End Helpers ----------------------------------*/
253358
/*-----------------------------------------------------------------------------*/

SensorModel/SensorModel/SensorModel.h

+45-18
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,32 @@ class SensorModel
88
// Choose anything besides 1 for using Kalibr
99
SensorModel(int Kalibr);
1010

11-
/*----- Parameters that describe errors (both stochastic and deterministic of an IMU sensor) -----*/
11+
/*----- Set Values that describe errors (both stochastic and deterministic of an IMU sensor) ------*/
1212
// Stochastic Parameters
13-
double B; // Mean Square Value of Bias Instability
14-
double K; // Mean Square Value of Rate Random Walk
15-
double T; // Time Window at Minimum of Allan Variance
16-
double freq; // Frequency of Sensor Measurements
17-
double sig_meas; // Standard Deviation of Total Sensor Measurement (assuming error of mean zero)
18-
double sig_w; // Standard deviation used in rate random walk contribution so that
19-
// low frequency of RRW PSD matches low frequency of the PSD from
20-
// dataset of sensor data
21-
double bias; // Current Value of Bias Instability Contribution
22-
double rrw; // Current Value of Rate Random Walk Contribution
13+
void SetB(double B_input); // Mean Square Value of Bias Instability
14+
void SetK(double K_input); // Mean Square Value of Rate Random Walk
15+
void SetT(double T_input); // Time Window at Minimum of Allan Variance
16+
void Setfreq(double freq_input); // Frequency of Sensor Measurements
17+
void Setsig_meas(double sig_meas_input); // Standard Deviation of Total Sensor Measurement (assuming error of mean zero)
18+
void Setsig_w(double sig_w_input); // Standard deviation used in rate random walk contribution so that
19+
// low frequency of RRW PSD matches low frequency of the PSD from dataset of sensor data
20+
void Setbias(double bias_input); // Current value of bias instability contribution
21+
void Setrrw(double rrw_input); // Current value of rate random walk contribution
2322

2423
// Deterministic Parameters
25-
double S; // Scale factor error
26-
double Bf; // Measurement bias
27-
/*--- End Parameters that describe errors (both stochastic and deterministic of an IMU sensor) ---*/
24+
void SetS(double S_input); // Scale factor error
25+
void SetBf(double Bf_input); // Measurement bias
26+
/*--- End Set Values that describe errors (both stochastic and deterministic of an IMU sensor) ----*/
2827

29-
// True sensor value that will be corrupted by stochastic errors and deterministic errors
30-
double SensorMeasTrue;
28+
/*---------- Get Values that describe IMU measurements ----------*/
29+
// Get the frequency of sensor measurements
30+
double Getfreq(void);
31+
// Get the corrupted sensor output value
32+
double GetSensorOutput(void);
33+
/*-------- End Get Values that describe IMU measurements --------*/
3134

32-
// Corrupted Sensor Output Value
33-
double SensorOutput;
35+
// Set the true sensor value that will be corrupted by stochastic errors and deterministic errors
36+
void SetSensorMeasTrue(double SensorMeasTrue_input);
3437

3538
// Compute Corrupted Sensor Output
3639
void SensorModelOutput(void);
@@ -41,6 +44,12 @@ class SensorModel
4144
// Corrupted Deterministic Sensor Output
4245
double DetSensorOutput;
4346

47+
// True sensor value that will be corrupted by stochastic errors and deterministic errors
48+
double SensorMeasTrue;
49+
50+
// Corrupted Sensor Output Value
51+
double SensorOutput;
52+
4453
// Function that Computes the Sensor Output with Deterministic Error Contributors
4554
void SensorDetModel(void);
4655

@@ -49,4 +58,22 @@ class SensorModel
4958

5059
// Function that Computes the Sensor Output with Stochastic Error Contributors using Kalibr Model.
5160
void SensorStocModel_Kalibr(void);
61+
62+
/*----- Parameters that describe errors (both stochastic and deterministic of an IMU sensor) -----*/
63+
// Stochastic Parameters
64+
double B; // Mean Square Value of Bias Instability
65+
double K; // Mean Square Value of Rate Random Walk
66+
double T; // Time Window at Minimum of Allan Variance
67+
double freq; // Frequency of Sensor Measurements
68+
double sig_meas; // Standard Deviation of Total Sensor Measurement (assuming error of mean zero)
69+
double sig_w; // Standard deviation used in rate random walk contribution so that
70+
// low frequency of RRW PSD matches low frequency of the PSD from
71+
// dataset of sensor data
72+
double bias; // Current Value of Bias Instability Contribution
73+
double rrw; // Current Value of Rate Random Walk Contribution
74+
75+
// Deterministic Parameters
76+
double S; // Scale factor error
77+
double Bf; // Measurement bias
78+
/*--- End Parameters that describe errors (both stochastic and deterministic of an IMU sensor) ---*/
5279
};

SensorModel/SensorModel/main.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ int main()
6868
SensorModel gyro_x;
6969

7070
// Set sensor parameters
71-
gyro_x.B = 4.889237695747431e-05;
72-
gyro_x.K = 1.309017731704734e-06;
73-
gyro_x.bias = 0.0;
74-
gyro_x.freq = 98.4163;
75-
gyro_x.rrw = 0.0;
76-
gyro_x.sig_meas = 0.009626800281770;
77-
gyro_x.sig_w = 10.0;
78-
gyro_x.T = 1.608951674938202e+03;
79-
gyro_x.S = 0.0;
80-
gyro_x.Bf = 0.0;
71+
gyro_x.SetB(4.889237695747431e-05);
72+
gyro_x.SetK(1.309017731704734e-06);
73+
gyro_x.Setbias(0.0);
74+
gyro_x.Setfreq(98.4163);
75+
gyro_x.Setrrw(0.0);
76+
gyro_x.Setsig_meas(0.009626800281770);
77+
gyro_x.Setsig_w(10.0);
78+
gyro_x.SetT(1.608951674938202e+03);
79+
gyro_x.SetS(0.0);
80+
gyro_x.SetBf(0.0);
8181

8282
// Output File Initializations
8383
outData = fopen("Simulation_Output.txt", "w");
@@ -91,19 +91,19 @@ int main()
9191
for (int i = 1; i <= iter_max; i++)
9292
{
9393
// Error-free sensor measurement
94-
gyro_x.SensorMeasTrue = 0.0;
94+
gyro_x.SetSensorMeasTrue(0.0);
9595
// Compute corrupted sensor measuremnt
9696
gyro_x.SensorModelOutput();
9797
// Print result to file
98-
fprintf(outData, "%f\t%f \n",((double)i) / gyro_x.freq - 1.0 / gyro_x.freq,gyro_x.SensorOutput);
98+
fprintf(outData, "%f\t%f \n",((double)i) / gyro_x.Getfreq() - 1.0 / gyro_x.Getfreq(),gyro_x.GetSensorOutput());
9999
// Print time to console
100-
printf("Time: %f seconds\r", ((double) i)/ gyro_x.freq - 1.0/ gyro_x.freq);
100+
printf("Time: %f seconds\r", ((double) i)/ gyro_x.Getfreq() - 1.0/ gyro_x.Getfreq());
101101
}
102102
/*-------------- End Run Simulation -------------*/
103103

104104
/*------------------- Closings ------------------*/
105105
// Closing Console Output
106-
printf("Time: %f seconds\n", ((double) iter_max) / gyro_x.freq - 1.0 / gyro_x.freq);
106+
printf("Time: %f seconds\n", ((double) iter_max) / gyro_x.Getfreq() - 1.0 / gyro_x.Getfreq());
107107
printf("Sensor Model Simulation Complete!\n");
108108

109109
// Closing File

0 commit comments

Comments
 (0)