-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
1,897 additions
and
2,009 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/constants/AutoStartPose.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/constants/PoseStorage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package org.firstinspires.ftc.teamcode.constants | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d | ||
import com.acmerobotics.roadrunner.Pose2d | ||
|
||
object PoseStorage { | ||
var poseEstimate = Pose2d() | ||
var poseEstimate = Pose2d(0.0, 0.0, 0.0) | ||
} |
2 changes: 1 addition & 1 deletion
2
...y/roadrunner/AutomaticFeedforwardTuner.kt → ...unner/tuning/AutomaticFeedforwardTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eamcode/legacy/roadrunner/BackAndForth.kt → .../legacy/roadrunner/tuning/BackAndForth.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...egacy/roadrunner/DriveVelocityPIDTuner.kt → ...oadrunner/tuning/DriveVelocityPIDTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ode/legacy/roadrunner/FollowerPIDTuner.kt → ...acy/roadrunner/tuning/FollowerPIDTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ode/legacy/roadrunner/LocalizationTest.kt → ...acy/roadrunner/tuning/LocalizationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...gacy/roadrunner/ManualFeedforwardTuner.kt → ...adrunner/tuning/ManualFeedforwardTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../legacy/roadrunner/MaxAngularVeloTuner.kt → .../roadrunner/tuning/MaxAngularVeloTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ode/legacy/roadrunner/MaxVelocityTuner.kt → ...acy/roadrunner/tuning/MaxVelocityTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...gacy/roadrunner/MotorDirectionDebugger.kt → ...adrunner/tuning/MotorDirectionDebugger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../teamcode/legacy/roadrunner/SplineTest.kt → ...de/legacy/roadrunner/tuning/SplineTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../teamcode/legacy/roadrunner/StrafeTest.kt → ...de/legacy/roadrunner/tuning/StrafeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eamcode/legacy/roadrunner/StraightTest.kt → .../legacy/roadrunner/tuning/StraightTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...code/legacy/roadrunner/TrackWidthTuner.kt → ...gacy/roadrunner/tuning/TrackWidthTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...runner/TrackingWheelForwardOffsetTuner.kt → ...tuning/TrackingWheelForwardOffsetTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nner/TrackingWheelLateralDistanceTuner.kt → ...ning/TrackingWheelLateralDistanceTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tc/teamcode/legacy/roadrunner/TurnTest.kt → ...code/legacy/roadrunner/tuning/TurnTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ires/ftc/teamcode/legacy/roadrunner/utils/roadrunner/drive/AprilTagThreeWheelLocalizer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.firstinspires.ftc.teamcode.legacy.roadrunner.utils.roadrunner.drive | ||
|
||
//class AprilTagThreeWheelLocalizer( | ||
// private val odometry: StandardTrackingWheelLocalizer, | ||
//) : Localizer { | ||
// private var _poseEstimate: Pose2d = Pose2d() | ||
// | ||
// override var poseEstimate: Pose2d | ||
// get() = _poseEstimate | ||
// set(value) { | ||
// _poseEstimate = value | ||
// } | ||
// | ||
// override val poseVelocity: Pose2d? = null | ||
// | ||
// override fun update() { | ||
// // Return a kalman filter that takes the pose estimate from the odometry and april tags to combine | ||
// odometry.update() | ||
// TODO("Not yet implemented") | ||
// } | ||
//} |
113 changes: 113 additions & 0 deletions
113
...org/firstinspires/ftc/teamcode/legacy/roadrunner/utils/roadrunner/drive/DriveConstants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package org.firstinspires.ftc.teamcode.legacy.roadrunner.utils.roadrunner.drive | ||
|
||
/* | ||
* Constants shared between multiple drive types. | ||
* | ||
* Constants generated by LearnRoadRunner.com/drive-constants | ||
* | ||
* TODO: Tune or adjust the following constants to fit your robot. Note that the non-final | ||
* fields may also be edited through the dashboard (connect to the robot's WiFi network and | ||
* navigate to https://192.168.49.1:8080/dash). Make sure to save the values here after you | ||
* adjust them in the dashboard; **config variable changes don't persist between app restarts**. | ||
* | ||
* These are not the only parameters; some are located in the localizer classes, drive base classes, | ||
* and op modes themselves. | ||
*/ | ||
|
||
//@Config | ||
//object DriveConstants { | ||
// /* | ||
// * These are motor constants that should be listed online for your motors. | ||
// */ | ||
// const val TICKS_PER_REV = 383.6 | ||
// const val MAX_RPM = 435.0 | ||
// | ||
// /* | ||
// * Set RUN_USING_ENCODER to true to enable built-in hub velocity control using drive encoders. | ||
// * Set this flag to false if drive encoders are not present and an alternative localization | ||
// * method is in use (e.g., tracking wheels). | ||
// * | ||
// * If using the built-in motor velocity PID, update MOTOR_VELO_PID with the tuned coefficients | ||
// * from DriveVelocityPIDTuner. | ||
// */ | ||
// const val RUN_USING_ENCODER = false | ||
// var MOTOR_VELO_PID = PIDFCoefficients( | ||
// 0.0, 0.0, 0.0, | ||
// getMotorVelocityF(MAX_RPM / 60 * TICKS_PER_REV) | ||
// ) | ||
// | ||
// /* | ||
// * These are physical constants that can be determined from your robot (including the track | ||
// * width; it will be tune empirically later although a rough estimate is important). Users are | ||
// * free to chose whichever linear distance unit they would like so long as it is consistently | ||
// * used. The default values were selected with inches in mind. Road runner uses radians for | ||
// * angular distances although most angular parameters are wrapped in Math.toRadians() for | ||
// * convenience. Make sure to exclude any gear ratio included in MOTOR_CONFIG from GEAR_RATIO. | ||
// */ | ||
// var WHEEL_RADIUS = 1.88976 // in` | ||
// var GEAR_RATIO = 1.0 // output (wheel) speed / input (motor) speed | ||
// @JvmField | ||
// var TRACK_WIDTH = 13.94 // in | ||
// | ||
// /* | ||
// * These are the feedforward parameters used to model the drive motor behavior. If you are using | ||
// * the built-in velocity PID, *these values are fine as is*. However, if you do not have drive | ||
// * motor encoders or have elected not to use them for velocity control, these values should be | ||
// * empirically tuned. | ||
// */ | ||
// @JvmField | ||
// var kV = 0.0144 | ||
// @JvmField | ||
// var kA = 0.0015 | ||
// @JvmField | ||
// var kStatic = 0.012 | ||
// | ||
// /* | ||
// * These values are used to generate the trajectories for you robot. To ensure proper operation, | ||
// * the constraints should never exceed ~80% of the robot's actual capabilities. While Road | ||
// * Runner is designed to enable faster autonomous motion, it is a good idea for testing to start | ||
// * small and gradually increase them later after everything is working. All distance units are | ||
// * inches. | ||
// */ | ||
// /* | ||
// * Note from LearnRoadRunner.com: | ||
// * The velocity and acceleration constraints were calculated based on the following equation: | ||
// * ((MAX_RPM / 60) * GEAR_RATIO * WHEEL_RADIUS * 2 * Math.PI) * 0.85 | ||
// * Resulting in 73.17330064499293 in/s. | ||
// * This is only 85% of the theoretical maximum velocity of the bot, following the recommendation above. | ||
// * This is capped at 85% because there are a number of variables that will preve nt your bot from actually | ||
// * reaching this maximum velocity: voltage dropping over the game, bot weight, general mechanical inefficiencies, etc. | ||
// * However, you can push this higher yourself if you'd like. Perhaps raise it to 90-95% of the theoretically | ||
// * max velocity. The theoretically maximum velocity is 86.08623605293286 in/s. | ||
// * Just make sure that your bot can actually reach this maximum velocity. Path following will be detrimentally | ||
// * affected if it is aiming for a velocity not actually possible. | ||
// * | ||
// * The maximum acceleration is somewhat arbitrary and it is recommended that you tweak this yourself based on | ||
// * actual testing. Just set it at a reasonable value and keep increasing until your path following starts | ||
// * to degrade. As of now, it simply mirrors the velocity, resulting in 73.17330064499293 in/s/s | ||
// * | ||
// * Maximum Angular Velocity is calculated as: maximum velocity / trackWidth * (180 / Math.PI) but capped at 360°/s. | ||
// * You are free to raise this on your own if you would like. It is best determined through experimentation. | ||
// | ||
// */ | ||
// @JvmField | ||
// var MAX_VEL = 30.0 | ||
// @JvmField | ||
// var MAX_ACCEL = 30.0 | ||
// @JvmField | ||
// var MAX_ANG_VEL = Math.toRadians(170.0) | ||
// @JvmField | ||
// var MAX_ANG_ACCEL = Math.toRadians(170.0) | ||
// fun encoderTicksToInches(ticks: Double): Double { | ||
// return WHEEL_RADIUS * 2 * Math.PI * GEAR_RATIO * ticks / TICKS_PER_REV | ||
// } | ||
// | ||
// fun rpmToVelocity(rpm: Double): Double { | ||
// return rpm * GEAR_RATIO * 2 * Math.PI * WHEEL_RADIUS / 60.0 | ||
// } | ||
// | ||
// fun getMotorVelocityF(ticksPerSecond: Double): Double { | ||
// // see https://docs.google.com/document/d/1tyWrXDfMidwYyP_5H4mZyVgaEswhOC35gvdmP-V-5hA/edit#heading=h.61g9ixenznbx | ||
// return 32767 / ticksPerSecond | ||
// } | ||
//} |
81 changes: 81 additions & 0 deletions
81
...s/ftc/teamcode/legacy/roadrunner/utils/roadrunner/drive/StandardTrackingWheelLocalizer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.firstinspires.ftc.teamcode.legacy.roadrunner.utils.roadrunner.drive | ||
|
||
/* | ||
* Sample tracking wheel localizer implementation assuming the standard configuration: | ||
* | ||
* /--------------\ | ||
* | ____ | | ||
* | ---- | | ||
* | || || | | ||
* | || || | | ||
* | | | ||
* | | | ||
* \--------------/ | ||
* | ||
*/ | ||
//@Config | ||
//class StandardTrackingWheelLocalizer(hardwareMap: HardwareMap) : ThreeTrackingWheelLocalizer( | ||
// listOf( | ||
// Pose2d(0.0, LATERAL_DISTANCE / 2, 0.0), // left | ||
// Pose2d(0.0, -LATERAL_DISTANCE / 2, 0.0), // right | ||
// Pose2d(FORWARD_OFFSET, 0.0, Math.toRadians(90.0)) // front | ||
// ) | ||
//) { | ||
// private val leftEncoder: Encoder | ||
// private val rightEncoder: Encoder | ||
// private val strafeEncoder: Encoder | ||
// | ||
// init { | ||
// leftEncoder = Encoder( | ||
// hardwareMap.get( | ||
// DcMotorEx::class.java, ControlBoard.ODO_LEFT_ENCODER.deviceName | ||
// ) | ||
// ) | ||
// | ||
// | ||
// rightEncoder = Encoder( | ||
// hardwareMap.get( | ||
// DcMotorEx::class.java, ControlBoard.ODO_RIGHT_ENCODER.deviceName | ||
// ) | ||
// ) | ||
// strafeEncoder = Encoder( | ||
// hardwareMap.get( | ||
// DcMotorEx::class.java, ControlBoard.ODO_STRAFE_ENCODER.deviceName | ||
// ) | ||
// ) | ||
//// strafeEncoder.direction = Encoder.Direction.REVERSE | ||
// } | ||
// | ||
// override fun getWheelPositions() = listOf( | ||
// encoderTicksToInches(leftEncoder.currentPosition.toDouble()) * X_MULTIPLIER, | ||
// encoderTicksToInches(rightEncoder.currentPosition.toDouble()) * X_MULTIPLIER, | ||
// encoderTicksToInches(strafeEncoder.currentPosition.toDouble()) * Y_MULTIPLIER | ||
// ) | ||
// | ||
// override fun getWheelVelocities() = listOf( | ||
// encoderTicksToInches(leftEncoder.correctedVelocity) * X_MULTIPLIER, | ||
// encoderTicksToInches(rightEncoder.correctedVelocity) * X_MULTIPLIER, | ||
// encoderTicksToInches(strafeEncoder.correctedVelocity) * Y_MULTIPLIER | ||
// ) | ||
// | ||
// companion object { | ||
// val TICKS_PER_REV = 2000.0 | ||
// val WHEEL_RADIUS = 0.944882 // in | ||
// val GEAR_RATIO = 1.0 // output (wheel) speed / input (encoder) speed | ||
// | ||
// @JvmField | ||
// var LATERAL_DISTANCE = 15.45 // in; distance between the left and right wheels | ||
// | ||
// @JvmField | ||
// var FORWARD_OFFSET = -2.1 // in; offset of the lateral wheel | ||
// | ||
// @JvmField | ||
// var X_MULTIPLIER = 0.9944039016245 // Multiplier in the X direction | ||
// @JvmField | ||
// var Y_MULTIPLIER = 0.99960646480333// Multiplier in the Y direction | ||
// fun encoderTicksToInches(ticks: Double): Double { | ||
// return WHEEL_RADIUS * 2 * Math.PI * GEAR_RATIO * ticks / TICKS_PER_REV | ||
// } | ||
// } | ||
//} |
3 changes: 3 additions & 0 deletions
3
.../teamcode/legacy/roadrunner/utils/roadrunner/trajectorysequence/EmptySequenceException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.firstinspires.ftc.teamcode.legacy.roadrunner.utils.roadrunner.trajectorysequence | ||
|
||
//class EmptySequenceException : RuntimeException() |
Oops, something went wrong.