1. Points in the Coordinate Plane
A coordinate plane has vertical lines and horizontal lines that form the grid. The horizontal number line on the grid is called the x-axis. The vertical number line on the grid is called the y-axis. The two axes divide the coordinate plane into 4 quadrants.
An ordered pair of numbers describes a point on the coordinate grid. The first number in the ordered pair is the x-coordinate, which describes the horizontal location. The second number in the ordered pair is the y-coordinate, which describes the vertical location. The point where the two axes intersect at the point (0,0), or the origin.
2. Drive to an (x,y) Location
The drivexyTo block drives the robot to an (x,y) location on the grid:
The two input values in the blue blocks are the x coordinate and the y coordinate. These values can be any real numbers.
The robot will turn to face the (x,y) point and drive forward the correct distance to reach that point.
Examples 1 and 2 show how it works.
Play the video at top right to watch a video and learn more.
3. Drive to a Point Located (x, y) from Robot's Current Location
We can also drive the robot to a point (x, y) as measured from its current location using the drivexy block:
For example, if the robot is at the point x = 6 and y = 6, then drivexy(3, 4) would move it to the point that is 3 to the right from its current x location (6 + 3) and 4 up from its current y location (6 + 4). So it would drive directly to the pont (9, 10).
Positive numbers for the x value specify measurements to the right, and negative x values specify measurements to the left. Positive values for the y value specify measurements up, and negative y values specify measurements down.
Example 3 shows how it works.
Sometimes we call this relative movement or relative coordinates, because the location of the new point to drive to is specified relative to the current location.