Path creation/visualization tool for Road Runner
repositories {
maven { url 'https://jitpack.io' }
maven { url = 'https://maven.brott.dev/' }
}
dependencies {
implementation 'com.github.NoahBres:MeepMeep:2.0.1'
}
🚨 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_FREIGHTFRENZY_ADI_DARK)
.setDarkMode(true)
.setBackgroundAlpha(0.95f)
.addEntity(myBot)
.start();
}
}
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();
}
}
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:
- Constraints
- Max Vel: 30in/s
- Max Accel: 30in/s/s
- Max Ang Vel: 60deg/s
- Max Ang Accel: 60deg/s/s
- Track Width: 15in
- Bot Width: 18in
- Bot Width: 18in
- Start Pose: (x: 0in, y: 0in, heading: 0rad)
- Color Scheme: Inherited from MeepMeep.colorManager unless overriden
- Drive Train Type: Mecanum