GPS Navigation
Create an algorithm to navigate the Hero Bot to a specific position on the Field. Use [Drive for] and [Turn to heading] blocks, the GPS Sensor, the Arm Motor, and the Intake Motor to drive the Hero Bot to the position located at (1380,-1380) to pick up the Triball highlighted in red. Then drive the robot to the position located at(600,-300) and score the Triball in the Red Alliance Goal.
- Select the VRC Virtual Skills - Over Under Playground.
- Use the Pre-Match checklist to select Starting Location “H”, Starting Direction ”North”, and Robot Preload “No” for the robot.
- Create an algorithm to navigate the robot to a specific position.
- Code the robot to spin the Arm Motor to fully lower the Arm for picking up a Triball on the Field.
- Use the algorithm to navigate the robot to coordinates (1380, -1380) and turn the robot to Heading 135 degrees.
- Code the robot to spin the Intake Motor to pick up the Green Triball highlighted in red.
- Use the algorithm to navigate the robot to coordinates (600, -300) and turn the robot to Heading 90 degrees.
- Code the robot to spin the Intake Motor to launch the Triball to the Red Alliance Goal.
Helpful Hints
- Use the GPS Sensor to identify the X and Y coordinates of the Hero Bot on the Field. For more information about using the GPS Sensor in the VRC Over Under Playground, please click here.
Use the Reporter blocks from the Sensing category to get positional values from the GPS Sensor.


Matching Python command:
gps.x_position(MM) gps.y_position(MM)
Use the set blocks from the Variables category to declare two variables to store the original X and Y coordinates of the Hero Bot.

Matching Python command:
X1 = gps.x_position(MM) Y1 = gps.y_position(MM)
For help with declaring a variable and storing data in the project, please select the “TUTORIALS” button in VEXcode VR and choose the Storing Data Tutorial.


- For more information about the name rules for variables in VEXcode VR, please see this article.
- Use the coordinates of the robot (x1,y1), the coordinates of the target position(x2,y2), and atan function to find the drive Heading.
Calculate the angle theta θ of the line connecting these two points.


Convert the angle theta θ to drive Heading.
Pseudocode example for Math expression (Starting Direction: North):
if X1 equal to X2: if Y2 > Y1: heading = 0 else: heading = 180 else: if X2 > X1: heading = 90 - atan((Y2 - Y1) / (X2 - X1)) else: heading = 270 - atan((Y2 - Y1) / (X2 - X1))
Use the function block from the Operators category and select the atan function to calculate the angle theta θ

Matching Python command:
math.atan( ) / math.pi * 180
Use the coordinates of the robot (x1,y1), the coordinates of the target position(x2,y2), and the Pythagorean Theorem to find the drive distance.


Use the function block from the Operators category and select sqrt function to calculate drive distance.

Matching Python command:
math.sqrt( )