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
    • $\Sigma F \neq 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

Link

  1. GlowScript 2.8 VPython
  2. #Projectile and moving target challenge
  3. '''
  4. The people in charge of personnel safety at Cirque du Soleil are concerned about
  5. the level of danger in your proposed stunt. In order to reassure them that you have
  6. a reasonable chance of being successful with the stunt, you are going to create a computer simulation.
  7.  
  8. Using the minimally working code and the vehicle velocity value from your stunt coordinator,
  9. create a simulation that shows you will hit the moving airbag. Be sure to include
  10. velocity vs time graphs of both your horizontal and vertical velocities over time.
  11. '''
  12.  
  13. # scene set up DO NOT CHANGE.
  14. scene.align='left'
  15. scene.width=400
  16. scene.height=200
  17. #scene fov is scaling factor(in radians) greater than 1 zooms out, less than in.
  18. scene.fov=.25
  19.  
  20. # System Objects
  21. Table=box(pos=vec(-1,-.55,0),size=vec(2,1.1,2),color=color.orange)
  22. Ground=box(pos=vec(1,-1.2,-4),size=vec(6,.2,10),color=color.green)
  23. Ball=sphere(pos=vec(-1.9,0.2,.5), radius=.2,color=color.magenta)
  24. # ADD you must add some sort of target that starts at either end of the floor
  25. # Your target width should be the diamter of the ball
  26. # Be mindful your target height will affect your calculations, do not choose a height greater than 0.25
  27.  
  28. # DO NOT CHANGE. Tells he camera to follow ground after ground has been defined.
  29. scene.camera.follow(Ground)
  30.  
  31. # system parameters
  32. # DO NOT CHANGE. Time step rate and total run time
  33. dt = 0.01
  34. t = 0
  35. tf = 5
  36. # DO NOT CHANGE. Assigns initial vector values to objects set to zero so the can be defined later.
  37. Ball.velocity=vector(0,0,0)
  38. Ball.acc=vector(0,0,0)
  39. Target.velocity=vector(0,0,0)
  40.  
  41.  
  42. # You will be assigned a velocity for the ball by your teacher.
  43. Ballvx=0
  44. # Enter the velocity for the target that you calculate it needs to have in order for the ball to hit it.
  45. Targetvx=0
  46.  
  47. # DO NOT CHANGE. Defines ball and target vectors as what you assigned above and as earths free acceleration.
  48. Ball.velocity.x=Ballvx
  49. Ball.acc.y=-10
  50. Target.velocity.x=Targetvx
  51.  
  52. #Enter lines of code to produce a velocity time graphs in the x and y direction for the projectile
  53. velocityGraph = graph(align='left',width=400, height=200,title='velocity vs time', xtitle='time (s)', ytitle='velocity (m/s)',fast=False)
  54.  
  55.  
  56. #Only change line 76 . Button Code allows you to run/pause and reset the intial conditions
  57. running=False
  58.  
  59. def Run(b):
  60. global running
  61. running=not running
  62. if running: b.text="Pause"
  63. else: b.text="Run"
  64.  
  65. bbutton=button(text="Run", pos=scene.title_anchor, bind=Run)
  66.  
  67. def Reset(c):
  68. global t, Ball
  69.  
  70. t=0
  71. Ball.pos=vec(-1.9,0.2,.5)
  72. Ball.acc=vec(0,-10,0)
  73. Ball.velocity.x=Ballvx
  74. Ball.velocity.y=0
  75. Target.velocity.x=Targetvx
  76. #copy in the initial target position as assigned above when creating the target.
  77. cbutton=button(text="Reset", pos=scene.title_anchor, bind=Reset)
  78. #End of Button Code
  79.  
  80. '''
  81. Run the code and see what happens.
  82.  
  83. Assuming the ball is the stuntman bicyclist and the target is the truck with an airbag,
  84. Make adjustments to the initial conditions of the program and/or
  85. write additional code so the program can serve as evidence to safety personnel that
  86. the stunt is physically possible.
  87. '''
  88. #While true just means run the code all of the time.
  89. while True:
  90.  
  91. rate(100)
  92.  
  93. if running: #starts the loop when the run button is pressed.
  94. Ball.pos.x=Ball.pos.x+(Ball.velocity.x*dt)
  95. #Enter a line of code that gets the target to start moving when the run button is pressed.
  96.  
  97. #Enter another if statement that allows the ball to fall when it gets to the edge of the table.
  98. #The statement will need conditions for when to work and likely require multiple lines of code.
  99.  
  100.  
  101.  
  102. # Do not modifiy the lines of code below this line. It stops the ball and target when
  103. # they have the same x position. While the code is still running the objects don't move when x positions are the same
  104. if abs(Ball.pos.x-Target.pos.x)<.03: # less than small increment is needed in case calculation never reaches exactly zero.
  105. Ball.velocity.x=0
  106. Target.velocity.x=0
  107. Ball.acc.y=0
  108. Ball.velocity.y=0
  109.  
  110. # add the code for the velocity time graph so it gets updated in the loop
  111.  
  112.  
  113.  
  114.  
  115. t=t+dt

Answer Key

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=y_0+v_yt+\dfrac{1}{2}a_yt^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

  1. GlowScript 2.8 VPython
  2. #Projectile and moving target challenge
  3. '''
  4. The people in charge of personnel safety at Cirque du Soleil are concerned about
  5. the level of danger in your proposed stunt. In order to reassure them that you have
  6. a reasonable chance of being successful with the stunt, you are going to create a computer simulation.
  7.  
  8. Using the minimally working code and the vehicle velocity value from your stunt coordinator,
  9. create a simulation that shows you will hit the moving airbag. Be sure to include
  10. velocity vs time graphs of both your horizontal and vertical velocities over time.
  11. '''
  12.  
  13. # scene set up DO NOT CHANGE.
  14. scene.align='left'
  15. scene.width=400
  16. scene.height=200
  17. #scene fov is scaling factor(in radians) greater than 1 zooms out, less than in.
  18. scene.fov=.25
  19.  
  20. # System Objects
  21. Table=box(pos=vec(-1,-.55,0),size=vec(2,1.1,2),color=color.orange)
  22. Ground=box(pos=vec(1,-1.2,-4),size=vec(6,.2,10),color=color.green)
  23. Ball=sphere(pos=vec(-1.9,0.2,.5), radius=.2,color=color.magenta)
  24. # ADD you must add some sort of target that starts at either end of the floor
  25. # Your target width should be the diamter of the ball
  26. # Be mindful your target height will affect your calculations, do not choose a height greater than 0.25
  27. Target=box(pos=vec(3.8,-1.05,.5), size=vec(.4,.1,.4), color=color.blue)
  28. # DO NOT CHANGE. Tells he camera to follow ground after ground has been defined.
  29. scene.camera.follow(Ground)
  30.  
  31. # system parameters
  32. # DO NOT CHANGE. Time step rate and total run time
  33. dt = 0.01
  34. t = 0
  35. tf = 5
  36. # DO NOT CHANGE. Assigns initial vector values to objects set to zero so the can be defined later.
  37. Ball.velocity=vector(0,0,0)
  38. Ball.acc=vector(0,0,0)
  39. Target.velocity=vector(0,0,0)
  40.  
  41.  
  42. # You will be assigned a velocity for the ball by your teacher.
  43. Ballvx=4
  44. # Enter the velocity for the target that you calculate it needs to have in order for the ball to hit it.
  45. Targetvx=-2
  46.  
  47. # DO NOT CHANGE. Defines ball and target vectors as what you assigned above and as earths free acceleration.
  48. Ball.velocity.x=Ballvx
  49. Ball.acc.y=-10
  50. Target.velocity.x=Targetvx
  51.  
  52. #Enter lines of code to produce a velocity time graph for the projectile
  53. velocityGraph = graph(align='left',width=400, height=200,title='velocity vs time', xtitle='time (s)', ytitle='velocity (m/s)',fast=False)
  54. velocityyGraph = gcurve(color=color.green, label='velocity y')
  55. velocityxGraph = gcurve(color=color.blue, label='velocity x')
  56.  
  57. #DO NOT CHANGE. Button Code allows you to run/pause and reset the intial conditions
  58. running=False
  59.  
  60. def Run(b):
  61. global running
  62. running=not running
  63. if running: b.text="Pause"
  64. else: b.text="Run"
  65.  
  66. bbutton=button(text="Run", pos=scene.title_anchor, bind=Run)
  67.  
  68. def Reset(c):
  69. global t, Ball
  70.  
  71. t=0
  72. Ball.pos=vec(-1.9,0.2,.5)
  73. Ball.acc=vec(0,-10,0)
  74. Ball.velocity.x=Ballvx
  75. Ball.velocity.y=0
  76. Target.velocity.x=Targetvx
  77. Target.pos=vec(3.8,-1.05,.5)
  78. cbutton=button(text="Reset", pos=scene.title_anchor, bind=Reset)
  79. #End of Button Code
  80.  
  81. '''
  82. Run the code and see what happens.
  83.  
  84. Assuming the ball is the stuntman bicyclist and the target is the truck with an airbag,
  85. Make adjustments to the initial conditions of the program and/or
  86. write additional code so the program can serve as evidence to safety personnel that
  87. the stunt is physically possible.
  88. '''
  89. #While true just means run the code all of the time.
  90. while True:
  91.  
  92. rate(100)
  93.  
  94. if running: #starts the loop when the run button is pressed.
  95. Ball.pos.x=Ball.pos.x+(Ball.velocity.x*dt)
  96. #Enter a line of code that gets the target to start moving when the run button is pressed.
  97. Target.pos.x=Target.pos.x+(Target.velocity.x*dt)
  98. #Enter another if statement that allows the ball to fall when it gets to the edge of the table.
  99. if Ball.pos.x>0 and Ball.pos.y>-.8:
  100. Ball.velocity.y=Ball.velocity.y+(Ball.acc.y*dt)
  101. Ball.pos.y=Ball.pos.y+Ball.velocity.y*dt
  102.  
  103. # Do not modifiy the lines of code below this line. It stops the ball and target when
  104. # they have the same x position. While the code is still running the objects don't move when x positions are the same
  105. if abs(Ball.pos.x-Target.pos.x)<.03: # less than small increment is needed in case calculation never reaches exactly zero.
  106. Ball.velocity.x=0
  107. Target.velocity.x=0
  108. Ball.acc.y=0
  109. Ball.velocity.y=0
  110.  
  111. # add the code for the velocity time graph so it gets updated in the loop
  112. velocityyGraph.plot(t,Ball.velocity.y)
  113. velocityxGraph.plot(t,Ball.velocity.x)
  114.  
  115. t=t+dt

See Also

  • repository/cirque_du_soleil_stunt.txt
  • Last modified: 2021/02/18 19:36
  • by porcaro1