Question
c++ please. thank you! Hello, I need help with formatting and filtering of data in a .Txt file. The input log consists of a timestamp,
c++ please. thank you!
Hello, I need help with formatting and filtering of data in a .Txt file.
The input log consists of a timestamp, followed by distance and then angle information.
The following is a simple example of the inputFile format:
1464815342.110273122787, 17.889999389648, 0.095994234085
1464815342.123246669769, 17.920000076294, 0.087267547846
1464815342.137223720551, 17.889999389648, 0.095994234085
1464815342.150209188461, 17.920000076294, 0.087267547846
1464815342.163207292557, 17.909999847412, 0.095994234085
1464815342.177282094955, 17.920000076294, 0.087267547846
1464815342.189191341400, 17.909999847412, 0.095994234085
1464815342.204182624817, 17.909999847412, 0.087267547846
1464815342.217026233673, 17.899999618530, 0.095994234085
1464815342.230037212372, 17.920000076294, 0.087267547846
1464815342.243027210236, 17.909999847412, 0.095994234085
The only data value which is being filtered is the distance. In other words, The program needs count the number of valid data points until 11 valid data points are counted consecutively. Once 11 points are counted, the filter will take the average of all 11 data points and replace the midpoint data point with the average of all 11 data points. After this, it resets its counter and counts 11 consecutive data points again, finds the average again, and replaces the midpoint of the new window with the new average again.
For the above example, the average distance 0.957545 m would be valid for time 0.08. An example result (in the appropriate file format) if these were the only datapoints in the file would be:
TTTTT.TTT, DD.DD, A. AAA 01.03.0.05840 0.01333.1.01.0.05840 10.02667.1.1.0.05340 10.04.1.04.0.05840 10.05333.1.0.05840 0.06667,0.979.0.05840 10.03.0.958,0.05340 10.09333.0.937,0.05840 0.10667,0.916.0.05340 10.12.0.295,0.05340 0.13333,0.374,0.05340 0.14667,0.324 0.05340 0.000000,1.030000,0.058400, UNDEFINED 0.013330,1.010000,0.058400, VALID 0.026670,1.100000,0.058400, VALID 0.040000, 1.040000,0.058400, VALID 0.053330,1.000000,0.058400, VALID 0.066670,0.979000,0.058400, VALID 0.080000,0.957545,0.058400, FILTERED 0.093330,0.937000,0.058400, VALID 0.106670,0.916000,0.058400, VALID 0.120000,0.895000,0.058400, VALID 0.133330,0.874000,0.058400, VALID 0.146670,0.824000,0.058400, VALID A sample is determined to be valid when compared to the previous sample: the relative distance must be strictly less than the specified tolerance of 0.1 m, and the relative angle must be strictly less than 15 degrees. Consider using the M_Pl constant, defined in the cmath library to perform this calculation. The below should help in understanding how to classify each point, in order to determine whether to filter. If the sample has the default angle, the sample is labeled UNDEFINED If the sample can be used in filtering, but does not represented filtered data, it is labeled VALID If the angle between two points exceeds the angle maximum tolerance, the sample is labeled ANGLE RESET. If it is within the angular tolerance but the distance between two points exceeds the distance maximum tolerance, then the second point is given DISTANCE RESET. If a sample is not within either distance or angle tolerance of a previous sample, and is not at the maximum distance or default angle, it is given ANGLE RESET. TTTTT.TTT, DD.DD, A. AAA 01.03.0.05840 0.01333.1.01.0.05840 10.02667.1.1.0.05340 10.04.1.04.0.05840 10.05333.1.0.05840 0.06667,0.979.0.05840 10.03.0.958,0.05340 10.09333.0.937,0.05840 0.10667,0.916.0.05340 10.12.0.295,0.05340 0.13333,0.374,0.05340 0.14667,0.324 0.05340 0.000000,1.030000,0.058400, UNDEFINED 0.013330,1.010000,0.058400, VALID 0.026670,1.100000,0.058400, VALID 0.040000, 1.040000,0.058400, VALID 0.053330,1.000000,0.058400, VALID 0.066670,0.979000,0.058400, VALID 0.080000,0.957545,0.058400, FILTERED 0.093330,0.937000,0.058400, VALID 0.106670,0.916000,0.058400, VALID 0.120000,0.895000,0.058400, VALID 0.133330,0.874000,0.058400, VALID 0.146670,0.824000,0.058400, VALID A sample is determined to be valid when compared to the previous sample: the relative distance must be strictly less than the specified tolerance of 0.1 m, and the relative angle must be strictly less than 15 degrees. Consider using the M_Pl constant, defined in the cmath library to perform this calculation. The below should help in understanding how to classify each point, in order to determine whether to filter. If the sample has the default angle, the sample is labeled UNDEFINED If the sample can be used in filtering, but does not represented filtered data, it is labeled VALID If the angle between two points exceeds the angle maximum tolerance, the sample is labeled ANGLE RESET. If it is within the angular tolerance but the distance between two points exceeds the distance maximum tolerance, then the second point is given DISTANCE RESET. If a sample is not within either distance or angle tolerance of a previous sample, and is not at the maximum distance or default angle, it is given ANGLE RESETStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started