Skip to content

Commit

Permalink
Merge pull request #5 from rh-robotics/InitMeepMeep
Browse files Browse the repository at this point in the history
Meep Meep Auton Maps
  • Loading branch information
blazeboy75 authored Nov 5, 2024
2 parents 1b3f057 + 6d73605 commit c484b2f
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 14 deletions.
4 changes: 2 additions & 2 deletions MeepMeepTesting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,35 @@
import org.rowlandhall.meepmeep.roadrunner.DefaultBotBuilder;
import org.rowlandhall.meepmeep.roadrunner.entity.RoadRunnerBotEntity;

public class MeepMeepTesting {
public class MeepMeepBlueSide {
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))
.followTrajectorySequence(drive -> drive.trajectorySequenceBuilder(new Pose2d(35, 62.5, Math.toRadians(0)))
.forward(20)
.back(8)
.turn(Math.toRadians(-90))
.forward(30)
.back(30)
.turn(Math.toRadians(90))
.forward(8)
.back(8)
.strafeRight(37)
.forward(5)
.back(5)
.strafeLeft(37)
.forward(8)
.back(8)
.strafeRight(37)
.forward(12)
.back(12)
.strafeLeft(37)
.forward(6)
.back(110)

.build());


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.example.meepmeeptesting;

import com.acmerobotics.roadrunner.geometry.Pose2d;

import org.rowlandhall.meepmeep.MeepMeep;
import org.rowlandhall.meepmeep.roadrunner.DefaultBotBuilder;
import org.rowlandhall.meepmeep.roadrunner.entity.RoadRunnerBotEntity;

public class MeepMeepRedSide {
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(-35, -62.5, Math.toRadians(180)))
.forward(20)
.back(8)
.turn(Math.toRadians(-90))
.forward(30)
.back(30)
.turn(Math.toRadians(90))
.forward(8)
.back(8)
.strafeRight(37)
.forward(5)
.back(5)
.strafeLeft(37)
.forward(8)
.back(8)
.strafeRight(37)
.forward(12)
.back(12)
.strafeLeft(37)
.forward(6)
.back(110)

.build());


meepMeep.setBackground(MeepMeep.Background.FIELD_INTOTHEDEEP_JUICE_DARK)
.setDarkMode(true)
.setBackgroundAlpha(0.95f)
.addEntity(myBot)
.start();
}
}
2 changes: 1 addition & 1 deletion TeamCode/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-18/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class HWC {
// Declare empty variables for robot hardware
public DcMotorEx leftFront, rightFront, leftRear, rightRear, rightSlide, leftSlide;
//TODO: CHANGE TO NORMAL SERVO
public Servo claw;
public Servo claw, joint, arm;


// Other Variables
Expand All @@ -32,7 +32,7 @@ public class HWC {

Telemetry telemetry;
ElapsedTime time = new ElapsedTime();

ElapsedTime sleepTimer = new ElapsedTime();
/**
* Constructor for HWC, declares all hardware components
*
Expand All @@ -54,17 +54,23 @@ public HWC(@NonNull HardwareMap hardwareMap, Telemetry telemetry) {

//Declare Servos
claw = hardwareMap.get(Servo.class, "claw");
arm = hardwareMap.get(Servo.class,"arm");
joint = hardwareMap.get(Servo.class, "joint");




// Set the direction of motors
// TODO: UPDATE VALUES WITH NEW BOT
leftFront.setDirection(DcMotorEx.Direction.REVERSE);
leftFront.setDirection(DcMotorEx.Direction.FORWARD);
rightFront.setDirection(DcMotorEx.Direction.FORWARD);
leftRear.setDirection(DcMotorEx.Direction.FORWARD);
rightRear.setDirection(DcMotorEx.Direction.FORWARD);

//Set direction of other motors
// leftSlide.setDirection(DcMotorEx.Direction.FORWARD);
//rightSlide.setDirection(DcMotorEx.Direction.FORWARD);

// Set motors to break when power = 0
// TODO: REMOVE IF THIS BEHAVIOUR IS NOT DESIRED ON NEW BOT
leftFront.setZeroPowerBehavior(DcMotorEx.ZeroPowerBehavior.BRAKE);
Expand All @@ -87,4 +93,8 @@ public HWC(@NonNull HardwareMap hardwareMap, Telemetry telemetry) {
leftSlide.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}
// TODO: ADD ANY HARDWARE RELATED FUNCTIONS BELOW

public static void betterSleep(double secs){

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.firstinspires.ftc.teamcode.subsystems;

import org.opencv.core.Mat;
import org.openftc.easyopencv.OpenCvPipeline;

class TestPipeline extends OpenCvPipeline
{
@Override
public Mat processFrame(Mat input)
{
return input;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.firstinspires.ftc.teamcode.subsystems;

import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import androidx.annotation.NonNull;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.util.ElapsedTime;

import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.openftc.easyopencv.OpenCvCamera;
import org.openftc.easyopencv.OpenCvCameraFactory;
import org.openftc.easyopencv.OpenCvCameraRotation;

public class VisionTesting
{

public VisionTesting(HardwareMap hardwareMap) {
//TODO: Find a value for this???
int cameraId = 0;
//initializes open cv camera
WebcamName cam = hardwareMap.get(WebcamName.class, "NAME_OF_CAMERA_IN_CONFIG_FILE");
OpenCvCamera camera = OpenCvCameraFactory.getInstance().createWebcam(cam, cameraId);

camera.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener()
{
@Override
public void onOpened()
{

// camera.setPipeline(yourPipeline);
camera.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT);
}
@Override
public void onError(int errorCode)
{
/*
* This will be called if the camera could not be opened
*/
}
});


}


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* TeleOp OpMode for simply driving with strafing wheels
* Look at JAVA DOC!
*/

@TeleOp(name = "INIT TELEOP", group = "Iterative OpMode")

public class InitialTeleOp extends OpMode {
private final ElapsedTime time = new ElapsedTime();
HWC robot; // Declare the object for HWC, will allow us to access all the motors declared there!
Expand Down Expand Up @@ -111,6 +113,7 @@ public void loop() {
robot.previousGamepad1.copy(robot.currentGamepad1);
robot.currentGamepad1.copy(gamepad1);


// Calculate drive power
double drive = -robot.currentGamepad1.left_stick_y * driveSpeed;
double strafe = robot.currentGamepad1.left_stick_x * strafeSpeed;
Expand Down

0 comments on commit c484b2f

Please sign in to comment.