logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Create a program that will simulate the behavior of a car, based on input files that describe its behavior.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Create a program that will simulate the behavior of a car, based on input files that describe its behavior. The input file will include the initial position and orientation of a vehicle, and a set of commands to make it move. The output of the program should be a time-series that describes the position and orientation of the vehicle, and records the command given at each time as well..

Data description and motivation The data in the input file describes characteristics of the vehicle and its initial state. The end of the file contains an array of input values that describe the velocity and steering angle rate of change for the vehicle. The goal of the project is to simulate a car-like robot's motion. A simple algorithm is applied to simulate the state evolution of the vehicle, based on kinematic motion. Classes Your project must use at least the below classes, for which required features are included in their template definitions. MathVector Input (note: inherits from MathVector) State: (note: inherits from MathVector) Vehicle The additional classes below are recommended, and files that match their names are part of the submission framework: Project2: The main function should call only Project2 methods, except for checking arguments.

Th Project2 class should provide methods to read in the file, create the Director, and the Vehicle, simulate it, and call the Director to get the necessary output information. If there are problems with the file, the Director, Vehicle, and simulation may not be created or take place. Director:

Utilizes the Vehicle and a vector of Input values to simulate the Vehicle's path. Once the simulation is finished, the Project2 can query a Director to get the necessary information to produce the output file. The following details are valid for your implementations: You are free to provide inline implementations if you choose You are free to add more features to prototyped classes You are free to edit header files to include other headers commonly available for C++

(or to change the way in which your headers are included) You are free to define other classes; if you do, you should define them in the Project2 header file, and ensure their implementations are in the Project2 cpp file. Additional descriptions for the required classes are below: MathVector This class should abstract a one dimensional math vector of double values, with the number of elements of the vector set on construction. It should provide a constructor that permits creating the vector from a string of comma separated numerical values. It should also provide a function to print those values (again, with comma separation) with fixed precision 3. When reading in values into the vector, the return value should be true only if all values are successfully read in. The below are example failures that should be written to the standard out if reading in a value fails. Note that the index is listed (when failing), and the number of elements is listed at the end; i.e., element 3 is the 4th element of the input string. If the object is has two elements, but a line has 3 values: Unable to read line [1.0,0.2,-1] (more than 2 elements) If a non-numeric value is passed in: Unable to read element 3 of [0.1,0.0,0.0,0a.0] (expected 4 elements) If not enough elements are provided: Unable to read element 2 of [0.1,0.0,] (expected 4 elements) or Unable to read element 3 of [0.1,0.0,0.0,] (expected 4 elements) or Unable to read element 2 of [0.1,0.0,0.0] (expected 4 elements) Note: the printout of the reading in error has brackets around the vector, but these brackets are only valid for printing the error messages. Input This class should inherit with public access to the MathVector class. It should provide methods to get and set values of v (input velocity) and deltaDot. Required method signatures are included in the prototype header provided, and other methods or features may be added at your discretion. State This class should inherit with public access to the MathVector class. It should provide methods to get and set values of x, y, delta, and theta. Required method signatures are included in the prototype header provided, and other methods or features may be added at your discretion. Vehicle This class simulates the behavior of a car-like robot. The Vehicle should maintain its own State, and when the update(.) function is called it returns a pointer to its state. It is the responsibility of the calling function to make a copy, if one is needed, of the State return value. When deleted, the Vehicle should ensure that any allocated memory is destroyed. The equations of motion for the car-like robot are below: x1(t+Dt) = x1(t) + Dt u1(t) cos(x3(t)) cos(x4(t)) x2(t+Dt) = x2(t) + Dt u1(t) cos(x3(t)) sin(x4(t)) x3(t+Dt) = x3(t) + Dt u2(t) x4(t+Dt) = x4(t) + Dt u1(t) (1/L) sin(x3(t)) Where x1 is x position, x2 is y position, x3 is tire angle delta (in radians) and x4 is heading theta (in radians). L is the Vehicle's wheelbase. The variable u1 is the input velocity, and u2 is the tire angle rate of change. For the entire simulation, assume a constant value of Delta t (Dt) as set in the inputFile parameters. The value for x3 (tire angle) must always be between [-0.5236,0.5236] radians. If a value is commanded outside this range, then x3 will be saturated using the above range.

ikewise, heading should always be between [0, 2π)---it is up to you to determine how to wrap values of heading. Defined values are present for these ranges inside of State.h Input File An example input file is included below: Wheelbase: 2.6 InitialPose: 1,0,0,0 Dt: 0.100 1,0 1,0 1,0 1,0 1,0 The format is given below, with variable types substituting for values. The Wheelbase, Initial Pose, and Dt should be able to be provided in any order, but must be read in prior to reading the Input vectors. Wheelbase: double InitialPose: double,double,double,double Dt: double double,double double,double ...

These correspond to: L (wheelbase in the Vehicle) State0 (the initial state of the Vehicle) Dt (the timestamp to use in the simulation) 1 or more lines of inputs ... There are many ways to fail, so you should NOT simulate the Vehicle's path if any of these occur, and instead you should produce an output file that is empty. Failure when reading the wheelbase, or Dt Failure to read the Initial pose Any incorrect line for an Input value If the failure is in reading a line for State or Input, you should echo the error as per the above requirements; otherwise, you should not provide any output and instead you should just produce an empty file. If you read a value that does not match either wheelbase, Initial pose, or Dt as one of the first 3 lines, you should produce an empty file without any error messages.

Output File The output file format should be of comma separated values with precision 3. The values for each timestep (in order) are: t, x, y, theta, delta, v, deltadot. In short, there are time, state, input time, state, input time, state, input time, state, input ... time, state, input time, state For the last line, only state and time will be available. NO additional commas or zeros should be added for the final inputs (i.e., the state at time k+Dt is a function of x(k) and u(k), so there is no k+Dt input unless provided). An example output is given below: 0.000,1.000,0.000,0.000,0.000,1.000,0.000 0.100,1.100,0.000,0.000,0.000,1.000,0.000 0.200,1.200,0.000,0.000,0.000,1.000,0.000 0.300,1.300,0.000,0.000,0.000,1.000,0.000 0.400,1.400,0.000,0.000,0.000,1.000,0.000 0.500,1.500,0.000,0.000,0.000

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

932 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

851 Answers

Hire Me
expert
AyooluwaEducation

675 Answers

Hire Me
expert
RIZWANAMathematics

647 Answers

Hire Me

Get Free Quote!

325 Experts Online