Skip to main content

Along The Shortest Path

Create an algorithm to use [Drive for] and [Turn to heading] blocks, the GPS Sensor, the Optical Sensor, the intake motor group, and the Bottom Distance sensor to drive the Hero Bot along the shortest path to spin the Roller located at (-1040,1740) to red, then launch the three Discs highlighted in pink into the red High Goal as fast as possible!

  • Select the VRC Virtual Skills - Spin Up Playground.
  • Code the Hero Bot to drive to and spin the Roller located at (-1040,1740) to red.
    • Drive the Hero Bot to the position located at (-1000,1500) along the shortest route, turn toward the Roller, and make contact.
    • Use the intake motor group and the Roller Optical Sensor to spin the Roller to red, and create an algorithm to minimize the time to complete the rolling process.
  • Code the Hero Bot to drive and launch the Discs highlighted in pink into the red High Goal.
    • Drive the Hero Bot to the position located at (-600,1200) along the shortest route. Turn toward the pink-highlighted Discs. 
    • Use the Bottom Distance sensor to navigate the Hero Bot, and use the intake motor group to intake the three Discs one by one consecutively.
    • Turn the Hero Bot in the scoring direction and spin the intake motor group to launch the Discs.
  •  Set up a timer and see how quickly the Hero Bot can complete this task.

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 the GPS Sensor to identify the current X and Y coordinates of the Hero Bot. 

Use the Pythagorean Theorem to calculate the distance the robot needs to move. Use the Atan function to calculate Theta, and then convert Theta to the heading direction the robot needs to drive in.

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 variable theta is defined as 'theta = atan(a/b)'. The diagram on the right shows the robot with a circle drawn around it with the circle's 360 degrees labeled.