Appearance
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:
java
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.hardwareMapNamevariable 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
forwardYandstrafeXvalues.- 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
1forforwardYand-2.5forstrafeX. - The default distance measurement is in inches, which can be changed by modifying the
Pinpoint.distanceUnitvariable.
- 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.useCustomEncoderResolutiontotrueand input the custom resolution in thePinpointConstants.customEncoderResolutionvariable.
- By default, the encoder resolution is set to
- Encoder Directions:
- Ensure the encoder directions are correctly set. You can test this by running the
LocalizationTestTeleOp Opmode.- If the
xvalue ticks down when the robot moves forward, invert the direction by changing theGoBildaPinpointDriver.EncoderDirectionfor the forwardEncoder. - If the
yvalue ticks down when the robot moves left, invert the direction by changing theGoBildaPinpointDriver.EncoderDirectionfor the strafeEncoder.
- If the
- The default values are
GoBildaPinpointDriver.EncoderDirection.REVERSEDforforwardEncoderDirectionandGoBildaPinpointDriver.EncoderDirection.FORWARDforstrafeEncoderDirection.
- 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.useYawScalartotrueand input the scalar value in thePinpointConstants.yawScalarvariable. - Note: The Yaw Scalar overrides the calibration done by GoBilda. It is recommended to use leave
PinpointConstants.useYawScalarasfalseunless 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 Testand 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
xincrease and strafing left should makeyincrease.