Skip to main content

Follow the Shortest Route

Create a coordinate system on the VIQC Virtual Skills Field with the initial position of the Hero Bot as the origin(0,0). Create an algorithm to use [Drive for], [Turn to heading], and [Spin for] blocks to drive the Hero Bot following the shortest route to specific positions to remove all the Discs from a blue Dispenser and the yellow Dispenser, and pick up a Disc as fast as possible!

  • Select the VIQC Virtual Skills - Slapshot Playground.
  • Drive the Hero Bot to the position located at (0, 290) along the shortest route.
  • Code the Hero Bot to turn to the blue Dispenser and remove all the Discs from it.
  • Drive the Hero Bot to the position located at (1000, 175) along the shortest route.
  • Code the Hero Bot to turn to the yellow Dispenser and remove all the Discs from it.
  • Drive the Hero Bot to the position located at (730, 329) along the shortest route.
  • Code the Hero Bot to spin the Intake Motor to intake a Disc.

Helpful Hints

  • The line between the robot’s current position and the target position is the shortest route to drive the robot to the target.
  • Use two variables to record and store the current X and Y coordinates of the Hero Bot.
  • Use the Pythagorean Theorem to calculate the drive distance. Use the Atan function to find the drive heading.

    Equations on the left and a diagram on the right. The pythagorean theorem is defined as 'C equals the square root of A squared plus B squared'. The vertical distance between two points is defined as 'A = Y2 - Y1', and the horizontal is defined as 'B = X2 - X1'. The variable C represents the drive distance. The diagram shows the relationship between A, B, and C in a triangle, with the robot at point BC and the second position at AC. The angle theta is defined as being above negative pi over 2, and being below positive pi over 2.

    An equation and a diagram demonstrating the use of the atan function defined as 'theta equals atan of A over B'. The result, theta, will be between negative pi over 2 and positive pi over 2. A diagram on the right shows the robot with a circle drawn around it and is titled 'Convert theta to drive heading'.