Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
repository:angry_birds [2021/01/20 18:04] porcaro1 created |
repository:angry_birds [2021/02/18 19:41] porcaro1 [Answer Key] |
||
---|---|---|---|
Line 2: | Line 2: | ||
====Activity Information==== | ====Activity Information==== | ||
===Learning Goals=== | ===Learning Goals=== | ||
- | * | + | *Model a projectile ([[https://www.nextgenscience.org/pe/hs-ps2-1-motion-and-stability-forces-and-interactions | HS-PS2-1]]) |
+ | *Be able to determine launch angle and velocity given target location | ||
===Prior Knowledge Required=== | ===Prior Knowledge Required=== | ||
- | * | + | *Trigonometry |
+ | *Decomposing vectors | ||
+ | *Kinematics in 2-Dimensions | ||
===Code Manipulation=== | ===Code Manipulation=== | ||
- | * | + | *Modify existing code |
+ | *Translate physical quantities and equations into code | ||
---- | ---- | ||
====Activity==== | ====Activity==== | ||
===Handout=== | ===Handout=== | ||
+ | {{ :repository:angrybirds.png?nolink&600|}} | ||
** Angry Birds ** | ** Angry Birds ** | ||
+ | |||
You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation. | You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation. | ||
Line 22: | Line 28: | ||
- Adjust this code so that it fits the second scenario | - Adjust this code so that it fits the second scenario | ||
===Code=== | ===Code=== | ||
+ | [[https://www.glowscript.org/#/user/porcaro1/folder/RepositoryPrograms/program/AngryBirds-Incomplete | Link]] | ||
<code Python [enable_line_numbers="true"]> | <code Python [enable_line_numbers="true"]> | ||
+ | GlowScript 3.0 VPython | ||
floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue) | crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue) | ||
Line 33: | Line 41: | ||
crate1v=vector(25,5,0) | crate1v=vector(25,5,0) | ||
while crate2.pos.x-crate1.pos.x>20: | while crate2.pos.x-crate1.pos.x>20: | ||
- | rate(50) | + | rate(250) |
crate1.pos=crate1.pos+crate1v*dt | crate1.pos=crate1.pos+crate1v*dt | ||
t=t+dt | t=t+dt | ||
Line 41: | Line 49: | ||
===Handout=== | ===Handout=== | ||
==Pre-Coding Solutions== | ==Pre-Coding Solutions== | ||
- | - In order to approach this problem, we can start by trying to solve the following system of equations that describes simple projectile motion: $$x=x_0+v_x*t$$ $$y=y_0+v_y*t+\dfrac{1}{2}g*t^2$$ where $x$ and $y$ are the horizontal and vertical positions of the bird, $v_x$ and $v_y$ are the horizontal and vertical components of the bird's velocity, $t$ is time, and $g$ is the acceleration due to gravity (9.8 m/s/s). Assuming the initial position is at the origin, we know the final location ($x=250$ and $y=0$). As well, based on this [[https://courses.lumenlearning.com/physics/chapter/3-4-projectile-motion/#:~:text=Projectile%20motion%20is%20the%20motion,path%20is%20called%20its%20trajectory. | Wired article]], the magnitude of the velocity of a sling-shot angry bird is about 22 m/s. We don't, however, know the horizontal or vertical components of this velocity, so we will have to make a substitution. Using trigonometry, we find that $v_x=22\cos(\theta)$ and $v_y=22\sin(\theta)$ | + | - In order to approach this problem, we can start by trying to solve the following system of equations that describes simple projectile motion: $$x=x_0+v_x*t$$ $$y=y_0+v_y*t+\dfrac{1}{2}g*t^2$$ where $x$ and $y$ are the horizontal and vertical positions of the bird, $v_x$ and $v_y$ are the horizontal and vertical components of the bird's velocity, $t$ is time, and $g$ is the acceleration due to gravity (-9.8 m/s/s). Assuming the initial position is at the origin, we know the final location ($x=250$ and $y=0$). In order to ensure the birds can actually hit the pig encampment, the magnitude of their velocity must be sufficiently high; we'll choose 50 m/s. We don't, however, know the horizontal or vertical components of this velocity, so we will have to make a substitution. Using trigonometry, we find that $v_x=50\cos(\theta)$ and $v_y=50\sin(\theta)$. Substituting what we know back into the original system of equations, we can solve for t, and subsequently find the initial launch angle: $$250=0+50\cos(\theta)t$$ $$0=0+50\sin(\theta)-\dfrac{9.8}{2}$$ Using an online calculator, we find that $t=6.46$ s and $\theta=39.3$°. |
+ | - Now that we know the angle, we can find our horizontal and vertical components of velocity by simply plugging $\theta$ into the two substitutions above: $v_x=50\cos(39.3°)=38.7$ m/s and $v_y=50\sin(39.3°)=31.6$ m/s. | ||
+ | - The process for figuring out how to hit the second encampment 52 m above the first one is relatively similar, with two key differences. Firstly, we need to increase the sling-shot speed; at 50 m/s, no matter what angle you aim the bird, it will never reach the encampment. Increasing it to 75 m/s should be sufficient. Secondly, we need to adjust the $y$ in the system of equations from 0 to 52 to model the elevation difference between the two encampments. With these changes, we can follow the process detailed in part 1 & 2. We find that $\theta=25.4°$, $v_x=67.7$ m/s, and $v_y=32.2$ m/s. | ||
+ | |||
+ | {{ :repository:angrybirdssolution.png?nolink&600 |}} | ||
+ | |||
+ | ==Post-Coding Solutions== | ||
+ | See highlighted code below: | ||
===Code=== | ===Code=== | ||
- | <code Python [enable_line_numbers="true", highlight_lines_extra=""]> | + | ==Scenario 1== |
- | </code> | + | [[https://www.glowscript.org/#/user/porcaro1/folder/RepositoryPrograms/program/AngryBirds-Solution1 | Link]] |
+ | <code Python [enable_line_numbers="true", highlight_lines_extra="3,4,10,11,13,16"]> | ||
+ | GlowScript 3.0 VPython | ||
+ | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
+ | crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) | ||
+ | crate2 = box(pos=vector(105,10,0), size=vector(20,20,5), color=color.red) | ||
+ | |||
+ | #Setting the time interval | ||
+ | t=0 | ||
+ | dt=0.01 | ||
+ | |||
+ | crate1v=vector(38.7,31.6,0) | ||
+ | crate1a=vector(0,-9.8,0) | ||
+ | |||
+ | while crate2.pos.x-crate1.pos.x>10: | ||
+ | rate(250) | ||
+ | crate1.pos=crate1.pos+crate1v*dt | ||
+ | crate1v=crate1v+crate1a*dt | ||
+ | t=t+dt </code> | ||
+ | ==Scenario 2== | ||
+ | [[https://www.glowscript.org/#/user/porcaro1/folder/RepositoryPrograms/program/AngryBirds-Solution2 | Link]] | ||
+ | <code Python [enable_line_numbers="true", highlight_lines_extra="3,4,10,11,13,16"]> | ||
+ | GlowScript 3.0 VPython | ||
+ | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
+ | crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) | ||
+ | crate2 = box(pos=vector(105,62,0), size=vector(20,20,5), color=color.red) | ||
+ | |||
+ | #Setting the time interval | ||
+ | t=0 | ||
+ | dt=0.01 | ||
+ | |||
+ | crate1v=vector(67.7,32.2,0) | ||
+ | crate1a=vector(0,-9.8,0) | ||
+ | |||
+ | while crate2.pos.x-crate1.pos.x>10: | ||
+ | rate(200) | ||
+ | crate1.pos=crate1.pos+crate1v*dt | ||
+ | crate1v=crate1v+crate1a*dt | ||
+ | t=t+dt </code> | ||
---- | ---- | ||
====See Also==== | ====See Also==== | ||
- | * | + | *[[ball_launch | Ball Launch]] |
+ | *[[cirque_du_soleil_stunt | Cirque du Soleil Stunt]] |