Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in C++ pls. Create a program that will produce a smoothed curve of timestamped distance data, with annotations to denote significant changes in the
code in C++ pls.
Create a program that will produce a smoothed curve of timestamped distance data, with annotations to denote significant changes in the angle of detection, or distance to detected object. The resulting timestamped data (with annotations) should be placed in the outputFile.
Your program must be capable of utilizing a command line argument to specify the input log file and output file with the filtered data and analysis results ./projecti input File output File Input file format The input log consists of a timestamp, followed by distance and then angle information TTTTT.TTT, DD.DD, A. AAA Each line is separated by a newline. If a line does not match this format, it should be ignored and the program should continue processing the file. The following is a simple example of the inputFile format: 1464 815342.110273122787, 17.889999389648, 0.095994234085 1464815342.123246669769, 17.920000076294, 0.087267547846 Data structures The following data structure and enumerated type should be used for storing and filtering data. // This enumerated type provides entries for each of the // potential labels attached to a sample typedef enum Filterstatus { UNDEFINED=-1, VALID, FILTERED, ANGLE RESET, DISTANCE RESET) Filterstatus; typedef struct obstacleDataSample_struct { double timestamp; double distance; double angle; Filterstatus status; } obstacleDataSample; Filter algorithm The only data value which is being filtered is the distance; the filter is an average of all distance points across the width of the filter, which is defined at compile time as 11 data points. The filtered value is the center of this filtering window. For example, consider the subset of values below: 0,1.03,0.05840 0.01333, 1.01,0.05840 0.02667,1.1,0.05840 0.04,1.04,0.05840 0.05333,1,0.05840 0.06667,0.979,0.05840 0.08,0.958,0.05840 0.09333,0.937,0.05840 0.10667,0.916,0.05840 0.12,0.895,0.05840 0.13333,0.874,0.05840 0.14667, 0.824,0.05840 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: 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 Output file format The output file should be in the same format as the input file, of lines of text each of which is followed by a new line. There should be one addional entry per line that indicates the status of each data point. These are represented as data that may be used in filtering (VALID). filtered valid data with (FILTERED),marks a new position due to a significant change in angle (ANGLE RESET), a significant step in distance (DISTANCE RESET), or that the sample is undefined (UNDEFINED), as text outputs. TTTTTTTTTTT, DDDDDDDD, A.AAAAAA, STATUS Your program must be capable of utilizing a command line argument to specify the input log file and output file with the filtered data and analysis results ./projecti input File output File Input file format The input log consists of a timestamp, followed by distance and then angle information TTTTT.TTT, DD.DD, A. AAA Each line is separated by a newline. If a line does not match this format, it should be ignored and the program should continue processing the file. The following is a simple example of the inputFile format: 1464 815342.110273122787, 17.889999389648, 0.095994234085 1464815342.123246669769, 17.920000076294, 0.087267547846 Data structures The following data structure and enumerated type should be used for storing and filtering data. // This enumerated type provides entries for each of the // potential labels attached to a sample typedef enum Filterstatus { UNDEFINED=-1, VALID, FILTERED, ANGLE RESET, DISTANCE RESET) Filterstatus; typedef struct obstacleDataSample_struct { double timestamp; double distance; double angle; Filterstatus status; } obstacleDataSample; Filter algorithm The only data value which is being filtered is the distance; the filter is an average of all distance points across the width of the filter, which is defined at compile time as 11 data points. The filtered value is the center of this filtering window. For example, consider the subset of values below: 0,1.03,0.05840 0.01333, 1.01,0.05840 0.02667,1.1,0.05840 0.04,1.04,0.05840 0.05333,1,0.05840 0.06667,0.979,0.05840 0.08,0.958,0.05840 0.09333,0.937,0.05840 0.10667,0.916,0.05840 0.12,0.895,0.05840 0.13333,0.874,0.05840 0.14667, 0.824,0.05840 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: 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 Output file format The output file should be in the same format as the input file, of lines of text each of which is followed by a new line. There should be one addional entry per line that indicates the status of each data point. These are represented as data that may be used in filtering (VALID). filtered valid data with (FILTERED),marks a new position due to a significant change in angle (ANGLE RESET), a significant step in distance (DISTANCE RESET), or that the sample is undefined (UNDEFINED), as text outputs. TTTTTTTTTTT, DDDDDDDD, A.AAAAAA, STATUSStep 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