-
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.
hillel - files from road runner quickstart and meep meep
- Loading branch information
Showing
42 changed files
with
4,241 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,17 @@ | ||
plugins { | ||
id 'java-library' | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
repositories { | ||
maven { url = 'https://jitpack.io' } | ||
maven { url = 'https://maven.brott.dev/' } | ||
} | ||
|
||
dependencies { | ||
implementation 'com.github.NoahBres:MeepMeep:2.0.3' | ||
} |
35 changes: 35 additions & 0 deletions
35
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.java
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,35 @@ | ||
package com.example.meepmeeptesting; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.noahbres.meepmeep.MeepMeep; | ||
import com.noahbres.meepmeep.roadrunner.DefaultBotBuilder; | ||
import com.noahbres.meepmeep.roadrunner.entity.RoadRunnerBotEntity; | ||
|
||
public class MeepMeepTesting { | ||
public static void main(String[] args) { | ||
MeepMeep meepMeep = new MeepMeep(800); | ||
|
||
RoadRunnerBotEntity myBot = new DefaultBotBuilder(meepMeep) | ||
// Set bot constraints: maxVel, maxAccel, maxAngVel, maxAngAccel, track width | ||
.setConstraints(60, 60, Math.toRadians(180), Math.toRadians(180), 15) | ||
.followTrajectorySequence(drive -> | ||
// add your trajectory here: | ||
drive.trajectorySequenceBuilder(new Pose2d(0, 0, 0)) | ||
.forward(30) | ||
.turn(Math.toRadians(90)) | ||
.forward(30) | ||
.turn(Math.toRadians(90)) | ||
.forward(30) | ||
.turn(Math.toRadians(90)) | ||
.forward(30) | ||
.turn(Math.toRadians(90)) | ||
.build() | ||
); | ||
|
||
meepMeep.setBackground(MeepMeep.Background.FIELD_CENTERSTAGE_JUICE_DARK) | ||
.setDarkMode(true) | ||
.setBackgroundAlpha(0.95f) | ||
.addEntity(myBot) | ||
.start(); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/roadrunner/drive/DriveConstants.java
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,85 @@ | ||
package org.firstinspires.ftc.teamcode.roadrunner.drive; | ||
|
||
import com.acmerobotics.dashboard.config.Config; | ||
import com.qualcomm.robotcore.hardware.PIDFCoefficients; | ||
|
||
/* | ||
* Constants shared between multiple drive types. | ||
* | ||
* 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 | ||
public class DriveConstants { | ||
|
||
/* | ||
* These are motor constants that should be listed online for your motors. | ||
*/ | ||
public static final double TICKS_PER_REV = 1; | ||
public static final double MAX_RPM = 1; | ||
|
||
/* | ||
* 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. | ||
*/ | ||
public static final boolean RUN_USING_ENCODER = true; | ||
public static PIDFCoefficients MOTOR_VELO_PID = new PIDFCoefficients(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. | ||
*/ | ||
public static double WHEEL_RADIUS = 2; // in | ||
public static double GEAR_RATIO = 1; // output (wheel) speed / input (motor) speed | ||
public static double TRACK_WIDTH = 1; // 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. | ||
*/ | ||
public static double kV = 1.0 / rpmToVelocity(MAX_RPM); | ||
public static double kA = 0; | ||
public static double kStatic = 0; | ||
|
||
/* | ||
* 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. | ||
*/ | ||
public static double MAX_VEL = 30; | ||
public static double MAX_ACCEL = 30; | ||
public static double MAX_ANG_VEL = Math.toRadians(60); | ||
public static double MAX_ANG_ACCEL = Math.toRadians(60); | ||
|
||
|
||
public static double encoderTicksToInches(double ticks) { | ||
return WHEEL_RADIUS * 2 * Math.PI * GEAR_RATIO * ticks / TICKS_PER_REV; | ||
} | ||
|
||
public static double rpmToVelocity(double rpm) { | ||
return rpm * GEAR_RATIO * 2 * Math.PI * WHEEL_RADIUS / 60.0; | ||
} | ||
|
||
public static double getMotorVelocityF(double ticksPerSecond) { | ||
// see https://docs.google.com/document/d/1tyWrXDfMidwYyP_5H4mZyVgaEswhOC35gvdmP-V-5hA/edit#heading=h.61g9ixenznbx | ||
return 32767 / ticksPerSecond; | ||
} | ||
} |
Oops, something went wrong.