Skip to content

Commit

Permalink
Piece 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ToborUser committed Dec 4, 2023
1 parent 624c339 commit beecfe5
Show file tree
Hide file tree
Showing 34 changed files with 554 additions and 351 deletions.
Original file line number Diff line number Diff line change
@@ -1,45 +1,2 @@

## Caution
No Team-specific code should be placed or modified in this ``.../samples`` folder.

Samples should be Copied from here, and then Pasted into the team's
[/TeamCode/src/main/java/org/firstinspires/ftc/teamcode](../../../../../../../../../../TeamCode/src/main/java/org/firstinspires/ftc/teamcode)
folder, using the Android Studio cut and paste commands. This automatically changes all file and
class names to be consistent. From there, the sample can be modified to suit the team's needs.

For more detailed instructions see the /teamcode readme.

### Naming of Samples

To gain a better understanding of how the samples are organized, and how to interpret the
naming system, it will help to understand the conventions that were used during their creation.

These conventions are described (in detail) in the sample_conventions.md file in this folder.

To summarize: A range of different samples classes will reside in the java/external/samples.
The class names will follow a naming convention which indicates the purpose of each class.
The prefix of the name will be one of the following:

Basic: This is a minimally functional OpMode used to illustrate the skeleton/structure
of a particular style of OpMode. These are bare bones examples.

Sensor: This is a Sample OpMode that shows how to use a specific sensor.
It is not intended to drive a functioning robot, it is simply showing the minimal code
required to read and display the sensor values.

Robot: This is a Sample OpMode that assumes a simple two-motor (differential) drive base.
It may be used to provide a common baseline driving OpMode, or
to demonstrate how a particular sensor or concept can be used to navigate.

Concept: This is a sample OpMode that illustrates performing a specific function or concept.
These may be complex, but their operation should be explained clearly in the comments,
or the comments should reference an external doc, guide or tutorial.
Each OpMode should try to only demonstrate a single concept so they are easy to
locate based on their name. These OpModes may not produce a drivable robot.

After the prefix, other conventions will apply:

* Sensor class names are constructed as: Sensor - Company - Type
* Robot class names are constructed as: Robot - Mode - Action - OpModetype
* Concept class names are constructed as: Concept - Topic - OpModetype

# external.samples
> this is where the sdk's default sample projects are held.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.firstinspires.ftc.teamcode;
package org.firstinspires.ftc.teamcode.autonomous;

import static org.firstinspires.ftc.teamcode.operations.inputs.AprilTag.initAprilTag;
import static org.firstinspires.ftc.teamcode.operations.inputs.Camera.visionPortal;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.bl;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.br;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fl;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.DistanceMovements.forward;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.hardcoredMovements.EachMotorSet.drive;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.hardware.DcMotor;
Expand All @@ -14,7 +17,7 @@
import org.firstinspires.ftc.teamcode.operations.Wheels;
import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Encoders;

@Autonomous(name="Blue, Board Side")
@Autonomous(name="Blue, Board Side", group="auto")
public class BlueBoardSide extends TargetOperations {

DcMotor arm;
Expand Down Expand Up @@ -47,7 +50,19 @@ public void runInitLoop(){}

@Override
public void runStart() {
forward(300, 1);
// must set up methods for this later
Encoders.clear();
Encoders.target(-5000,-5000,-5000,-5000); // - must be to go forward
Encoders.go();
drive(-500,-500,-500,-500);
sleep(500); // wait this makes sure that the robot does not strafe when it should not
// ^ forward away from wall

// strafe left into backstage
Encoders.clear();
Encoders.target(1800,-1800,-1800,1800); // - must be to go forward
Encoders.go();
drive(500,-500,-500,500);

}
@Override
Expand All @@ -57,7 +72,10 @@ public void runStop() {
@Override
public void runLoop() {

telemetry.addData("position", br.getCurrentPosition());
telemetry.addData("position FL ", fl.getCurrentPosition());
telemetry.addData("position FR ", fr.getCurrentPosition());
telemetry.addData("position BL ", bl.getCurrentPosition());
telemetry.addData("position BR ", br.getCurrentPosition());
telemetry.update();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.firstinspires.ftc.teamcode;
package org.firstinspires.ftc.teamcode.autonomous;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.teamcode.operations.TargetOperations;

@Autonomous(name="Blue, Far Side")
@Autonomous(name="Blue, Far Side", group="auto")
public class BlueFarSide extends TargetOperations {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package org.firstinspires.ftc.teamcode.autonomous;

import static org.firstinspires.ftc.teamcode.operations.inputs.AprilTag.initAprilTag;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.bl;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.br;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fl;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.hardcoredMovements.EachMotorSet.drive;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.teamcode.operations.TargetOperations;
import org.firstinspires.ftc.teamcode.operations.Wheels;
import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Encoders;

@Autonomous(name="Red, Board Side", group="auto")
public class RedBoardSide extends TargetOperations {
@Override
public void runOpMode() {

runInit();
while(opModeInInit()){runInitLoop();}
waitForStart();
runStart();
if (isStopRequested()){runStop();}
while (opModeIsActive()) {runLoop();}
}

@Override
public void runInit() {
//arm = hardwareMap.dcMotor.get("arm");
mapMotors(hardwareMap, Wheels.FRONT_LEFT.abbreviation(),Wheels.FRONT_RIGHT.abbreviation(),Wheels.BACK_LEFT.abbreviation(),Wheels.BACK_RIGHT.abbreviation());
forwardMotors(true,false,true,false);
// ^ set motor directions
initAprilTag(hardwareMap, "Webcam 1");
Encoders.clear();

}

@Override
public void runInitLoop() {

}

@Override
public void runStart() {
// must set up methods for this later
Encoders.clear();
Encoders.target(-1000,-1000,-1000,-1000); // - must be to go forward
Encoders.go();
drive(500,500,500,500);
sleep(500); // wait this makes sure that the robot does not strafe when it should not

Encoders.clear();
Encoders.target(-1800,1800,1800,-1800); // - must be to go forward
Encoders.go();
drive(-500,500,500,-500);
}

@Override
public void runLoop() {
telemetry.addData("position FL ", fl.getCurrentPosition());
telemetry.addData("position FR ", fr.getCurrentPosition());
telemetry.addData("position BL ", bl.getCurrentPosition());
telemetry.addData("position BR ", br.getCurrentPosition());
telemetry.update();
}

@Override
public void runStop() {

}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.firstinspires.ftc.teamcode;
package org.firstinspires.ftc.teamcode.autonomous;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.teamcode.operations.TargetOperations;

@Autonomous(name="Red, Far Side")
@Autonomous(name="Red, Far Side", group="auto")
public class RedFarSide extends TargetOperations {

@Override
Expand Down
Loading

0 comments on commit beecfe5

Please sign in to comment.