Repository navigation
Expand file tree
/
Copy pathConstants.java
More file actions
75 lines (65 loc) · 3.44 KB
/
Copy pathConstants.java
File metadata and controls
75 lines (65 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package org.firstinspires.ftc.teamcode;
import com.acmerobotics.dashboard.config.Config;
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.ThreeWheelIMUConstants;
import com.pedropathing.paths.PathConstraints;
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
@Config
public class Constants {
public static FollowerConstants followerConstants = new FollowerConstants()
.mass(10.75) // 23.7 lbs or 10.75 kg
.forwardZeroPowerAcceleration(-30)
.lateralZeroPowerAcceleration(-58.4)
.useSecondaryTranslationalPIDF(true)
.useSecondaryHeadingPIDF(true)
.useSecondaryDrivePIDF(false)
.translationalPIDFCoefficients(new PIDFCoefficients(0.1, 0, 0, 0))
.secondaryTranslationalPIDFCoefficients(new PIDFCoefficients(0.3, 0, 0.01, 0.015))
.headingPIDFCoefficients(new PIDFCoefficients(1, 0, 0, 0.01))
.secondaryHeadingPIDFCoefficients(new PIDFCoefficients(5, 0, 0.08, 0.01))
.drivePIDFCoefficients(new FilteredPIDFCoefficients(0.015, 0, 0.00001, 0.6, 0.01));
// .secondaryDrivePIDFCoefficients(new FilteredPIDFCoefficients(4, 0, 0.08, 0.01, 0.01))
public static MecanumConstants driveConstants = new MecanumConstants()
.maxPower(1)
.rightFrontMotorName("frontR")
.rightRearMotorName("backR")
.leftRearMotorName("backL")
.leftFrontMotorName("frontL")
.leftFrontMotorDirection(DcMotorSimple.Direction.REVERSE)
.leftRearMotorDirection(DcMotorSimple.Direction.REVERSE)
.rightFrontMotorDirection(DcMotorSimple.Direction.FORWARD)
.rightRearMotorDirection(DcMotorSimple.Direction.FORWARD)
.xVelocity(76)
.yVelocity(58.5);
public static ThreeWheelIMUConstants localizerConstants = new ThreeWheelIMUConstants()
.forwardTicksToInches(.001989436789)
.strafeTicksToInches(.001989436789)
.turnTicksToInches(.0019945)
.leftPodY(2.1384)
.rightPodY(-2.1384)
.strafePodX(-1.9)
.leftEncoder_HardwareMapName("backL")
.rightEncoder_HardwareMapName("frontR")
.strafeEncoder_HardwareMapName("backR")
.leftEncoderDirection(Encoder.REVERSE)
.rightEncoderDirection(Encoder.REVERSE)
.strafeEncoderDirection(Encoder.REVERSE)
.IMU_HardwareMapName("imu")
.IMU_Orientation(new RevHubOrientationOnRobot(RevHubOrientationOnRobot.LogoFacingDirection.LEFT, RevHubOrientationOnRobot.UsbFacingDirection.BACKWARD));
public static PathConstraints pathConstraints = new PathConstraints(0.99, 100, 1, 1);
public static Follower createFollower(HardwareMap hardwareMap) {
return new FollowerBuilder(followerConstants, hardwareMap)
.threeWheelIMULocalizer(localizerConstants)
.pathConstraints(pathConstraints)
.mecanumDrivetrain(driveConstants)
.build();
}
}