Ship's Code
The Scrapyard
Half-finished experiments, debugging sketches, and the things that exploded in the build bay. Nothing here is guaranteed to work — handle with care.
Looking for the stuff that actually works? Back to the code book.
package org.firstinspires.ftc.teamcode.pedroPathing;
import com.pedropathing.follower.Follower;
import com.pedropathing.follower.FollowerConstants;
import com.pedropathing.ftc.FollowerBuilder;
import com.pedropathing.ftc.drivetrains.MecanumConstants;
import com.pedropathing.ftc.localization.Encoder;
import com.pedropathing.ftc.localization.constants.DriveEncoderConstants;
import com.pedropathing.ftc.localization.constants.ThreeWheelConstants;
import com.pedropathing.paths.PathConstraints;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
public class Constants {
public static FollowerConstants followerConstants = new FollowerConstants()
.mass(4.2);
public static PathConstraints pathConstraints = new PathConstraints(0.99, 100, 1, 1);
public static MecanumConstants driveConstants = new MecanumConstants()
.maxPower(1)
.rightFrontMotorName("rf")
.rightRearMotorName("rr")
.leftRearMotorName("lr")
.leftFrontMotorName("lf")
.leftFrontMotorDirection(DcMotorSimple.Direction.REVERSE)
.leftRearMotorDirection(DcMotorSimple.Direction.REVERSE)
.rightFrontMotorDirection(DcMotorSimple.Direction.FORWARD)
.rightRearMotorDirection(DcMotorSimple.Direction.FORWARD);
public static DriveEncoderConstants localizerConstants = new DriveEncoderConstants()
.rightFrontMotorName("rf")
.rightRearMotorName("rr")
.leftRearMotorName("lr")
.leftFrontMotorName("lf")
.leftFrontEncoderDirection(Encoder.FORWARD)
.leftRearEncoderDirection(Encoder.FORWARD)
.rightFrontEncoderDirection(Encoder.FORWARD)
.rightRearEncoderDirection(Encoder.FORWARD)
.forwardTicksToInches(multiplier)
.strafeTicksToInches(multiplier)
.turnTicksToInches(multiplier);
public static Follower createFollower(HardwareMap hardwareMap) {
return new FollowerBuilder(followerConstants, hardwareMap)
.driveEncoderLocalizer(localizerConstants)
.pathConstraints(pathConstraints)
.mecanumDrivetrain(driveConstants)
.build();
}
}
package org.firstinspires.ftc.teamcode.pedroPathing;
import com.pedropathing.control.FilteredPIDFCoefficients;
import com.pedropathing.control.PIDFCoefficients;
import com.pedropathing.follower.Follower;
import com.pedropathing.follower.FollowerConstants;
import com.pedropathing.ftc.FollowerBuilder;
import com.pedropathing.ftc.drivetrains.MecanumConstants;
import com.pedropathing.ftc.localization.Encoder;
import com.pedropathing.ftc.localization.constants.DriveEncoderConstants;
import com.pedropathing.ftc.localization.constants.ThreeWheelConstants;
import com.pedropathing.ftc.localization.constants.TwoWheelConstants;
import com.pedropathing.paths.PathConstraints;
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
public class Constants {
public static FollowerConstants followerConstants = new FollowerConstants()
.mass(4.2)
// only un comment if robot is built and started tuning
//.forwardZeroPowerAcceleration()
//.lateralZeroPowerAcceleration()
//.translationalPIDFCoefficients(new PIDFCoefficients(0,0,0,0))
//.headingPIDFCoefficients(new PIDFCoefficients(0,0,0,0))
//.drivePIDFCoefficients(new FilteredPIDFCoefficients(0,0,0,0))
.centripetalScaling(0.0005)
;
public static PathConstraints pathConstraints = new PathConstraints(
0.99,
100,
1,
1);
public static MecanumConstants driveConstants = new MecanumConstants()
.maxPower(1)
.rightFrontMotorName("rf")
.rightRearMotorName("rr")
.leftRearMotorName("lr")
.leftFrontMotorName("lf")
.leftFrontMotorDirection(DcMotorSimple.Direction.REVERSE)
.leftRearMotorDirection(DcMotorSimple.Direction.REVERSE)
.rightFrontMotorDirection(DcMotorSimple.Direction.FORWARD)
.rightRearMotorDirection(DcMotorSimple.Direction.FORWARD)
//.xVelocity()
//.yVelocity()
;
public static DriveEncoderConstants localizerConstants = new DriveEncoderConstants()
.rightFrontMotorName("rf")
.rightRearMotorName("rr")
.leftRearMotorName("lr")
.leftFrontMotorName("lf")
.leftFrontEncoderDirection(Encoder.FORWARD)
.leftRearEncoderDirection(Encoder.FORWARD)
.rightFrontEncoderDirection(Encoder.FORWARD)
.rightRearEncoderDirection(Encoder.FORWARD)
.forwardTicksToInches(multiplier)
.strafeTicksToInches(multiplier)
.turnTicksToInches(multiplier);
public static TwoWheelConstants localizerConstantsForPods = new TwoWheelConstants()
.forwardEncoder_HardwareMapName("leftFront")
.strafeEncoder_HardwareMapName("rightRear")
.IMU_HardwareMapName("imu")
.IMU_Orientation(
new RevHubOrientationOnRobot(
RevHubOrientationOnRobot.LogoFacingDirection.BACKWARD,
RevHubOrientationOnRobot.UsbFacingDirection.LEFT
)
);
public static Follower createFollower(HardwareMap hardwareMap) {
return new FollowerBuilder(followerConstants, hardwareMap)
.driveEncoderLocalizer(localizerConstants)
.twoWheelLocalizer(localizerConstantsForPods)
.pathConstraints(pathConstraints)
.mecanumDrivetrain(driveConstants)
.build();
}
}