mirror of
https://github.com/TimeCrafters/CenterStage
synced 2025-12-15 08:42:35 +00:00
Compare commits
3 Commits
8c103aeec0
...
2f265edbfe
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f265edbfe | |||
| bca0ec5225 | |||
| 0c6873c832 |
@@ -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
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user