Setting Up Your Pinpoint Localizer
Prerequisites
- Pinpoint module connected to an I2C port.
- Dead wheel encoder wires properly connected to the Pinpoint module.
Default Values
These are the default values of the PinpointConstants. You can copy and paste this into your static{}
block within LConstants
:
PinpointConstants.forwardY = 1;
PinpointConstants.strafeX = -2.5;
PinpointConstants.distanceUnit = DistanceUnit.INCH;
PinpointConstants.hardwareMapName = "pinpoint";
PinpointConstants.useYawScalar = false;
PinpointConstants.yawScalar = 1.0;
PinpointConstants.useCustomEncoderResolution = false;
PinpointConstants.encoderResolution = GoBildaPinpointDriver.GoBildaOdometryPods.goBILDA_4_BAR_POD;
PinpointConstants.customEncoderResolution = 13.26291192;
PinpointConstants.forwardEncoderDirection = GoBildaPinpointDriver.EncoderDirection.REVERSED;
PinpointConstants.strafeEncoderDirection = GoBildaPinpointDriver.EncoderDirection.FORWARD;
Steps
1. Setup
Navigate to the file LConstants
and into the static{}
block and configure the following:
- Pinpoint Port:
- Set the
PinpointConstants.hardwareMapName
variable to the name of the I2C port connected to the Pinpoint module. - Make sure that the I2C port is not the Control Hub built-in IMU port (port 0).
- Set the
- Odometry Measurements:
- Input the
forwardY
andstrafeX
values.- These values represent the distance of the odometry pods from the robot's center of rotation on the PEDRO robot coordinate grid.
- Do NOT use GoBilda's diagram, but Pedro's, linked above.
- The default values are
1
forforwardY
and-2.5
forstrafeX
. - The default distance measurement is in inches, which can be changed by modifying the
Pinpoint.distanceUnit
variable.
- Input the
- Encoder Resolution:
- By default, the encoder resolution is set to
GoBildaPinpointDriver.GoBildaOdometryPods.goBILDA_4_BAR_POD
. - If you are using a custom encoder resolution, set
PinpointConstants.useCustomEncoderResolution
totrue
and input the custom resolution in thePinpointConstants.customEncoderResolution
variable.
- By default, the encoder resolution is set to
- Encoder Directions:
- Ensure the encoder directions are correctly set. You can test this by running the
LocalizationTest
TeleOp Opmode.- If the
x
value ticks down when the robot moves forward, reverse the direction by changing theGoBildaPinpointDriver.EncoderDirection
values forPinpointConstants.forwardEncoderDirection
- If the
y
value ticks down when the robot moves left, reverse the direction by changing theGoBildaPinpointDriver.EncoderDirection
values forPinpointConstans.strafeEncoderDirection
.
- If the
- The default values are
GoBildaPinpointDriver.EncoderDirection.REVERSED
forforwardEncoderDirection
andGoBildaPinpointDriver.EncoderDirection.FORWARD
forstrafeEncoderDirection
.
- Ensure the encoder directions are correctly set. You can test this by running the
- Yaw Scalar:
- If you want to use a yaw scalar, set
PinpointConstants.useYawScalar
totrue
and input the scalar value in thePinpointConstants.yawScalar
variable. - Note: The Yaw Scalar overrides the calibration done by GoBilda. It is recommended to use leave
PinpointConstants.useYawScalar
asfalse
unless you have a specific reason to change it.
- If you want to use a yaw scalar, set
2. Verifying Pinpoint Connection
Run the SensorGoBildaPinpointExample.java
file located in the tuners
folder. This will ensure the Pinpoint is correctly connected and operational.
Testing Your Localizer
After completing the tuning steps, you can test your localizer's accuracy.
-
Go to
Localization Test
and drive your robot around. -
Open the FTC Dashboard at http://192.168.43.1:8080/dash.
-
Switch the view to "field view" from the top right corner dropdown.
-
The dashboard should display the robot's position on the field.
-
Observe the movements, moving the robot forward should make
x
increase and strafing left should makey
increase.