Rear-End Collision

Activity Information

Learning Goals

  • Apply the principles of constant velocity motion ( HS-PS2-1)
  • Create and modify computational models to describe/show a given system

Prior Knowledge Required

  • 1-Dimensional kinematics
    • The relationship between position, distance, displacement, speed, and velocity
    • Position vs. time and velocity vs. time graphs
  • Scalar and vector quantities

Code Manipulation

  • Copying/pasting code
  • Creating/using while loops
  • Converting mathematical equations into code

—-

Activity

Handout

Rear-End Collision

You are driving on the freeway and there is a blue car next to you in the left lane. The blue car is driving at a constant velocity. You notice a red car in your rear-view mirror in the left lane a certain distance behind the blue car. The red car appears to be going very fast and the driver is also looking down, likely texting. If the red car dirver continues to text and remains oblivious to the blue car in their lane, how much time does the driver of the blue car have to notice and take evasive cation before they are rear-ended?

  1. When and where will the crash occur?
  2. Create a position vs. time graph that includes both cars' motion (optional).

Note: when conducting this activity with students, the initial positions and velocities of the vehicles can be provided by the instructor, but for demonstration purposes they have been included in the code below.

To perform this virtual experiment in real life, constant velocity toy cars can be purchased here.

Code

Link

  1. GlowScript 2.7 VPython
  2. ## Code for a particle object and a red buggy and a blue buggy *Do not change!*
  3. #assume buggy positions are in meters
  4. redbuggy = box(pos=vector(-5,1,0), length = 2, width = 1, height = 1,color = color.red)
  5. bluebuggy = box(pos=vector(0,1,0), length = 2, width = 1, height = 1,color = color.blue)
  6. ground = box(pos=vector(0,0,0), length = 20, width = 1, height = 1, color=color.white)
  7.  
  8. ##Get your red/fast buggy and determine its velocity and define it in the redbuggy x vector below
  9. ##take your red/fast buggy back to your teacher
  10. ##Get your blue/slow buggy and determine its velocity and define it in the bluebuggy x vector below
  11. ##take your blue/slow buggy back to your teacher
  12. redbuggy.velocity = vector(5,0,0)
  13. bluebuggy.velocity = vector(3,0,0)
  14.  
  15. ## Set up the time variables for the while loop for a tf that seems to make sense
  16. dt = 0.01
  17. t = 0
  18. tf = 5
  19.  
  20. #a function to show accumulated time *Do not change!*
  21. def add_time(t,dt):
  22. new_t = t+dt
  23. return new_t
  24.  
  25. #Code for a way to start the program after a person clicks on screen *Do not change!*
  26. scene.waitfor('click')
  27.  
  28. ##Code for a "while loop" to make the program iterate over the time interval *Do not change!*
  29. while redbuggy.pos.x < bluebuggy.pos.x-2:
  30.  
  31. ## Define the rate at which the program runs the loop *Do not change!*
  32. rate(100)
  33.  
  34. ## Write a way for the program to update position of each buggy based on its velocity *Do not change!*
  35. redbuggy.pos = redbuggy.pos + redbuggy.velocity*dt
  36. bluebuggy.pos = bluebuggy.pos + bluebuggy.velocity*dt
  37.  
  38. #define how the program will calculate time for each iteration *Do not change!*
  39. t=add_time(t,dt)
  40.  
  41. #create a way for the program to show the time and postitions of the buggies *Do not change!*
  42. print("time=",t,"RedPos = ",redbuggy.pos.x,"BluePos = ", bluebuggy.pos.x)
  43.  
  44. #Use the program to determine how you will know when and where your buggies will collide!

Answer Key

Handout

We can solve for where and when the crash will occur by creating a system of equations and solving (much like we did in the Head-On Collision activity). Let's start by creating a kinematic equation describing the motion of the fast, red buggy: We know the initial position of the red buggy is 5 units to the left of the origin (line 4) and moving to the right with a velocity of 5 units or length per unit of time (line 12). Therefore, the kinematic equation to describe the position of the red buggy is $x=-5+5t$. Now let's do the same for the slower, blue buggy: $x=0+3t$ (lines 5 and 13). Setting these equations equal to each other will allow us to find out how long until the collisions: $-5+5t=0+3t$. However, we aren't quite ready to solve first; We need to remember that these buggies have a physical length of 2 (lines 3 and 4) while their positions in the code represent the centers of the buggies. We don't want to solve for when the cars are intersecting but rather when the front of the red buggy collides with the rear bumper of the blue buggy. We can compensate for this in the equations by adding a length unit for the red buggy equation and subtracting a length unit for the blue buggy equation: $x=-4+5t$ and $x=-1+3t$, respectively. Now we can solve for $t$ by setting the equations equal to one-another: $$-4+5t=1+3t$$ Simplifying we get $2t=3$ therefore $t=\dfrac{3}{2}=1.5$. The crash will occur after 1.5 units of time. We can plug this back into any of our two initial kinematic equations to find out where the crash will occur: $x=-4+5*1.5=-1+3*1.5=3.5$. The buggies will collide 3.5 units to the right of the origin; in other words (accounting for the length of each vehicle), the position of the center of the red buggy at the crash site will be at 2.5 units to the right of the orign and the the center of the blue buggy will be at 4.5 units.

See highlighted lines below to see important code modifications.

Code

  1. GlowScript 2.7 VPython
  2. ## Code for a particle object and a ground object
  3. redbuggy = box(pos=vector(-5,1,0), length = 2, width = 1, height = 1,color = color.red)
  4. bluebuggy = box(pos=vector(0,1,0), length = 2, width = 1, height = 1,color = color.blue)
  5. ground = box(pos=vector(0,0,0), length = 20, width = 1, height = 1, color=color.white)
  6.  
  7. ## Assign the particle a fixed velocity
  8. redbuggy.velocity = vector(5,0,0)
  9. bluebuggy.velocity = vector(3,0,0)
  10.  
  11. ## Creates an arrow to visualize the particle's velocity
  12. vArrow = arrow(pos=redbuggy.pos, axis = redbuggy.velocity, color = redbuggy.color)
  13. vArrow = arrow(pos=bluebuggy.pos, axis = bluebuggy.velocity, color = bluebuggy.color)
  14.  
  15. ## Set up the time variables for the while loop
  16. dt = 0.01
  17. t = 0
  18. tf = 5
  19.  
  20. def add_time(t,dt):
  21. new_t = t+dt
  22. return new_t
  23.  
  24. #Click Screen to Start
  25. scene.waitfor('click')
  26.  
  27. ## While loop to iterate over the time interval
  28. while redbuggy.pos.x < bluebuggy.pos.x-2:
  29.  
  30. rate(100) ## Defines the rate at which the program runs
  31.  
  32. ## Update position of particle based on its velocity
  33. redbuggy.pos = redbuggy.pos + redbuggy.velocity*dt
  34. bluebuggy.pos = bluebuggy.pos + bluebuggy.velocity*dt
  35.  
  36. #redbuggy.pos
  37.  
  38. ## Keep the arrow representing the particle's velocity and acceleration
  39. vArrow.pos = redbuggy.pos
  40. vArrow.axis = redbuggy.velocity
  41. vArrow.pos = bluebuggy.pos
  42. vArrow.axis = bluebuggy.velocity
  43.  
  44. t=add_time(t,dt)
  45.  
  46. print("time=",t,"RedPos = ",redbuggy.pos.x,"BluePos = ", bluebuggy.pos.x)

See Also

  • repository/rear-end_collision.txt
  • Last modified: 2021/02/17 18:33
  • by porcaro1