JavaScript assignment with node or php and data base (sql or no sql)

profileDzeko
assignment.pdf

CSC-317-03 – Final Assignment You are to develop a website that can receive input from a vehicle via query URLs that will record the input into a database and use that data to map its relative position. This is an INDIVIDUAL assignment. Data Acquisition: The following relative URL’s (or routes) are used by the vehicle to provide data to the website: /register?name=XXXX&width=###.### Adds a new vehicle run to the system, should return a cookie called USER=[name] that would be included for the other commands. Width is the width of the vehicle in cm. It should overwrite any other “active” session for that named vehicle /wheels?left=###.###&right=###.### Rescords the speed of the left and right wheel in cm/sec for that vehicle in the current session /echo?dist=###.### Records the result of the echo sensor in cm for the vehicle in the current session /line?l1=##&l2=##&l3=## Records the result of ONE or MORE l1, l2, l3, etc. Line sensors on/off cm for the vehicle in the current session /other?[variable key:value pairs] Records and other data sent in key:value pairs to be recorded for the vehicle in the current session /end End the current session for the vehicle All of the above will also have a “time=#####” parameter for relative time calculations. Time will be in milliseconds. All records should also be timestamped with the server’s date and time. User Interface: /active Shows a list of the active vehicle sessions and links to /map to map their position and to /datareview to show the data received to date. /review Shows a list of all sessions (active and complete) that can be filtered by vehicle name, and by time frame (i.e started before/after certain time). This list should link to /datareview and /map

CSC-317-03 – Final Assignment /datareview Shows all the data sent to the server in chronological order. The data can be filtered to show only specific data fields (based on the data fields), like show only left and right wheel data or show l1 echo and right wheel, etc. /map Displays a graphical representation of the relative position of the vehicle and its route. It can be assumed that the vehicle travels within a 1000 x 1000 cm grid. Calculation of position is based on the data from the wheels which has been recorded in cm/sec. Equal values applied to both wheels indicate straight movement. Unequal values indicates a change in direction. Slower right wheel would indicate a turn right, slower left wheel indicates a turn left. To calculate the “dot” (position) multiply the average wheel speed (between the last wheel data and the current wheel data) by the delta of time (use millisecond times) from the last wheel data. That gives you how far each wheel moved. Calling these LAL (left arc length) and RAL (right arc length), we first need to handle special cases:

1) LAL and RAL are equal – meaning the car went straight (use an error delta, such as a 1/10 of a mm to allow for data fluctuation).

2) LAL = (or is near) 0, while RAL is some significant (> error ) value, Vehicle making a sharp left turn (pivoting on left wheel).

3) RAL = (or is near) 0, while LAL is some significant (> error ) value, Vehicle making a sharp right turn (pivoting on right wheel).

4) RAL and LAL are (or near) 0 – Vehicle is stopped The final cases are where both LAL and RAL are significant values but not equal. If LAL is > RAL then the formulas below should be used to calculate the radius of the circle that contains the RAL arc and the angle in degrees that the arc represent of that circle.

𝐿𝐴𝐿 = 𝜃 360

2𝜋(𝑟 + 𝑤) 𝑎𝑛𝑑 𝑅𝐴𝐿 = 𝜃 360

2𝜋𝑟

𝜃 = 𝑅𝐴𝐿 ∗ 360

2𝜋𝑟 𝑎𝑛𝑑 𝑟 =

𝑤

5𝐿𝐴𝐿𝑅𝐴𝐿 − 18

If RAL is > LAL, invert the two values (RAL and LAL) in the above equations. From these values you should then be able to calculate the delta-x and delta-y to determine the new position.

CSC-317-03 – Final Assignment

Assignment: Your assignment for this final project (this is your final) is to develop the above website and use the supplied script which will feed data into your site. You will then navigate to the /active url (and take screen shots of each screen) show the active sessions. Click the link to bring you to the datareview for that session. Take screen shots of the screen with all data showing, then filter on just the dist values, then on the wheel values Navigate to the /review url (and take screen shots of each screen) and show all sessions, then filter on name showing just the sessions for a particular vehicle name, then further filter by date. Finally show the /map url for at least one of the sessions. Preferably two, one complete session and one active session. If you are animating the display of the map you can record that as an MP4 file to include with your submission. The Submission should include a writeup of what you did, the tools used, and reference material used, the screen shots and any other relevant information. Please Include a title page that has your name and student ID number on it. Also submit all your source files. Rubric:

Component Points Data collection 15 Database storage 10 Session display with filtering (active and complete) 15 Data Review with filtering 15 Map 15 Animated Map +10 Screen shots / MP4 10 Writeup 10 Source File submission 10

CSC-317-03 – Final Assignment

Mapping Help This diagram is to help you with the mapping of the vehicle. In the diagram, the Green dot indicates the actual plot position for the vehicle. This shows a vehicle bearing right. w is the width of the vehicle (passed in on register). We start with the car at 0,0 and the left wheel would be at -1/2w,0 and the right wheel at 1/2w,0. (You need to keep track of the left and right wheel position throughout the plotting of the vehicle). You calculate the LAL and RAL by taking the average speed of the prior point and current point multiplied by the time interval between the points. Then use the formulas above in the document to calculate r and theta. Then drop a perpendicular line which will be the change in y (delta y) - Δ𝑦 = 𝑟 sin𝜃. The line segment ri is calculated by 𝑟! = 𝑟 cos𝜃 and thus the delta x is just Δ𝑥 = 𝑟 − 𝑟!. Repeat these calculations for the Left wheel by replacing r with r+w.