Starting from:
$35

$29

Lab 5: DS4Drop -- Part 2 Now with Air Resistance Solution

Objectives:

    • Develop problem solving skills

    • Develop skills in the use of numerous loops to solve a problem

Starting Point:

You will be working off of the program you wrote last week. At this point, you should have a program capable of recording the time that has passed while the DualShock 4 falls and determining the distance covered in that fall. ​Open the file from last week, Save-As with a different file name to start this week because you will need to turn in both files in your lab report.

Process:

Problem

Depending on your tolerances chosen in your program so far, you may run into problems when you drop the DualShock 4 three stories. What is going on here?

We will add another feature to the program based on a formula that incorporates the magnitude of the acceleration as the DualShock 4 falls. Modify your program to also compute and output the fall distance using the following approach.
​​



​​





At x0=0 , the time can be called t0
and the velocity vi​=0 .
As the DualShock 4 falls, the velocity (v) changes as
v











=v

+ g (1 − mag(acc)) (t​−t​ ).



i​
i-1​

i ​

i-1​


where g is gravity.
​​



​ ​










Then, the position, x, changes as x
= x
i-1
+ v (t −t​ )





i




i​ i​   i-1​
So, what should x​be when the DualShock 4 stops falling?
i​

Sample Output

After the output from last week’s lab, after each fall, your program should output:

Compensating for air resistance, the fall was 8.777 meters.

This is 7% less than computed before.

The Drop

After you have implemented the air resistance calculation, rename your source code to
<your username>.c and copy that file to the drop box link on BlackBoard. Be sure to put it in your section. Next, follow your TA’s instructions for completing the actual drop.

Questions and Experiments

    1. How much difference tends to occur in drops in the lab area? From the 2nd floor?

    2. How far is it from the second floor railing to the bottom floor according to your code? If your program is not done by end of this week's lab, you can capture data ds4rd.exe data to a file using:
./ds4rd.exe -d 054c:05c4 -D DS4_BT -t -g​​ > output.csv
Test your code by running:

./exdrop < lab5_sampledata2013_1.csv

    3. What issues arose in implementing Part 2?

Turn-In:

Your lab report will include:

    1. Copy of code for part 1 and 2

    2. Answers to all questions from Lab 5 Part 1’s “Questions and Experiments” and those above.

More products