# Cirque du Soleil Stunt

Activity Information

Learning Goals

• Model a horizontal projectile and graph the object’s motion independently with its horizontal and vertical components ( HS-PS2-1)

Prior Knowledge Required

• Kinematics
• Unbalanced forces
• ΣF≠0
• Momentum
• Energy

Code Manipulation

• Copying/pasting code
• Modifying existing code
• While loops and if statements
• Translating equations into code

Activity

Handout – Cirque du Soleil Stunt

As part of your Cirque du Soleil audition you are going to ride a bicycle horizontally off a cliff and fall into an airbag that is in the back of a moving pickup truck driving towards the cliff. The people in charge of personnel safety at Cirque du Soleil are concerned about the level of danger in your proposed stunt. In order to reassure them that you have a reasonable chance of being successful with the stunt, you are going to create a computer simulation. Using the minimally working code and the ball velocity provided by the stunt coordinator, determine an appropriate airbag speed and complete the simulation that shows you will hit the moving airbag. Be sure to include velocity versus time graphs of both your horizontal and vertical velocities.

Note: when conducting this activity with students, the initial velocity of the bike (ball) and the initial position of the airbag (target) can be provided by the instructor, but for demonstration purposes they have been included in the code below.

Code

``````GlowScript 2.8 VPython
#Projectile and moving target challenge
'''
The people in charge of personnel safety at Cirque du Soleil are concerned about
the level of danger in your proposed stunt.  In order to reassure them that you have
a reasonable chance of being successful with the stunt, you are going to create a computer simulation.

Using the minimally working code and the vehicle velocity value from your stunt coordinator,
create a simulation that shows you will hit the moving airbag.  Be sure to include
velocity vs time graphs of both your horizontal and vertical velocities over time.
'''

# scene set up DO NOT CHANGE.
scene.align='left'
scene.width=400
scene.height=200
#scene fov is scaling factor(in radians) greater than 1 zooms out, less than in.
scene.fov=.25

# System Objects
Table=box(pos=vec(-1,-.55,0),size=vec(2,1.1,2),color=color.orange)
Ground=box(pos=vec(1,-1.2,-4),size=vec(6,.2,10),color=color.green)
# ADD you must add some sort of target that starts at either end of the floor
# Your target width should be the diamter of the ball
# Be mindful your target height will affect your calculations, do not choose a height greater than 0.25

# DO NOT CHANGE. Tells he camera to follow ground after ground has been defined.
scene.camera.follow(Ground)

# system parameters
# DO NOT CHANGE. Time step rate and total run time
dt = 0.01
t = 0
tf = 5
# DO NOT CHANGE. Assigns initial vector values to objects set to zero so the can be defined later.
Ball.velocity=vector(0,0,0)
Ball.acc=vector(0,0,0)
Target.velocity=vector(0,0,0)

# You will be assigned a velocity for the ball by your teacher.
Ballvx=0
# Enter the velocity for the target that you calculate it needs to have in order for the ball to hit it.
Targetvx=0

# DO NOT CHANGE. Defines ball and target vectors as what you assigned above and as earths free acceleration.
Ball.velocity.x=Ballvx
Ball.acc.y=-10
Target.velocity.x=Targetvx

#Enter lines of code to produce a velocity time graphs in the x and y direction for the projectile
velocityGraph = graph(align='left',width=400, height=200,title='velocity vs time', xtitle='time (s)', ytitle='velocity (m/s)',fast=False)

#Only change line 76 . Button Code allows you to run/pause and reset the intial conditions
running=False

def Run(b):
global running
running=not running
if running: b.text="Pause"
else: b.text="Run"

bbutton=button(text="Run", pos=scene.title_anchor, bind=Run)

def Reset(c):
global t, Ball

t=0
Ball.pos=vec(-1.9,0.2,.5)
Ball.acc=vec(0,-10,0)
Ball.velocity.x=Ballvx
Ball.velocity.y=0
Target.velocity.x=Targetvx
#copy in the initial target position as assigned above when creating the target.
cbutton=button(text="Reset", pos=scene.title_anchor, bind=Reset)
#End of Button Code

'''
Run the code and see what happens.

Assuming the ball is the stuntman bicyclist and the target is the truck with an airbag,
Make adjustments to the initial conditions of the program and/or
write additional code so the program can serve as evidence to safety personnel that
the stunt is physically possible.
'''
#While true just means run the code all of the time.
while True:

rate(100)

if running:    #starts the loop when the run button is pressed.
Ball.pos.x=Ball.pos.x+(Ball.velocity.x*dt)
#Enter a line of code that gets the target to start moving when the run button is pressed.

#Enter another if statement that allows the ball to fall when it gets to the edge of the table.
#The statement will need conditions for when to work and likely require multiple lines of code.

# Do not modifiy the lines of code below this line.  It stops the ball and target when
# they have the same x position.  While the code is still running the objects don't move when x positions are the same
if abs(Ball.pos.x-Target.pos.x)<.03:  # less than small increment is needed in case calculation never reaches exactly zero.
Ball.velocity.x=0
Target.velocity.x=0
Ball.acc.y=0
Ball.velocity.y=0

# add the code for the velocity time graph so it gets updated in the loop

t=t+dt``````

Handout

To find the appropriate velocity of the airbag, we must divide this problem into several parts. Since horizontal and vertical motion are independent, we can first find the total time it will take for the bike to fall to the ground. Looking at the code, we see that for the provided target size and table height, the total distance the bike will fall is 1.25 meters. Knowing that the acceleration due to gravity is approximately -10 meters per second per second, we can use the following kinematic equation to solve for time: y=y0+(v_y)t+(1/2)(a_y)t^2. Plugging in our knowns, we find 0=1.25−10t^2. Rearranging and solving for t, we calculate that the total time it takes for the bike to hit the target once it falls off the cliff is 0.5 seconds.

Next we need to find out how far the bike travels horizontally as it falls off the cliff. Multiplying the initial bike velocity (4 m/s) by the time it takes to fall (0.5 s) tells us the bike will travel 2 meters in the positive x-direction as it falls.

Then, we need to find the time it takes for the bike to ride off the cliff. Again looking at the code, we see that the bike starts 2 meters away from the cliff. Dividing this distance by the initial horizontal speed of the bike, we find it will take the bike 0.5 seconds to travel over the edge.

Subsequently, we will calculate how far the airbag will have to move so that it will reach the bike when it lands. Taking note of the initial position of the airbag and the final position of the bike, we find the total distance the airbag has to move is 2 meters.

Finally, we can calculate the airbag speed. By dividing the distance the airbag has to travel by the total time it takes for the bike to fall—0.5 seconds to reach the edge of the cliff plus another 0.5 seconds to reach the ground—we compute that velocity of the airbag must be -2 meters per second (2 m/s in the negative x-direction).

Code

``````GlowScript 2.8 VPython
#Projectile and moving target challenge
'''
The people in charge of personnel safety at Cirque du Soleil are concerned about
the level of danger in your proposed stunt.  In order to reassure them that you have
a reasonable chance of being successful with the stunt, you are going to create a computer simulation.

Using the minimally working code and the vehicle velocity value from your stunt coordinator,
create a simulation that shows you will hit the moving airbag.  Be sure to include
velocity vs time graphs of both your horizontal and vertical velocities over time.
'''

# scene set up DO NOT CHANGE.
scene.align='left'
scene.width=400
scene.height=200
#scene fov is scaling factor(in radians) greater than 1 zooms out, less than in.
scene.fov=.25

# System Objects
Table=box(pos=vec(-1,-.55,0),size=vec(2,1.1,2),color=color.orange)
Ground=box(pos=vec(1,-1.2,-4),size=vec(6,.2,10),color=color.green)
# ADD you must add some sort of target that starts at either end of the floor
# Your target width should be the diamter of the ball
# Be mindful your target height will affect your calculations, do not choose a height greater than 0.25
Target=box(pos=vec(3.8,-1.05,.5), size=vec(.4,.1,.4), color=color.blue)
# DO NOT CHANGE. Tells he camera to follow ground after ground has been defined.
scene.camera.follow(Ground)

# system parameters
# DO NOT CHANGE. Time step rate and total run time
dt = 0.01
t = 0
tf = 5
# DO NOT CHANGE. Assigns initial vector values to objects set to zero so the can be defined later.
Ball.velocity=vector(0,0,0)
Ball.acc=vector(0,0,0)
Target.velocity=vector(0,0,0)

# You will be assigned a velocity for the ball by your teacher.
Ballvx=4
# Enter the velocity for the target that you calculate it needs to have in order for the ball to hit it.
Targetvx=-2

# DO NOT CHANGE. Defines ball and target vectors as what you assigned above and as earths free acceleration.
Ball.velocity.x=Ballvx
Ball.acc.y=-10
Target.velocity.x=Targetvx

#Enter lines of code to produce a velocity time graph for the projectile
velocityGraph = graph(align='left',width=400, height=200,title='velocity vs time', xtitle='time (s)', ytitle='velocity (m/s)',fast=False)
velocityyGraph = gcurve(color=color.green, label='velocity y')
velocityxGraph = gcurve(color=color.blue, label='velocity x')

#DO NOT CHANGE. Button Code allows you to run/pause and reset the intial conditions
running=False

def Run(b):
global running
running=not running
if running: b.text="Pause"
else: b.text="Run"

bbutton=button(text="Run", pos=scene.title_anchor, bind=Run)

def Reset(c):
global t, Ball

t=0
Ball.pos=vec(-1.9,0.2,.5)
Ball.acc=vec(0,-10,0)
Ball.velocity.x=Ballvx
Ball.velocity.y=0
Target.velocity.x=Targetvx
Target.pos=vec(3.8,-1.05,.5)
cbutton=button(text="Reset", pos=scene.title_anchor, bind=Reset)
#End of Button Code

'''
Run the code and see what happens.

Assuming the ball is the stuntman bicyclist and the target is the truck with an airbag,
Make adjustments to the initial conditions of the program and/or
write additional code so the program can serve as evidence to safety personnel that
the stunt is physically possible.
'''
#While true just means run the code all of the time.
while True:

rate(100)

if running:    #starts the loop when the run button is pressed.
Ball.pos.x=Ball.pos.x+(Ball.velocity.x*dt)
#Enter a line of code that gets the target to start moving when the run button is pressed.
Target.pos.x=Target.pos.x+(Target.velocity.x*dt)
#Enter another if statement that allows the ball to fall when it gets to the edge of the table.
if Ball.pos.x>0 and Ball.pos.y>-.8:
Ball.velocity.y=Ball.velocity.y+(Ball.acc.y*dt)
Ball.pos.y=Ball.pos.y+Ball.velocity.y*dt

# Do not modifiy the lines of code below this line.  It stops the ball and target when
# they have the same x position.  While the code is still running the objects don't move when x positions are the same
if abs(Ball.pos.x-Target.pos.x)<.03:  # less than small increment is needed in case calculation never reaches exactly zero.
Ball.velocity.x=0
Target.velocity.x=0
Ball.acc.y=0
Ball.velocity.y=0

# add the code for the velocity time graph so it gets updated in the loop
velocityyGraph.plot(t,Ball.velocity.y)
velocityxGraph.plot(t,Ball.velocity.x)

t=t+dt``````