Introductionc++模拟一个汽车运动模型,文件输入运行轨迹,车辆情况等等。根据一些数学和物理的公式,计算最后的汽车运动情况,同时考虑到c++的类的设计,要求类设计完好。control类,driver类,read类,write类等等功能分离使得思路更加清晰代码明了RequirementUsageUsage: catcar controlInputs stateOutputsRequirements SummaryCreate a C++ program that reads control inputs for a selfdriving car from an input file. The program will simulate the car’sstate over the time horizon given by the control inputs, and write the results to an output file. The major problem is: the inputfile was written in such a way that the control inputs are stored out of order!Assignment NameThe assignment name for this assignment is: catcar1. Kinematic Model SimulationIn this project, you will create a program that controls an autonomous vehicle from an input control file. The only problem isthat the input controls are jumbled, since a function that operated on the linked list that stored them was badly designed: theywere stored in order in a queue, but the queue was designed by a Visual Basic programmer who doesn’t understand memory.They printed the nodes out by order of memory address of the list nodes, instead of by the node order prescribed by the nextpointers.So you need to put them back in the right order before proceeding. This program will read in time value at which thiscommand should be executed, then the commanded speed, and tire angle. The duration of the command is the differencebetween this command’s time value, and the next time value (when the nodes are in order), at a maximum of 201 ms. If thereare any durations longer than 201 ms, the input file should be declared invalid, and no simulation should take place.With this sequence of commands, you should save the vehicle’s state at each time step. During the execution of controlcommands, this program will record the vehicle’s state as it moves (or stands still), and save the output states to a file.2. File Format2.1 controlInputsFor this assignment, the input text file will consist of control information, each line contains sample time (in seconds),commanded vehicle velocity (m/s), and tire angle rate (radians/s), with elements separated by whitespace (even the firstnumber could be padded by a whitespace in the front). All values should be stored as doubles.0.06 5 0.5230.02 20 0.5230.07 8 00.00 0 0In this example, at time 0.06 the vehicle should take in as its input command a velocity of 5, with a tireangle rate of 0.523,for 0.01 seconds. The duration of 0.01 is determined by looking at the next time step (after the vector is confirmed to besorted), and taking the difference (0.07 0.06).Clearly the above example is an extreme case of driving aggressively. Your program should run regardless of the unlikelycontrol inputs, as long as the below conditions are met: The rst element of the sorted list must be at exactly time 0. Commanded tire angle rate must be between [?0.5236, 0.5236] radians/sec (i.e., / 6 radians/sec). ±π Commanded velocity must be between [0, 30] m/s; Time values must be nonnegative; and Duration between sorted input objects must be between [5, 201] ms.If any of these are violated for any input value in the file, then the controlInputs file is deemed invalid, and an emptyoutput file is written. If at any time a line fails to parse, then the file should be declared invalid. This policy is for safety: youwouldn’t want to start controlling an autonomous car if you accidentally passed in the wrong file, and it started somehowparsing lines!2.2 outputFileThis assignment should output a file with information on the state values of the vehicle throughout its journey. The format forthis file is one called csv (comma separated values), and is common for inputting data into MATLAB. Each output entry is asfollows:t,x1,x2,x3,x4 Where t is the time at which this state value was measured, and the values in x are given by the kinematic equation (1). Theprecision for each value should be whatever is the default when using C++ iostream methods.If the control inputs are determined to be invalid, you should create an empty file with the name provided from the commandline.3. Vehicle ModelYou are developing a vehicle simulator, which describes the kinematic motion of a frontsteered, twowheel drive vehicle.The vehicle you are simulating is visually depicted below. The equations of motion for this vehicle are provided in (1).x1 = u1 cos(x3 ) cos(x4 )(1)x2 = u1 cos(x3 ) sin(x4 )x3 = u2x4 = u1 (1/L) sin(x3 )Where x1 is translational forward motion, x2 is translational left/right motion, x3 is the tire angle, and x4 is the heading of thevehicle. For control inputs, u1 represents vehicle velocity, and u2 represents angular rate of change for the tire angle. Thewheelbase L is defined in the Vehicle.h header file.Using a simple discretization of these differential equations with a duration t, we can use the following equations for motion:x1 (t+∆ t ) = x1 (t) + ∆ t u1 (t) cos(x3 (t)) cos(x4 (t)) (2)x2 (t+∆ t ) = x2 (t) +∆ t u1 (t) cos(x3 (t)) sin(x4 (t))x3 (t+∆ t ) = x3 (t) + ∆ t u2 (t)x4 (t+∆ t ) = x4 (t) + ∆ t u1 (t) (1/L) sin(x3 (t))The value for x3 (tire angle) must always be between [?0.5236, 0.5236] radians/sec (i.e.,/ 6 radians/sec). If a value is ±πcommanded outside this range, then x3 should saturate using the above range. Ex: If the tire angle rate is commanded to bethe value 0.7156, the tire angle rate should equal the maximum value of 0.5236.The heading should always be between [0, 2 ). If the heading is a negative value, the heading should be converted into the πrange [0, 2 ) by repeatedly adding 2 . Ex: If the heading is .5 , the heading can be converted to 0.5 +2 = 1.5 . π π π π π πDefined values are present for these ranges inside of State.h4. Class designsThe following class definitions must be used for the indicated classes. You may (if you wish) create your own classes to doother tasks. The below classes are prescribed in whole (or in part):Input, State, Vehicle (must use exact prescribed class definitions)DataSource, DataSink, Director (are at your discretion, except for the sort method prescribed).4.1 Classes that must use prescribed definitionsPlease use the exact interfaces for Vehicle, State, and Input, or your alpha release may not compile. These are the only classesfor which the design is fixed.4.1.1 InputThe Input class holds the values for the u variables used in the kinematic model. Its interface is included on Piazza as aresource for this Project.4.1.2 StateThe State class is similar to Input, and its interface is included on Piazza as a resource for this Project. However, it doesensure that tire angle values and heading values stay within the designated ranges if the setters for the class are called.4.2 VehicleThe Vehicle class executes a control input for the designated duration. The interface is included on Piazza as a resource forthis Project.The Vehicle keeps its own state, receives a control input, and updates its state. The initial state value for the Vehicle isx1 = 0, x2=0, x3 = 0, and x4 = 0, e.g., (0, 0) position, tire angle of 0, and heading of 0. The Vehicle class assumes that anyinvalid input values have been removed, so it does not do any error checking. The class does not permit anyone to update itsstate, except by providing an Input object through the stateUpdate method prescribed in the header file.4.3 Classes left largely to your design discretionAnything you want to add to the interface for DataSource, DataSink, or Director is up to you.The DataSource class keeps a vector of Input objects (control inputs), in order. Likewise, the DataSink class keeps avector of State objects (state outputs), in order.The Director is used to pass Input values along to the Vehicle.Hint: The bool data type is defined in C++, so it won’t work if you try to include the headers from previous projects. Use,instead, the builtin type from C++ for bool functionality.5. Recommended Functional DecompositionIn C++, global functions are a sign of a bad design. Rather, you provide methods inside the scope of a class. If you use globalfunctions for this assignment, you will receive significant design deductions. Just like in C programs, your main functionshould be small. If yours includes lots of logic, rather than depending on the methods of classes, you will receive significantdesign deductions.5.1 Reading Control InputsDefine a class method (not a global function) that reads all the control inputs from a provided filename. As you read them in,don’t worry about how they’re sorted. The inputs will be stored in a vector in the class. I think you can figure out which classthis should be.5.2 Sorting Control InputsPuts the control inputs in order of their timestamp. The interface for the sort function should be:void sort (); // performs qsortIf your algorithm does not perform. quicksort, you will receive a deduction. Insertion and bubble sort are each unacceptable.You should write your own sort routine, not use the sort routines in STL or any other library. You are, of course, welcome touse other implementations to confirm that your qsort implementation is working, as part of your own tests. The inputs will bealready be stored in a vector in the class. I think you can figure out which class this should be.5.2.1 Validating Control InputsThis method should be part of the DataSource class. The interface for this method should be:// should be called only after the vector is sorted// returns true if the vector in Input objects is validbool validate ();The vector of Input objects is invalid if any of the criteria from Section 2.1 are discovered.5.3 Writing State OutputsDefine a class method (not a global function) that writes a vector of Output objects to a file of the provided filename. Ithink you can figure out which class this should be.5.4 Driving the CarOnce you have an (ordered) set of control inputs, you need a Director to coordinate the consumption of inputs, and saveeach output. The Director will take the next Input (stored and sorted by the DataSource) to the vehicle, fetch thatOutput, and store it in the output vector in the DataSink. When the last Input is consumed, a duration of 200 ms shouldbe used. After simulating this Input, the simulation is ended. In order to do this, the Director will “contain” a Vehicleobject, and decide how to interact with it.Part of the assignment is coming up with and writing the pseudocode for this algorithm, in order to stage your design.5.5 What goes in main, then?In your main function, you should instantiate your classes, check your arguments and return the usage statement. Put all thelogic and error handling for file I/O, initialization of the Vehicle, etc., in your methods as defined in your other files and inthe order that makes sense. You want your main to be very simple, so that if you want to reuse your code, you can do sowithout a main function.Generally, part of assignments going forward include coming up with and writing the pseudocode for this algorithm, in orderthat your design can be performed in stages. To bootstrap this process, we provide as an example how to sketch an algorithmis pseudocode below:check usageopen input file, and output fileexecute directorwhile inputsexecute input(s)save output(s)write and close output file, input file6. Alpha SubmissionYour alpha assignment is to implement the Vehicle class methods, and turn in your Vehicle.cpp file to the dropbox calledProject 3 (alpha) on D2L. We will use your file with our own main function and test files, to check the behavior. of each ofthe Vehicle methods we prescribe. Use the same vehicle.h file given above and provided from the website, or be indanger of your alpha not compiling.As a note, you will have to complete your implementation of Input and State in order to test your alpha on your own.Submit only your Vehicle.cpp do not submit implementations for Input and Output, we will use our own. We havealready included Input.h and State.h in our vehicle.h interface definition, but you may need to include otherheaders for standard C++ functionality in your cpp file. We do not recommend including headers for other custom classes inyour cpp file, since you will not be submitting those headers or their implementation.本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp