The V5 GPS (Game Positioning System) Sensor is designed to track and report the X, Y position and heading of the robot on the Field in real time. This allows you to know your robot's location at all times, or program advanced autonomous routines that can move to exact coordinates on the Field.
The following article will cover:
- Description of the GPS Sensor
- Mounting the GPS Sensor
- Identifying (X, Y) Coordinates on the VRC Field
- Using GPS Sensor Example Projects
- GPS Sensor Data on the V5 Brain’s Screen
- Configuring the GPS Sensor and Calculating the Offset
Description of the GPS Sensor
The GPS (Game Positioning System) Sensor, uses the VEX Field Code on the interior of the VRC Field to triangulate X, Y position and heading. That checkerboard pattern in the Field Code is used to identify the location for each individual block in that pattern. The VEX GPS is an absolute position system, so it does not drift nor does it require calibration on a per-field basis.
By default, the GPS Sensor reports the (X, Y) position of the GPS Sensor from the center of a Field, in millimeters or inches. However, if the GPS Sensor is not mounted on the point of a robot's center of rotation, a X/Y offset can be set in the GPS's configuration so that reported positional values can be based on the robot's center of rotation instead.
For more information on calculating the offset, view the Configuring the GPS Sensor and Calculating the Offset section of this article.
For more information on how to mount the GPS Field Code Strips on the VRC Field, view this article from the Knowledge Base.
Mounting the GPS Sensor
To sense the Field Code, the VEX GPS Sensor, a black and white camera, is recommended to be mounted on the rear of the robot and facing rearwards. The sensor should be mounted on the robot high enough off of the ground to be in line with the Field Code.
This is the recommended orientation because if the camera was mounted on the front of the robot and facing frontwards, the GPS Sensor’s field of view could be obstructed by game objects on the field, game objects picked up or being moved by the robot, or other robots in front of the sensor.
Identifying (X, Y) Coordinates on the VRC Field
The VRC Field ranges from approximately -1.8 meters (m) to 1.8 meters (m) for the X and Y positions.
The center location, or the origin (0,0), is located in the center of the Field.
Reporter blocks from the Sensing category in the Toolbox can be used to report positional values from the GPS Sensor in your VEXcode V5 project.
Using GPS Sensor Example Projects
Example projects are a great resource if you are just getting started with the GPS Sensor and want to explore different robot behaviors. Example projects also allow you to observe how different blocks in VEXcode V5 related to the GPS Sensor are used.
For more information on how to use Example projects in VEXcode V5, view this article from the Knowledge Base.
GPS Sensor Data on the V5 Brain’s Screen
Remove the V5 Brain Magnetic Screen Protector, turn on the Brain, and touch the Devices icon.
Select the GPS Sensor icon on the Device Info screen.
Move the robot around the field to observe the robot’s current location being displayed on the V5 Brain’s screen.
Ensure when moving the robot around that the GPS Sensor’s field of view is not obstructed. This would prevent the sensor from reading the Field Code correctly.
Note that the red arrow represents the front of the robot and that the white range displays the current view of the GPS Sensor facing the Field Code.
The displayed units, meters (m) or inches (in), can be changed by selecting the boxes containing the X and Y values on the Brain’s screen.
The current heading of the robot is also displayed in degrees.
The actual camera view of the GPS Sensor can also be displayed on the Brain’s screen when ‘Image’ is selected.
This will allow you to see exactly what the GPS Sensor is currently reading. This can help with the mounting of the sensor to ensure that it is mounted high enough to view the Field Code, as well as ensure that nothing is obstructing the view of the sensor.
Configuring the GPS Sensor and Calculating the Offset
View the following articles from the Knowledge Base for more information on how to add the GPS Sensor to the Robot Configuration.
To add the GPS Sensor to the Robot Configuration in VEXcode V5, the offset of where the sensor is mounted relative to the turning center point on the robot needs to be calculated.
The offset of the GPS Sensor is the distance of the sensor's mounting from the robot's turning center point.
In VEXcode V5, the predetermined location of the robot is the robot’s center point as shown in the Robot Configuration.
Measure how far away the GPS Sensor is mounted from the turning center of the robot in both the X and Y-axes in either millimeters (mm) or inches (in).
The offset is the distance that the physical GPS Sensor is away from the reference point. In this image of physical Moby, the reference point is Moby’s turning center point, and the GPS Sensor is mounted on the back of the robot. In order to configure the GPS Sensor properly, the Y-offset will need to be adjusted by -240 millimeters (mm).
The -240 millimeters (mm) is the distance from the reference point (turning center point) and the physical location of the GPS sensor (mounted on the back of Moby). The value is negative because the physical location of the GPS Sensor is along the negative y-axis in relation to the reference point (turning center point) acting as the (0, 0) location.
Input the measurement of how far the GPS Sensor is from the turning center of the robot along the x-axis in the Robot Configuration.
Note: the graphical location of the GPS Sensor in the Robot Configuration is only an illustration of approximate location and is not to any specific scale.
Input the measurement of how far the GPS Sensor is from the turning center of the robot along the y-axis in the Robot Configuration.
The angle of the GPS Sensor can also be adjusted. This is useful to orient the direction that the GPS Sensor is facing in relation to the robot's forward direction.
A yellow highlight is shown projected from the GPS Sensor’s field of view to show the orientation of the sensor in the Robot Configuration.
Note: the yellow highlight shown projected from the GPS Sensor’s field of view in the Robot Configuration is only an illustration of the physical sensor’s approximate field of view and is not to any specific scale.