Path creation/visualization tool for Road Runner
Video instructions found here: https://youtu.be/vdn1v404go8. Please note that it was recorded in 2021 and may be outdated at the time of viewing
In Android Studio, click on the "FtcRobotController" Module, then right click on the FtcRobotController folder and click New > Module
On the left part of this window, select "Java or Kotlin Library"
From here, remove the :ftcrobotcontroller:lib
in the "Library Name" section, and rename it to MeepMeepTesting
. You may use whatever name you wish but the rest of the instructions will assume you have chosen the name MeepMeepTesting
. Ensure that you also change the "class name" section to match.
Hit "Finish" at the bottom right of the Module Create window.
Open up the build.gradle
file for the MeepMeepTesting module (or whatever you chose to name it prior). In this file, change all instances JavaVersion.VERSION_1_7
to JavaVersion.VERSION_1_8
At the bottom of the file add the following gradle snippet:
repositories {
maven { url = 'https://jitpack.io' }
maven { url = 'https://maven.brott.dev/' }
}
dependencies {
implementation 'com.github.NoahBres:MeepMeep:2.0.3'
}
When android studio prompts you to make a gradle sync, click "Sync Now".
Create a class for your MeepMeepTesting java module if it does not yet exist. Paste the following sample in it. Feel free to change this later.
🚨 The code snippet and explanation within the video is currently not up-to-date with the latest MeepMeep 2.0.x API 🚨
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 ->
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();
}
}
Create a run configuration for Android Studio.
Click Edit Configurations
Click on the "+" symbol in the top left of the window, and when it prompts you, select "Application".
Change the name to your liking (ex. meepmeep-run)
Where it says "cp
Where it says "Main Class", click the little "file" icon to the right of the text and then select the name of the main class for your MeepMeepTesting module.
From here, in the bottom right of the window, press "Apply" then "Ok".
Before the meepmeep.setBackground(MeepMeep.Background.FIELD_POWERPLAY_OFFICIAL)
, add the following lines of code and update the setBackground() command:
Image img = null;
try { img = ImageIO.read(new File("<PATH TO IMAGE>")); }
catch (IOException e) {}
meepMeep.setBackground(img)
// <following code you were using previously>
where
/Users/<username>/Documents/field.png
C:\Users\<username>\Documents\field.png
MeepMeep version 2.x introduces a new API and updated entity handling, allowing one to run and coordinate multiple trajectories.
Declare a new RoadRunnerBotEntity
and add it via MeepMeep#addEntity(Entity)
.
package com.example.meepmeeptesting;
import com.acmerobotics.roadrunner.geometry.Pose2d;
import com.noahbres.meepmeep.MeepMeep;
import com.noahbres.meepmeep.core.colorscheme.scheme.ColorSchemeBlueDark;
import com.noahbres.meepmeep.core.colorscheme.scheme.ColorSchemeRedDark;
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);
// Declare our first bot
RoadRunnerBotEntity myFirstBot = new DefaultBotBuilder(meepMeep)
// We set this bot to be blue
.setColorScheme(new ColorSchemeBlueDark())
.setConstraints(60, 60, Math.toRadians(180), Math.toRadians(180), 15)
.followTrajectorySequence(drive ->
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()
);
// Declare out second bot
RoadRunnerBotEntity mySecondBot = new DefaultBotBuilder(meepMeep)
// We set this bot to be red
.setColorScheme(new ColorSchemeRedDark())
.setConstraints(60, 60, Math.toRadians(180), Math.toRadians(180), 15)
.followTrajectorySequence(drive ->
drive.trajectorySequenceBuilder(new Pose2d(30, 30, Math.toRadians(180)))
.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_FREIGHTFRENZY_ADI_DARK)
.setDarkMode(true)
.setBackgroundAlpha(0.95f)
// Add both of our declared bot entities
.addEntity(myFirstBot)
.addEntity(mySecondBot)
.start();
}
}
MeepMeep is hosted on JitPack. This allows the user to pull dependencies from any Git commit. Change the dependency version in build.gradle
to do so.
implementation 'com.github.NoahBres:MeepMeep:2.0.3'
2.0.3
can be replaced with whatever version specified on the GitHub releases pageimplementation 'com.github.NoahBres:MeepMeep:-SNAPSHOT'
implementation 'com.github.NoahBres:MeepMeep:<commit version ID>'
<commit ID>
is replaced with ID of commit. For example "79d123f0c1"On some systems, hardware acceleration may not be enabled by default.
To enable hardware acceleration use the cli flag: -Dsun.java2d.opengl=true
.
Or, enable it before initializing your MeepMeep
instance with the following snippet:
System.setProperty("sun.java2d.opengl", "true");
Default Bot Settings: