Compare commits

...

3 Commits

4 changed files with 19 additions and 3 deletions

View File

@@ -194,7 +194,9 @@ public class RedCrabMinibot {
/// --- Claw Arm Motor
/// --- --- (SOFT) RESET MOTOR ENCODER
clawArm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
// ONLY RESET ENCODER IN AUTONOMOUS
if (autonomous)
clawArm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
/// --- --- DIRECTION
clawArm.setDirection(DcMotorSimple.Direction.FORWARD);
/// --- --- BRAKING

File diff suppressed because one or more lines are too long

View File

@@ -31,7 +31,7 @@ public class ClawArmMove extends CyberarmState {
int tolerance = robot.clawArm.getTargetPositionTolerance();
int position = robot.clawArm.getCurrentPosition();
if (Utilities.isBetween(position, position - tolerance, position + tolerance) || runTime() >= timeoutMS) {
if (Utilities.isBetween(robot.clawArm.getTargetPosition(), position - tolerance, position + tolerance) || runTime() >= timeoutMS) {
this.finished();
}
}

View File

@@ -1,17 +1,31 @@
package dev.cyberarm.minibots.red_crab.states;
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersConfigurationError;
import dev.cyberarm.engine.V2.CyberarmState;
import dev.cyberarm.engine.V2.Utilities;
import dev.cyberarm.minibots.red_crab.RedCrabMinibot;
public class PathEnactor extends CyberarmState {
private final RedCrabMinibot robot;
private String pathGroupName;
private int forcePath;
public PathEnactor(RedCrabMinibot robot, String groupName, String actionName) {
this.robot = robot;
try {
this.forcePath = robot.config.variable(groupName, actionName, "forcePath").value();
} catch (TimeCraftersConfigurationError e) {
this.forcePath = -1;
}
}
@Override
public void start() {
// FORCE PATH FOR DEBUGGING
if (Utilities.isBetween(forcePath, 0, 2))
engine.blackboardSet("autonomousPath", forcePath);
String path;
switch (engine.blackboardGetInt("autonomousPath")) {
case 1: