Skip to content

Commit

Permalink
Revert "Nishk code review & merge (#12)"
Browse files Browse the repository at this point in the history
This reverts commit 672d601.
  • Loading branch information
penguinencounter committed Jan 13, 2024
1 parent 672d601 commit 0b9e317
Show file tree
Hide file tree
Showing 49 changed files with 227 additions and 1,319 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import android.annotation.SuppressLint;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.firstinspires.ftc.teamcode

import org.firstinspires.ftc.teamcode.utilities.Pose
import org.firstinspires.ftc.teamcode.utilities.Vector2
import org.firstinspires.ftc.teamcode.utilities.degrees
import org.firstinspires.ftc.teamcode.utilities.inches
import org.firstinspires.ftc.teamcode.odo.Pose
import org.firstinspires.ftc.teamcode.odo.degrees
import org.firstinspires.ftc.teamcode.odo.inches
import org.firstinspires.ftc.teamcode.utility.Vector2
import org.firstinspires.ftc.vision.apriltag.AprilTagDetection
import kotlin.math.abs
import kotlin.math.cos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import static androidx.core.math.MathUtils.clamp;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import static org.firstinspires.ftc.teamcode.utilities.CollectionUtils.pairs;
import static org.firstinspires.ftc.teamcode.utility.CollectionUtils.pairs;

import android.util.Pair;
import android.util.Size;
Expand All @@ -11,9 +11,8 @@
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.teamcode.AprilTagToPoseKt;
import org.firstinspires.ftc.teamcode.utilities.Pose;
import org.firstinspires.ftc.teamcode.utilities.Vector2;
import org.firstinspires.ftc.teamcode.odo.Pose;
import org.firstinspires.ftc.teamcode.utility.Vector2;
import org.firstinspires.ftc.vision.VisionPortal;
import org.firstinspires.ftc.vision.apriltag.AprilTagDetection;
import org.firstinspires.ftc.vision.apriltag.AprilTagGameDatabase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes
package org.firstinspires.ftc.teamcode

import android.util.Size
import com.qualcomm.robotcore.hardware.Gamepad
Expand All @@ -8,16 +8,13 @@ import dev.aether.collaborative_multitasking.ext.minTicks
import org.firstinspires.ftc.robotcore.external.Telemetry
import org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName
import org.firstinspires.ftc.teamcode.configurations.RobotConfiguration
import org.firstinspires.ftc.teamcode.detectPairToPose
import org.firstinspires.ftc.teamcode.detectSingleToPose
import org.firstinspires.ftc.teamcode.utilities.Pose
import org.firstinspires.ftc.teamcode.utilities.degrees
import org.firstinspires.ftc.teamcode.utilities.inches
import org.firstinspires.ftc.teamcode.utilities.radians
import org.firstinspires.ftc.teamcode.tagPositions
import org.firstinspires.ftc.teamcode.utilities.CollectionUtils.pairs
import org.firstinspires.ftc.teamcode.utilities.MotorSet
import org.firstinspires.ftc.teamcode.utilities.typedGet
import org.firstinspires.ftc.teamcode.odo.Pose
import org.firstinspires.ftc.teamcode.odo.degrees
import org.firstinspires.ftc.teamcode.odo.inches
import org.firstinspires.ftc.teamcode.odo.radians
import org.firstinspires.ftc.teamcode.utility.CollectionUtils.pairs
import org.firstinspires.ftc.teamcode.utility.MotorSet
import org.firstinspires.ftc.teamcode.utility.typedGet
import org.firstinspires.ftc.vision.VisionPortal
import org.firstinspires.ftc.vision.apriltag.AprilTagProcessor
import kotlin.math.abs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import static androidx.core.math.MathUtils.clamp;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.firstinspires.ftc.teamcode.opmodes;
package org.firstinspires.ftc.teamcode;

import static dev.aether.collaborative_multitasking.KotlinHelper.kbu;

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

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

@Autonomous
public class GenericDRAuto extends LinearOpMode {
@Override
public void runOpMode() throws InterruptedException {

}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package org.firstinspires.ftc.teamcode.opmodes
package org.firstinspires.ftc.teamcode

import dev.aether.collaborative_multitasking.MultitaskScheduler
import dev.aether.collaborative_multitasking.Task
import dev.aether.collaborative_multitasking.ext.maxDuration
import org.firstinspires.ftc.teamcode.abstractions.Claw
import org.firstinspires.ftc.teamcode.configurations.RobotConfiguration
import org.firstinspires.ftc.teamcode.utilities.MotorPowers

class GenericDRAutoB(
private val robotConfig: RobotConfiguration,
private val scheduler: MultitaskScheduler,
private val claw: Claw,
private val scheduler: MultitaskScheduler
) {
// TODO: INCOMPLETE
private val driveMotors = robotConfig.driveMotors()
Expand All @@ -23,7 +22,7 @@ class GenericDRAutoB(
const val TurnDuration = 750 // ms
}

private fun forwardPart(): Task {
fun pos1(): Task {
return scheduler.task {
+robotConfig.driveMotorLock
onStart { ->
Expand All @@ -33,25 +32,12 @@ class GenericDRAutoB(
onFinish { ->
driveMotors.setAll(0.0)
}
}
}.then(claw.release())
}

fun left(): Task = forwardPart().then(turn(TurnSpeed)).then(claw.release())
fun center(): Task = forwardPart().then(claw.release())
fun right(): Task = forwardPart().then(turn(-TurnSpeed)).then(claw.release())

private fun turn(fac: Double, duration: Int = TurnDuration): Task {
fun turn(fac: Double): Task {
return scheduler.task {
+robotConfig.driveMotorLock
onStart { ->
MotorPowers(
1 * fac,
-1 * fac,
1 * fac,
-1 * fac
).apply(driveMotors)
}
maxDuration(duration)
}
}
}
Loading

0 comments on commit 0b9e317

Please sign in to comment.