Skip to main content

Aim the Goal

Create an algorithm to find the ideal launching direction for the Hero Bot positioned at a specific location to ensure scoring the Triball into the Goal successfully. Use [Drive for] and [Turn to heading] blocks, the GPS Sensor, the Arm Motor, and the Intake Motor to code the Hero Bot to pick up each of the three highlighted Triballs, drive to the position located at (600, 600), turn in the ideal direction, and launch the Triball in the Red Alliance Goal. The fastest time wins!

  • Select the VRC Virtual Skills - Over Under Playground.
  • Use the Pre-Match checklist to select a Starting Location, a Starting Direction, and Robot Preload “No” for the robot.
  • Create an algorithm to navigate the robot to a specific position.
  • Create an algorithm to navigate the robot to a position for picking up a Triball located at a specific position.
  • Create an algorithm to find an ideal launching direction to score the Triball into the Goal.
  • Code the robot to spin the Arm Motor to fully lower the Arm for picking up a Triball on the Field.
  • Code the Hero Bot to pick up the highlighted Triball located at (0,1500) and score it in the Red Alliance Goal. 
    • Use the algorithm to drive the robot to a position for picking up the highlighted Triball located at (0, 1500).
    • Code the robot to spin the Intake Motor to pick up the Triball.
    • Use the algorithm to navigate the robot to coordinates (600, 600).
    • Use the algorithm to find an ideal launching direction for the Hero Bot to score the Triball into the Goal. Turn the robot in the launching direction.
    • Code the robot to spin the Intake Motor to launch the Triball to the Red Alliance Goal.
  • Code the Hero Bot to pick up the highlighted Triball located at (1600, 1600) and score it in the Red Alliance Goal.
  • Code the Hero Bot to pick up the highlighted Triball located at (-125, 1075) and score it in the Red Alliance Goal. 
  • Use the [print] block to print the timer value to the Print Console.

Helpful Hints

  • Plan an expected trajectory for the Triball to find an ideal launching direction.
    • Plan a trajectory for the Triball to avoid the Triball colliding with the posts, the frame pips of the Goal, or the Triballs inside the Goal.
    • Select a position on the planned trajectory in the Goal as the aim point and identify the X and Y coordinates of the aim point.
    • Use the coordinates of the robot (x1,y1), the coordinates of the aim point (x2,y2), and atan function to find the launching direction.
      • Calculate the angle theta θ of the line connecting these two points. 

        Diagram of two math expressions. The first expression reads 'theta is equal to atan((y2 - y1) / (x2 - x1))'. The second expression reads 'negative pi / 2 is less than theta, which is less than pi / 2'.

        Top down math diagram shows the robot at coordinate (X1, Y1) and a line is pointing towards the coordinate (X2, Y2). The distance is labeled with the variable d, the angle is labeled with the variable theta. The horizontal distance between the points in represented as 'x2 - x1', and the vertical distance is represented as 'y2 - y1'.

    • Convert the angle theta θ to robot 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))

      Top down diagram shows the robot within a circle that has labels marking the circle's 360 degrees.

    • Use the function block from the Operators category and select the atan function to calculate the angle theta θ

      Empty VEXcode Function block that reads 'atan of blank'.

      • Matching Python command:

        math.atan( ) / math.pi * 180

For more information about using the GPS Sensor in the VRC Over Under Playground, please click here.