mirror of
https://github.com/TimeCrafters/FreightFrenzy.git
synced 2025-12-15 14:02:34 +00:00
Compare commits
34 Commits
c6096586e1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c31e40d332 | ||
|
|
aafa5cf65d | ||
| b668cd97e3 | |||
| 74486ced09 | |||
| 06c5ede690 | |||
| 23f4fd15a3 | |||
|
|
e025034655 | ||
|
|
aa6ce00f3c | ||
|
|
6eb9c46e59 | ||
| 9b98cf5840 | |||
|
|
99bbfee101 | ||
|
|
12a306965a | ||
|
|
05376d01d5 | ||
|
|
7d3649cb1d | ||
|
|
9532b9e8af | ||
|
|
1944e3c57b | ||
|
|
ee4e05f28d | ||
|
|
7332fe8a72 | ||
|
|
6136b0a3b5 | ||
|
|
8f2f471667 | ||
|
|
166b8091b8 | ||
| 0acdad3115 | |||
|
|
9efd0ffcad | ||
|
|
7df503d7c5 | ||
|
|
c4bd4acf2b | ||
|
|
1b5d27fdd8 | ||
|
|
056f539abd | ||
|
|
7caa230822 | ||
|
|
cf77c481ea | ||
|
|
228729c192 | ||
|
|
4985a45d5f | ||
|
|
6daa9ba307 | ||
| 1c51d46476 | |||
|
|
eda5fcf4c1 |
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
6
.idea/compiler.xml
generated
Normal file
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="11" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
30
.idea/jarRepositories.xml
generated
Normal file
30
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="BintrayJCenter" />
|
||||||
|
<option name="name" value="BintrayJCenter" />
|
||||||
|
<option name="url" value="https://jcenter.bintray.com/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="Google" />
|
||||||
|
<option name="name" value="Google" />
|
||||||
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/misc.xml
generated
Normal file
10
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -49,6 +49,8 @@ import android.preference.PreferenceManager;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -410,6 +412,12 @@ public class FtcRobotControllerActivity extends Activity
|
|||||||
checkPreferredChannel();
|
checkPreferredChannel();
|
||||||
|
|
||||||
AnnotatedHooksClassFilter.getInstance().callOnCreateMethods(this);
|
AnnotatedHooksClassFilter.getInstance().callOnCreateMethods(this);
|
||||||
|
|
||||||
|
/* REV CONTROL HUB APPEARS TO PREVENT ANY APP NOT ON ITS WHITELIST FROM USING ON_BOOT_COMPLETED RECEIVERS */
|
||||||
|
/* USING THIS HACK DUE TO THAT... */
|
||||||
|
Intent tacnetIntent = new Intent("org.timecrafters.TimeCraftersConfigurationTool.tacnet.ACTION_START_SERVER");
|
||||||
|
tacnetIntent.setPackage("org.timecrafters.TimeCraftersConfigurationTool");
|
||||||
|
ContextCompat.startForegroundService(context, tacnetIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UpdateUI createUpdateUI() {
|
protected UpdateUI createUpdateUI() {
|
||||||
|
|||||||
1
TC_Config/FreightFrenzy.json
Normal file
1
TC_Config/FreightFrenzy.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,58 +0,0 @@
|
|||||||
package org.cyberarm.container;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.qualcomm.robotcore.hardware.Gamepad;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class InputChecker {
|
|
||||||
private Gamepad gamepad;
|
|
||||||
private HashMap<String, Byte> buttons;
|
|
||||||
private ArrayList<String> buttonList;
|
|
||||||
private byte NULL = 0,
|
|
||||||
PRESSED = 1,
|
|
||||||
RELEASED= 2;
|
|
||||||
public InputChecker(Gamepad gamepad) {
|
|
||||||
this.gamepad = gamepad;
|
|
||||||
buttons = new HashMap<>();
|
|
||||||
buttonList = new ArrayList<>();
|
|
||||||
|
|
||||||
buttonList.add("a"); buttonList.add("b"); buttonList.add("x"); buttonList.add("y");
|
|
||||||
buttonList.add("start"); buttonList.add("guide"); buttonList.add("back");
|
|
||||||
buttonList.add("left_bumper"); buttonList.add("right_bumper");
|
|
||||||
buttonList.add("left_stick_button"); buttonList.add("right_stick_button");
|
|
||||||
buttonList.add("dpad_left"); buttonList.add("dpad_right");
|
|
||||||
buttonList.add("dpad_up"); buttonList.add("dpad_down");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update() {
|
|
||||||
for (int i = 0; i < buttonList.size(); i++) {
|
|
||||||
try {
|
|
||||||
Field field = gamepad.getClass().getDeclaredField(buttonList.get(i));
|
|
||||||
|
|
||||||
if (field.getBoolean(gamepad)) {
|
|
||||||
buttons.put(buttonList.get(i), PRESSED);
|
|
||||||
} else {
|
|
||||||
if (buttons.get(buttonList.get(i)) != null && buttons.get(buttonList.get(i)) == PRESSED) {
|
|
||||||
buttons.put(buttonList.get(i), RELEASED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException|IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean check(String button) {
|
|
||||||
boolean state = false;
|
|
||||||
if (buttons.containsKey(button) && buttons.get(button) == RELEASED) {
|
|
||||||
Log.d("InputChecker","button \""+button+"\" has been released on \"gamepad"+gamepad.getGamepadId()+"\"");
|
|
||||||
state = true;
|
|
||||||
buttons.put(button, NULL);
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ package org.cyberarm.engine.V2;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||||
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
@@ -15,13 +16,15 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
|
|
||||||
public static CyberarmEngine instance;
|
public static CyberarmEngine instance;
|
||||||
//Array To Hold States
|
//Array To Hold States
|
||||||
private CopyOnWriteArrayList<CyberarmState> cyberarmStates = new CopyOnWriteArrayList<>();
|
final private CopyOnWriteArrayList<CyberarmState> cyberarmStates = new CopyOnWriteArrayList<>();
|
||||||
private int activeStateIndex = 0;
|
private int activeStateIndex = 0;
|
||||||
private boolean isRunning;
|
private boolean isRunning;
|
||||||
|
|
||||||
private static String TAG = "PROGRAM.ENGINE";
|
private final static String TAG = "PROGRAM.ENGINE";
|
||||||
public boolean showStateChildrenListInTelemetry = false;
|
public boolean showStateChildrenListInTelemetry = false;
|
||||||
|
|
||||||
|
private GamepadChecker gamepadCheckerGamepad1, gamepadCheckerGamepad2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when INIT button on Driver Station is pushed
|
* Called when INIT button on Driver Station is pushed
|
||||||
* ENSURE to call super.init() if you override this method
|
* ENSURE to call super.init() if you override this method
|
||||||
@@ -29,6 +32,8 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
public void init() {
|
public void init() {
|
||||||
CyberarmEngine.instance = this;
|
CyberarmEngine.instance = this;
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
gamepadCheckerGamepad1 = new GamepadChecker(this, gamepad1);
|
||||||
|
gamepadCheckerGamepad2 = new GamepadChecker(this, gamepad2);
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
@@ -43,12 +48,12 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
* Setup states for engine to use
|
* Setup states for engine to use
|
||||||
* For example:
|
* For example:
|
||||||
* <pre>
|
* <pre>
|
||||||
* @<code>
|
* {@code
|
||||||
* public void setup() {
|
* public void setup() {
|
||||||
* addState(new TestState());
|
* addState(new TestState());
|
||||||
* addState(new AnotherState(100, 500));
|
* addState(new AnotherState(100, 500));
|
||||||
* }
|
* }
|
||||||
* </code>
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public abstract void setup();
|
public abstract void setup();
|
||||||
@@ -102,6 +107,9 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
} else {
|
} else {
|
||||||
stateTelemetry(state);
|
stateTelemetry(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gamepadCheckerGamepad1.update();
|
||||||
|
gamepadCheckerGamepad2.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,14 +175,11 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
final CyberarmState finalState = state;
|
final CyberarmState finalState = state;
|
||||||
// if (state.isRunning()) { return; } // Assume that we have already started running this state
|
// if (state.isRunning()) { return; } // Assume that we have already started running this state
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(() -> {
|
||||||
@Override
|
finalState.prestart();
|
||||||
public void run() {
|
finalState.start();
|
||||||
finalState.prestart();
|
finalState.startTime = System.currentTimeMillis();
|
||||||
finalState.start();
|
finalState.run();
|
||||||
finalState.startTime = System.currentTimeMillis();
|
|
||||||
finalState.run();
|
|
||||||
}
|
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
for (CyberarmState kid : state.children) {
|
for (CyberarmState kid : state.children) {
|
||||||
@@ -199,7 +204,7 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
* Inserts state after the query state plus an offset to ensure logical insertion
|
* Inserts state after the query state plus an offset to ensure logical insertion
|
||||||
* @param query State to add state after
|
* @param query State to add state after
|
||||||
* @param state State to be inserted
|
* @param state State to be inserted
|
||||||
* @return
|
* @return CyberarmState
|
||||||
*/
|
*/
|
||||||
public CyberarmState insertState(CyberarmState query, CyberarmState state) {
|
public CyberarmState insertState(CyberarmState query, CyberarmState state) {
|
||||||
int index = cyberarmStates.indexOf(query) + query.insertOffset;
|
int index = cyberarmStates.indexOf(query) + query.insertOffset;
|
||||||
@@ -213,6 +218,48 @@ public abstract class CyberarmEngine extends OpMode {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonDownForStates(CyberarmState state, Gamepad gamepad, String button) {
|
||||||
|
state.buttonDown(gamepad, button);
|
||||||
|
|
||||||
|
for (CyberarmState child : state.children) {
|
||||||
|
child.buttonDown(gamepad, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpForStates(CyberarmState state, Gamepad gamepad, String button) {
|
||||||
|
state.buttonUp(gamepad, button);
|
||||||
|
|
||||||
|
for (CyberarmState child : state.children) {
|
||||||
|
child.buttonUp(gamepad, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by GamepadChecker when it detects that a gamepad button has been pressed
|
||||||
|
* @param gamepad Gamepad
|
||||||
|
* @param button String
|
||||||
|
*/
|
||||||
|
protected void buttonDown(Gamepad gamepad, String button) {
|
||||||
|
try {
|
||||||
|
buttonDownForStates(cyberarmStates.get(activeStateIndex), gamepad, button);
|
||||||
|
} catch(IndexOutOfBoundsException e){
|
||||||
|
/* loop will handle this in a few milliseconds */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by GamepadChecker when it detects that a gamepad button has been released
|
||||||
|
* @param gamepad Gamepad
|
||||||
|
* @param button String
|
||||||
|
*/
|
||||||
|
protected void buttonUp(Gamepad gamepad, String button) {
|
||||||
|
try {
|
||||||
|
buttonUpForStates(cyberarmStates.get(activeStateIndex), gamepad, button);
|
||||||
|
} catch(IndexOutOfBoundsException e){
|
||||||
|
/* loop will handle this in a few milliseconds */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will return false while Engine.setup() is executing, and be true after.
|
* This will return false while Engine.setup() is executing, and be true after.
|
||||||
* @return Whether the engine main loop is running
|
* @return Whether the engine main loop is running
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.cyberarm.engine.V2;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +67,23 @@ public abstract class CyberarmState implements Runnable {
|
|||||||
public void stop() {
|
public void stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when GamepadChecker detects that a gamepad button has been pressed
|
||||||
|
* @param gamepad Gamepad
|
||||||
|
* @param button String
|
||||||
|
*/
|
||||||
|
public void buttonDown(Gamepad gamepad, String button) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when GamepadChecker detects that a gamepad button has been released
|
||||||
|
* @param gamepad Gamepad
|
||||||
|
* @param button String
|
||||||
|
*/
|
||||||
|
public void buttonUp(Gamepad gamepad, String button) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a state which runs in parallel with this one
|
* Add a state which runs in parallel with this one
|
||||||
*/
|
*/
|
||||||
@@ -139,7 +158,7 @@ public abstract class CyberarmState implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether state has finished or not
|
* Set whether state has finished or not
|
||||||
* @param value
|
* @param value boolean
|
||||||
*/
|
*/
|
||||||
public void setHasFinished(boolean value) {
|
public void setHasFinished(boolean value) {
|
||||||
hasFinished = value;
|
hasFinished = value;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.cyberarm.engine.V2;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class GamepadChecker {
|
||||||
|
private final CyberarmEngine engine;
|
||||||
|
private final Gamepad gamepad;
|
||||||
|
private final HashMap<String, Boolean> buttons = new HashMap<>();
|
||||||
|
|
||||||
|
public GamepadChecker(CyberarmEngine engine, Gamepad gamepad) {
|
||||||
|
this.engine = engine;
|
||||||
|
this.gamepad = gamepad;
|
||||||
|
|
||||||
|
buttons.put("a", false);
|
||||||
|
buttons.put("b", false);
|
||||||
|
buttons.put("x", false);
|
||||||
|
buttons.put("y", false);
|
||||||
|
|
||||||
|
buttons.put("start", false);
|
||||||
|
buttons.put("guide", false);
|
||||||
|
buttons.put("back", false);
|
||||||
|
|
||||||
|
buttons.put("left_bumper", false);
|
||||||
|
buttons.put("right_bumper", false);
|
||||||
|
|
||||||
|
buttons.put("left_stick_button", false);
|
||||||
|
buttons.put("right_stick_button", false);
|
||||||
|
|
||||||
|
buttons.put("dpad_left", false);
|
||||||
|
buttons.put("dpad_right", false);
|
||||||
|
buttons.put("dpad_up", false);
|
||||||
|
buttons.put("dpad_down", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
for (String btn : buttons.keySet()) {
|
||||||
|
try {
|
||||||
|
Field field = gamepad.getClass().getDeclaredField(btn);
|
||||||
|
|
||||||
|
if (field.getBoolean(gamepad)) {
|
||||||
|
if (!buttons.get(btn)) {
|
||||||
|
engine.buttonDown(gamepad, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons.put(btn, true);
|
||||||
|
} else {
|
||||||
|
if (buttons.get(btn)) {
|
||||||
|
engine.buttonUp(gamepad, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons.put(btn, false);
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException|IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.Engines;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.CollectorToggle;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DriveState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TensorFlowState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmExtension;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretOrbit;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
@Autonomous (name = "Blue Duck Autonomous", group = "blue")
|
||||||
|
public class BlueDuckEngine extends CyberarmEngine {
|
||||||
|
Robot robot;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
this.robot = new Robot(this);
|
||||||
|
robot.resetEncoders();
|
||||||
|
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoWhite, robot.whiteMag, "BlueDuckAutonomous", "01_0"));
|
||||||
|
addState(new TensorFlowState(robot, robot.whiteArmRiser, robot.whiteArmBobbin, "BlueDuckAutonomous", "01_1"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "RedWarehouseAutonomous", "02_0"));
|
||||||
|
// addState(new TurretArmRiser(robot, robot.whiteArmRiser, "RedWarehouseAutonomous", "03_0_middle"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "RedWarehouseAutonomous", "04_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorWhite, "BlueDuckAutonomous", "05_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorWhite, "BlueDuckAutonomous", "06_0"));
|
||||||
|
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "BlueDuckAutonomous", "07_0"));
|
||||||
|
addState(new DriveState(robot,"BlueDuckAutonomous", "08_0"));
|
||||||
|
addState(new DriveState(robot, "BlueDuckAutonomous", "09_0"));
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoWhite, null, "BlueDuckAutonomous", "10_0"));
|
||||||
|
addState(new DriveState(robot, "BlueDuckAutonomous", "10_1"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loop() {
|
||||||
|
super.loop();
|
||||||
|
|
||||||
|
telemetry.addData("white arm extension", robot.whiteArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("White Riser Arm", robot.whiteArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("white Turret Switch", robot.whiteMag.isPressed());
|
||||||
|
telemetry.addData("white Turret orbit Power", robot.turretServoWhite.getPower());
|
||||||
|
telemetry.addData("White Door Position", robot.whiteDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("Orange Riser Arm", robot.orangeArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("orange arm extension", robot.orangeArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("orange Turret Switch", robot.orangeMag.isPressed());
|
||||||
|
telemetry.addData("orange Turret Orbit Power", robot.turretServoOrange.getPower());
|
||||||
|
telemetry.addData("Orange Door Position", robot.orangeDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("driveWarehouseLeft", robot.driveWarehouseLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveWarehouseRight", robot.driveWarehouseRight.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalLeft", robot.driveGoalLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalRight", robot.driveGoalRight.getCurrentPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.Engines;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.CollectorToggle;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DriveState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TensorFlowState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmExtension;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmRiser;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretOrbit;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
@Autonomous (name = "Blue WareHouse", group = "blue")
|
||||||
|
public class BlueWarehouseEngine extends CyberarmEngine {
|
||||||
|
Robot robot;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
this.robot = new Robot(this);
|
||||||
|
robot.resetEncoders();
|
||||||
|
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoOrange, robot.orangeMag, "BlueWarehouseAutonomous", "01_0"));
|
||||||
|
addState(new TensorFlowState(robot, robot.orangeArmRiser, robot.orangeArmBobbin, "BlueWarehouseAutonomous", "01_1"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "RedWarehouseAutonomous", "02_0"));
|
||||||
|
// addState(new TurretArmRiser(robot, robot.orangeArmRiser, "RedWarehouseAutonomous", "03_0_middle"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "RedWarehouseAutonomous", "04_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorOrange, "BlueWarehouseAutonomous", "05_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorOrange, "BlueWarehouseAutonomous", "06_0"));
|
||||||
|
addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "BlueWarehouseAutonomous", "07_0"));
|
||||||
|
addState(new DriveState(robot,"BlueWarehouseAutonomous", "08_0"));
|
||||||
|
addState(new DriveState(robot, "BlueWarehouseAutonomous", "09_0"));
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoOrange, null, "BlueWarehouseAutonomous", "10_0"));
|
||||||
|
addState(new DriveState(robot, "BlueWarehouseAutonomous", "10_1"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loop() {
|
||||||
|
super.loop();
|
||||||
|
|
||||||
|
telemetry.addData("white arm extension", robot.whiteArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("White Riser Arm", robot.whiteArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("white Turret Switch", robot.whiteMag.isPressed());
|
||||||
|
telemetry.addData("white Turret orbit Power", robot.turretServoWhite.getPower());
|
||||||
|
telemetry.addData("White Door Position", robot.whiteDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("Orange Riser Arm", robot.orangeArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("orange arm extension", robot.orangeArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("orange Turret Switch", robot.orangeMag.isPressed());
|
||||||
|
telemetry.addData("orange Turret Orbit Power", robot.turretServoOrange.getPower());
|
||||||
|
telemetry.addData("Orange Door Position", robot.orangeDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("driveWarehouseLeft", robot.driveWarehouseLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveWarehouseRight", robot.driveWarehouseRight.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalLeft", robot.driveGoalLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalRight", robot.driveGoalRight.getCurrentPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.Engines;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.CollectorToggle;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DriveState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TensorFlowState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmExtension;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretOrbit;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
@Autonomous(name = "RedDuckAutonomous", group = "red")
|
||||||
|
|
||||||
|
public class RedDuckEngine extends CyberarmEngine {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
Robot robot = new Robot(this);
|
||||||
|
robot.resetEncoders();
|
||||||
|
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoOrange, robot.orangeMag, "RedDuckAutonomous", "01_0"));
|
||||||
|
addState(new TensorFlowState(robot, robot.orangeArmRiser, robot.orangeArmBobbin, "RedDuckAutonomous", "01_1"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "RedWarehouseAutonomous", "02_0"));
|
||||||
|
// addState(new TurretArmRiser(robot, robot.orangeArmRiser, "RedWarehouseAutonomous", "03_0_middle"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "RedWarehouseAutonomous", "04_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorOrange, "RedDuckAutonomous", "05_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorOrange, "RedDuckAutonomous", "06_0"));
|
||||||
|
addState(new TurretArmExtension(robot, robot.orangeArmBobbin, "RedDuckAutonomous", "07_0"));
|
||||||
|
addState(new DriveState(robot,"RedDuckAutonomous", "08_0"));
|
||||||
|
addState(new DriveState(robot, "RedDuckAutonomous", "09_0"));
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoOrange, null, "RedDuckAutonomous", "10_0"));
|
||||||
|
addState(new DriveState(robot, "RedDuckAutonomous", "10_1"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,60 @@
|
|||||||
package org.timecrafters.FreightFrenzy.Competition.Autonomous.Engines;
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.Engines;
|
||||||
|
|
||||||
import org.cyberarm.engine.V2.CyberarmEngine;
|
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
|
||||||
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DriveState;
|
|
||||||
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.CollectorToggle;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DepositorDoor;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.DriveState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TensorFlowState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmExtension;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretArmRiser;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Autonomous.States.TurretOrbit;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
@Autonomous (name = "Red WareHouse", group = "red")
|
||||||
public class RedWarehouseEngine extends CyberarmEngine {
|
public class RedWarehouseEngine extends CyberarmEngine {
|
||||||
|
Robot robot;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Robot robot = new Robot(this);
|
this.robot = new Robot(this);
|
||||||
|
robot.resetEncoders();
|
||||||
|
|
||||||
addState(new DriveState(robot, 2000, 2000,.25,.25));
|
addState(new TurretOrbit(robot, robot.turretServoWhite, robot.whiteMag, "RedWarehouseAutonomous", "01_0"));
|
||||||
|
addState(new TensorFlowState(robot, robot.whiteArmRiser, robot.whiteArmBobbin, "RedWarehouseAutonomous", "01_1"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "RedWarehouseAutonomous", "02_0"));
|
||||||
|
// addState(new TurretArmRiser(robot, robot.whiteArmRiser, "RedWarehouseAutonomous", "03_0_middle"));
|
||||||
|
// addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "RedWarehouseAutonomous", "04_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorWhite, "RedWarehouseAutonomous", "05_0"));
|
||||||
|
addState(new CollectorToggle(robot, robot.collectorWhite, "RedWarehouseAutonomous", "06_0"));
|
||||||
|
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "RedWarehouseAutonomous", "07_0"));
|
||||||
|
addState(new DriveState(robot,"RedWarehouseAutonomous", "08_0"));
|
||||||
|
addState(new DriveState(robot, "RedWarehouseAutonomous", "09_0"));
|
||||||
|
addState(new TurretOrbit(robot, robot.turretServoWhite, null, "RedWarehouseAutonomous", "10_0"));
|
||||||
|
addState(new DriveState(robot, "RedWarehouseAutonomous", "10_1"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loop() {
|
||||||
|
super.loop();
|
||||||
|
|
||||||
|
telemetry.addData("white arm extension", robot.whiteArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("White Riser Arm", robot.whiteArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("white Turret Switch", robot.whiteMag.isPressed());
|
||||||
|
telemetry.addData("white Turret orbit Power", robot.turretServoWhite.getPower());
|
||||||
|
telemetry.addData("White Door Position", robot.whiteDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("Orange Riser Arm", robot.orangeArmRiser.getCurrentPosition());
|
||||||
|
telemetry.addData("orange arm extension", robot.orangeArmBobbin.getCurrentPosition());
|
||||||
|
telemetry.addData("orange Turret Switch", robot.orangeMag.isPressed());
|
||||||
|
telemetry.addData("orange Turret Orbit Power", robot.turretServoOrange.getPower());
|
||||||
|
telemetry.addData("Orange Door Position", robot.orangeDispenser.getPosition());
|
||||||
|
telemetry.addLine();
|
||||||
|
|
||||||
|
telemetry.addData("driveWarehouseLeft", robot.driveWarehouseLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveWarehouseRight", robot.driveWarehouseRight.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalLeft", robot.driveGoalLeft.getCurrentPosition());
|
||||||
|
telemetry.addData("driveGoalRight", robot.driveGoalRight.getCurrentPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.CRServo;
|
||||||
|
import com.qualcomm.robotcore.hardware.Servo;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
public class CollectorToggle extends CyberarmState {
|
||||||
|
final static public int MODE_REVERSE = -1;
|
||||||
|
final static public int MODE_COLLECT = 1;
|
||||||
|
final static public int MODE_STOPPED = 0;
|
||||||
|
double time;
|
||||||
|
CRServo servo;
|
||||||
|
double power;
|
||||||
|
|
||||||
|
public CollectorToggle(Robot robot, CRServo servo, String groupName, String actionName) {
|
||||||
|
this.servo = servo;
|
||||||
|
this.power = robot.configuration.variable(groupName, actionName, "power").value();
|
||||||
|
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
servo.setPower(power);
|
||||||
|
|
||||||
|
if (runTime() >= time){
|
||||||
|
|
||||||
|
servo.setPower(0);
|
||||||
|
|
||||||
|
setHasFinished(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void telemetry() {
|
||||||
|
engine.telemetry.addData("runtime", runTime());
|
||||||
|
engine.telemetry.addData("time", time);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.Servo;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
public class DepositorDoor extends CyberarmState {
|
||||||
|
|
||||||
|
Servo servo;
|
||||||
|
double targetPosition;
|
||||||
|
long time;
|
||||||
|
|
||||||
|
public DepositorDoor(Robot robot, Servo servo, String groupName, String actionName) {
|
||||||
|
this.servo = servo;
|
||||||
|
this.targetPosition = robot.configuration.variable(groupName, actionName, "targetPosition").value();
|
||||||
|
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
if (runTime() < time) {
|
||||||
|
servo.setPosition(targetPosition);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setHasFinished(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,14 +7,15 @@ import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
|||||||
|
|
||||||
public class DriveState extends CyberarmState {
|
public class DriveState extends CyberarmState {
|
||||||
Robot robot;
|
Robot robot;
|
||||||
double distanceLeft, distanceRight, powerLeft, powerRight;
|
int distanceLeft, distanceRight;
|
||||||
|
double powerLeft, powerRight;
|
||||||
|
|
||||||
public DriveState(Robot robot, double distanceLeft, double distanceRight, double powerLeft, double powerRight) {
|
public DriveState(Robot robot, String groupName, String actionName) {
|
||||||
this.robot = robot;
|
this.robot = robot;
|
||||||
this.distanceLeft = distanceLeft;
|
this.distanceLeft = robot.configuration.variable(groupName, actionName, "distanceLeft").value();
|
||||||
this.distanceRight = distanceRight;
|
this.distanceRight = robot.configuration.variable(groupName, actionName, "distanceRight").value();
|
||||||
this.powerLeft = powerLeft;
|
this.powerLeft = robot.configuration.variable(groupName, actionName, "powerLeft").value();
|
||||||
this.powerRight = powerRight;
|
this.powerRight = robot.configuration.variable(groupName, actionName, "powerRight").value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -32,7 +33,8 @@ public class DriveState extends CyberarmState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exec() {
|
public void exec() {
|
||||||
if (Math.abs(robot.driveGoalLeft.getCurrentPosition()) >= distanceLeft && Math.abs(robot.driveGoalRight.getCurrentPosition()) >= distanceRight) {
|
if (Math.abs(robot.driveGoalLeft.getCurrentPosition()) >= distanceLeft &&
|
||||||
|
Math.abs(robot.driveGoalRight.getCurrentPosition()) >= distanceRight) {
|
||||||
robot.driveGoalLeft.setPower(0);
|
robot.driveGoalLeft.setPower(0);
|
||||||
robot.driveGoalRight.setPower(0);
|
robot.driveGoalRight.setPower(0);
|
||||||
robot.driveWarehouseRight.setPower(0);
|
robot.driveWarehouseRight.setPower(0);
|
||||||
@@ -45,6 +47,15 @@ public class DriveState extends CyberarmState {
|
|||||||
robot.driveWarehouseLeft.setPower(powerLeft);
|
robot.driveWarehouseLeft.setPower(powerLeft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void telemetry() {
|
||||||
|
engine.telemetry.addData("distance left", distanceLeft);
|
||||||
|
engine.telemetry.addData("distance right", distanceRight);
|
||||||
|
engine.telemetry.addData("power left", powerLeft);
|
||||||
|
engine.telemetry.addData("power Right", powerRight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
public class FaceState extends CyberarmState {
|
||||||
|
private double faceDirection, tolerance, power;
|
||||||
|
private Robot robot;
|
||||||
|
public FaceState(Robot robot, double faceDirection, double tolerance, double power) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.faceDirection = faceDirection;
|
||||||
|
this.tolerance = tolerance;
|
||||||
|
this.power = power;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
robot.driveGoalLeft.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.driveGoalRight.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.driveWarehouseLeft.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.driveWarehouseRight.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
|
||||||
|
robot.driveGoalLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
robot.driveGoalRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
robot.driveWarehouseLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
robot.driveWarehouseRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
robot.updateRobotOrientation();
|
||||||
|
|
||||||
|
if (robot.heading() - tolerance > faceDirection) {
|
||||||
|
robot.driveGoalLeft.setPower(power);
|
||||||
|
robot.driveWarehouseLeft.setPower(power);
|
||||||
|
robot.driveGoalRight.setPower(0);
|
||||||
|
robot.driveWarehouseRight.setPower(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (robot.heading() + tolerance < faceDirection){
|
||||||
|
robot.driveGoalLeft.setPower(0);
|
||||||
|
robot.driveWarehouseLeft.setPower(0);
|
||||||
|
robot.driveGoalRight.setPower(power);
|
||||||
|
robot.driveWarehouseRight.setPower(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
robot.driveGoalLeft.setPower(0);
|
||||||
|
robot.driveWarehouseLeft.setPower(0);
|
||||||
|
robot.driveGoalRight.setPower(0);
|
||||||
|
robot.driveWarehouseRight.setPower(0);
|
||||||
|
setHasFinished(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TensorFlowState extends CyberarmState {
|
||||||
|
|
||||||
|
Robot robot;
|
||||||
|
private List<Recognition> recognitions;
|
||||||
|
private double checkTime;
|
||||||
|
private int manualPath = 0;
|
||||||
|
private int path = 3;
|
||||||
|
private double leftDuck;
|
||||||
|
private double middleDuck;
|
||||||
|
|
||||||
|
private String groupName;
|
||||||
|
private DcMotor armRiser, armExtension;
|
||||||
|
|
||||||
|
public TensorFlowState(Robot robot, DcMotor armRiser, DcMotor armExtension, String groupName, String actionName) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.groupName = groupName;
|
||||||
|
this.armRiser = armRiser;
|
||||||
|
this.armExtension = armExtension;
|
||||||
|
this.leftDuck = robot.configuration.variable(groupName, actionName, "leftDuck").value();
|
||||||
|
this.middleDuck = robot.configuration.variable(groupName, actionName, "middleDuck").value();
|
||||||
|
this.checkTime = robot.configuration.variable(groupName, actionName, "time").value();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
robot.activateVuforia();
|
||||||
|
robot.activateTensorflow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
recognitions = robot.tensorflowDetections();
|
||||||
|
|
||||||
|
if (runTime() < checkTime) {
|
||||||
|
if (recognitions != null && recognitions.size() != 0) {
|
||||||
|
if (recognitions.size() == 1) {
|
||||||
|
Recognition recognition = recognitions.get(0);
|
||||||
|
|
||||||
|
if (recognition.getLeft() < leftDuck) {
|
||||||
|
path = 0;
|
||||||
|
} else {
|
||||||
|
path = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
path = 2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "Choosen path: " + path);
|
||||||
|
|
||||||
|
if (path == 0){
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "02_0"));
|
||||||
|
addState(new TurretArmRiser(robot, armRiser, groupName, "03_0_bottom"));
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "04_0_bottom"));
|
||||||
|
} else if (path == 1){
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "02_0"));
|
||||||
|
addState(new TurretArmRiser(robot, armRiser, groupName, "03_0_middle"));
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "04_0_middle"));
|
||||||
|
} else {
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "02_0"));
|
||||||
|
addState(new TurretArmRiser(robot, armRiser, groupName, "03_0_top"));
|
||||||
|
addState(new TurretArmExtension(robot, armExtension, groupName, "04_0_top"));
|
||||||
|
}
|
||||||
|
|
||||||
|
setHasFinished(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void telemetry() {
|
||||||
|
engine.telemetry.addData("Runtime", runTime());
|
||||||
|
engine.telemetry.addData("Check Time", checkTime);
|
||||||
|
engine.telemetry.addData("Path", path);
|
||||||
|
engine.telemetry.addLine();
|
||||||
|
|
||||||
|
if (recognitions == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Recognition recognition : recognitions) {
|
||||||
|
engine.telemetry.addData("Label", recognition.getLabel());
|
||||||
|
engine.telemetry.addData("Left", recognition.getLeft());
|
||||||
|
engine.telemetry.addData("Top", recognition.getTop());
|
||||||
|
engine.telemetry.addData("Confidence", recognition.getConfidence());
|
||||||
|
engine.telemetry.addLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
public class TurretArmExtension extends CyberarmState {
|
||||||
|
|
||||||
|
private Robot robot;
|
||||||
|
private DcMotor motor;
|
||||||
|
private int targetPosition, tolerance;
|
||||||
|
private double power;
|
||||||
|
|
||||||
|
public TurretArmExtension(Robot robot, DcMotor motor, String groupName, String actionName) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.motor = motor;
|
||||||
|
this.targetPosition = robot.configuration.variable(groupName, actionName, "targetPosition").value();
|
||||||
|
this.power = robot.configuration.variable(groupName, actionName, "power").value();
|
||||||
|
this.tolerance = robot.configuration.variable(groupName, actionName, "tolerance").value();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
if (motor.getCurrentPosition() < targetPosition - tolerance){
|
||||||
|
motor.setPower(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (motor.getCurrentPosition() > targetPosition + tolerance){
|
||||||
|
motor.setPower(-power);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setHasFinished(true);
|
||||||
|
motor.setPower(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void telemetry() {
|
||||||
|
engine.telemetry.addData("targetPosition", targetPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
|
public class TurretArmRiser extends CyberarmState {
|
||||||
|
|
||||||
|
private Robot robot;
|
||||||
|
private DcMotor motor;
|
||||||
|
private int targetPosition, tolerance;
|
||||||
|
private double power;
|
||||||
|
|
||||||
|
public TurretArmRiser(Robot robot, DcMotor motor, String groupName, String actionName) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.motor = motor;
|
||||||
|
this.targetPosition = robot.configuration.variable(groupName, actionName, "targetPosition").value();
|
||||||
|
this.power = robot.configuration.variable(groupName, actionName, "power").value();
|
||||||
|
this.tolerance = robot.configuration.variable(groupName, actionName, "tolerance").value();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
if (motor.getCurrentPosition() < targetPosition - tolerance){
|
||||||
|
motor.setPower(power);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (motor.getCurrentPosition() > targetPosition + tolerance){
|
||||||
|
motor.setPower(-power);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setHasFinished(true);
|
||||||
|
motor.setPower(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.Competition.Autonomous.States;
|
||||||
|
|
||||||
|
import com.qualcomm.hardware.rev.RevTouchSensor;
|
||||||
|
import com.qualcomm.robotcore.hardware.CRServo;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersConfiguration;
|
||||||
|
import org.timecrafters.TimeCraftersConfigurationTool.library.backend.config.Action;
|
||||||
|
|
||||||
|
public class TurretOrbit extends CyberarmState {
|
||||||
|
private Robot robot;
|
||||||
|
private CRServo servo;
|
||||||
|
private double time;
|
||||||
|
private double power;
|
||||||
|
private RevTouchSensor magnetSwitch;
|
||||||
|
public TurretOrbit(Robot robot, CRServo servo, RevTouchSensor magnetSwitch, String groupName, String actionName) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.servo = servo;
|
||||||
|
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||||
|
this. power = robot.configuration.variable(groupName, actionName, "power").value();
|
||||||
|
this. magnetSwitch = magnetSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
if ((magnetSwitch != null && magnetSwitch.isPressed()) || runTime() > time ){
|
||||||
|
servo.setPower(0);
|
||||||
|
setHasFinished(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
servo.setPower(power);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.
|
|||||||
|
|
||||||
import com.qualcomm.hardware.bosch.BNO055IMU;
|
import com.qualcomm.hardware.bosch.BNO055IMU;
|
||||||
import com.qualcomm.hardware.rev.RevBlinkinLedDriver;
|
import com.qualcomm.hardware.rev.RevBlinkinLedDriver;
|
||||||
|
import com.qualcomm.hardware.rev.RevTouchSensor;
|
||||||
|
import com.qualcomm.robotcore.hardware.CRServo;
|
||||||
import com.qualcomm.robotcore.hardware.DcMotor;
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||||
import com.qualcomm.robotcore.hardware.Servo;
|
import com.qualcomm.robotcore.hardware.Servo;
|
||||||
@@ -64,26 +66,34 @@ public class Robot {
|
|||||||
.translation(VUFORIA_CAMERA_FORWARD_DISPLACEMENT, VUFORIA_CAMERA_LEFT_DISPLACEMENT, VUFORIA_CAMERA_VERTICAL_DISPLACEMENT)
|
.translation(VUFORIA_CAMERA_FORWARD_DISPLACEMENT, VUFORIA_CAMERA_LEFT_DISPLACEMENT, VUFORIA_CAMERA_VERTICAL_DISPLACEMENT)
|
||||||
.multiplied(Orientation.getRotationMatrix(AxesReference.EXTRINSIC, AxesOrder.XZY, AngleUnit.DEGREES, 90, 90, 0));
|
.multiplied(Orientation.getRotationMatrix(AxesReference.EXTRINSIC, AxesOrder.XZY, AngleUnit.DEGREES, 90, 90, 0));
|
||||||
private RobotLocation vuforiaLastLocation;
|
private RobotLocation vuforiaLastLocation;
|
||||||
|
private Orientation orientation;
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
public BNO055IMU imu;
|
public BNO055IMU imu;
|
||||||
|
public RevTouchSensor whiteMag;
|
||||||
|
public RevTouchSensor orangeMag;
|
||||||
|
|
||||||
// Drivetrain
|
// Drivetrain
|
||||||
public static final double WHEEL_CIRCUMFERENCE = Math.PI * 8;
|
public static final double WHEEL_CIRCUMFERENCE = Math.PI * 8;
|
||||||
public static final int COUNTS_PER_REVOLUTION = 1000;
|
public static final int COUNTS_PER_REVOLUTION = 1000;
|
||||||
|
|
||||||
public DcMotor driveWarehouseLeft, driveWarehouseRight, driveGoalLeft, driveGoalRight,
|
public DcMotor driveWarehouseLeft, driveWarehouseRight, driveGoalLeft, driveGoalRight,
|
||||||
collectorArmRiser, collectorArmBobbin, depositorArmRiser, depositorArmBobbin;
|
orangeArmRiser, orangeArmBobbin, whiteArmRiser, whiteArmBobbin;
|
||||||
|
|
||||||
// Collector
|
// Collector
|
||||||
public Servo collectorDispenser;
|
public Servo orangeDispenser;
|
||||||
|
public CRServo turretServoOrange;
|
||||||
|
|
||||||
// Depositor
|
// Depositor
|
||||||
public Servo depositorDispenser;
|
public Servo whiteDispenser;
|
||||||
|
// Depositor, and carousel
|
||||||
|
public CRServo turretServoWhite, carouselWheel, collectorOrange, collectorWhite;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Robot(CyberarmEngine engine) {
|
public Robot(CyberarmEngine engine) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
initMagnetSwitches();
|
||||||
initConfiguration();
|
initConfiguration();
|
||||||
initBlinkin();
|
initBlinkin();
|
||||||
initIMU();
|
initIMU();
|
||||||
@@ -91,20 +101,29 @@ public class Robot {
|
|||||||
initCollector();
|
initCollector();
|
||||||
initDepositor();
|
initDepositor();
|
||||||
initCarousel();
|
initCarousel();
|
||||||
// initVuforia();
|
initVuforia();
|
||||||
// initTensorflow();
|
initTensorflow();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMagnetSwitches() {
|
||||||
|
whiteMag = engine.hardwareMap.get(RevTouchSensor.class, "whiteMag");
|
||||||
|
orangeMag = engine.hardwareMap.get(RevTouchSensor.class, "orangeMag");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double heading() {
|
public double heading() {
|
||||||
return imu.getAngularOrientation().firstAngle;
|
return orientation.firstAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double roll() {
|
public double roll() {
|
||||||
return imu.getAngularOrientation().secondAngle;
|
return orientation.secondAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double pitch() {
|
public double pitch() {
|
||||||
return imu.getAngularOrientation().thirdAngle;
|
return orientation.thirdAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateRobotOrientation(){
|
||||||
|
orientation = imu.getAngularOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activateTensorflow() {
|
public void activateTensorflow() {
|
||||||
@@ -201,20 +220,31 @@ public class Robot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCollector() {
|
private void initCollector() {
|
||||||
collectorArmBobbin = engine.hardwareMap.dcMotor.get("collectorArmBobbin");
|
orangeArmBobbin = engine.hardwareMap.dcMotor.get("orangeArmBobbin");
|
||||||
collectorDispenser = engine.hardwareMap.servo.get("collectorDispenser");
|
orangeDispenser = engine.hardwareMap.servo.get("orangeDispenser");
|
||||||
collectorArmBobbin.setDirection(DcMotorSimple.Direction.FORWARD);
|
orangeArmBobbin.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||||
|
turretServoOrange = engine.hardwareMap.crservo.get("turretServoOrange");
|
||||||
|
orangeArmRiser = engine.hardwareMap.dcMotor.get("orangeArmRiser");
|
||||||
|
orangeArmRiser.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||||
|
orangeArmRiser.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||||
|
collectorOrange = engine.hardwareMap.crservo.get("collectorOrange");
|
||||||
|
|
||||||
|
orangeDispenser.setPosition(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDepositor(){
|
private void initDepositor(){
|
||||||
depositorDispenser = engine.hardwareMap.servo.get("depositorDispenser");
|
whiteDispenser = engine.hardwareMap.servo.get("whiteDispenser");
|
||||||
depositorArmBobbin = engine.hardwareMap.dcMotor.get("depositorArmBobbin");
|
whiteArmBobbin = engine.hardwareMap.dcMotor.get("whiteArmBobbin");
|
||||||
depositorArmBobbin.setDirection(DcMotorSimple.Direction.REVERSE);
|
whiteArmBobbin.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||||
|
turretServoWhite = engine.hardwareMap.crservo.get("turretServoWhite");
|
||||||
|
whiteArmRiser = engine.hardwareMap.dcMotor.get("whiteArmRiser");
|
||||||
|
whiteArmRiser.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||||
|
whiteArmRiser.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||||
|
collectorWhite = engine.hardwareMap.crservo.get("collectorWhite");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCarousel() {
|
private void initCarousel() {
|
||||||
|
carouselWheel = engine.hardwareMap.crservo.get("carouselWheel");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initVuforia() {
|
private void initVuforia() {
|
||||||
@@ -244,6 +274,18 @@ public class Robot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetEncoders(){
|
||||||
|
orangeArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
whiteArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
orangeArmRiser.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
whiteArmRiser.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
|
||||||
|
orangeArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
whiteArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
orangeArmRiser.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
whiteArmRiser.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
}
|
||||||
|
|
||||||
private void initTensorflow() {
|
private void initTensorflow() {
|
||||||
int tfodMonitorViewId = engine.hardwareMap.appContext.getResources().getIdentifier(
|
int tfodMonitorViewId = engine.hardwareMap.appContext.getResources().getIdentifier(
|
||||||
"tfodMonitorViewId", "id", engine.hardwareMap.appContext.getPackageName());
|
"tfodMonitorViewId", "id", engine.hardwareMap.appContext.getPackageName());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package org.timecrafters.FreightFrenzy.Competition.TeleOp.Engines;
|
package org.timecrafters.FreightFrenzy.Competition.TeleOp.Engines;
|
||||||
|
//adb connect 192.168.43.1
|
||||||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||||
|
|
||||||
import org.cyberarm.engine.V2.CyberarmEngine;
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
|||||||
@@ -1,63 +1,282 @@
|
|||||||
package org.timecrafters.FreightFrenzy.Competition.TeleOp.States;
|
package org.timecrafters.FreightFrenzy.Competition.TeleOp.States;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.CRServo;
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
|
|
||||||
import org.cyberarm.engine.V2.CyberarmState;
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||||
|
|
||||||
public class TeleOpState extends CyberarmState {
|
public class TeleOpState extends CyberarmState {
|
||||||
Robot robot;
|
Robot robot;
|
||||||
double maxDriveSpeed, maxCollectorArmSpeed, maxDepositorArmSpeed;
|
double maxDriveSpeed, maxCollectorArmSpeed, maxDepositorArmSpeed;
|
||||||
|
int maxArmTravelDistance, minArmTravelDistance;
|
||||||
|
boolean armLimitToggle = false, orangeCollectorToggle = false, whiteCollectorToggle = false;
|
||||||
|
boolean allianceRedDriver1 = true, allianceRedDriver2 = true;
|
||||||
|
|
||||||
public TeleOpState(Robot robot) {
|
public TeleOpState(Robot robot) {
|
||||||
this.robot = robot;
|
this.robot = robot;
|
||||||
maxDriveSpeed = 1;
|
maxDriveSpeed = 1;
|
||||||
maxCollectorArmSpeed = 0.7;
|
maxCollectorArmSpeed = 1;
|
||||||
maxDepositorArmSpeed = 0.7;
|
maxDepositorArmSpeed = 1;
|
||||||
|
minArmTravelDistance = 0;
|
||||||
|
maxArmTravelDistance = 4000;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
robot.whiteArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.whiteArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
robot.orangeArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.orangeArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exec() {
|
public void exec() {
|
||||||
|
// GamePad 1
|
||||||
|
|
||||||
|
// TankDrive
|
||||||
robot.driveWarehouseLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
robot.driveWarehouseLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
||||||
robot.driveGoalLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
robot.driveGoalLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
||||||
|
|
||||||
robot.driveWarehouseRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
robot.driveWarehouseRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
||||||
robot.driveGoalRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
robot.driveGoalRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
||||||
|
|
||||||
if (engine.gamepad1.left_bumper){
|
// dispenser powered
|
||||||
robot.depositorDispenser.setPosition(.5);
|
if (engine.gamepad1.a){
|
||||||
|
robot.orangeDispenser.setPosition(0);
|
||||||
|
}
|
||||||
|
// if not pressed dispenser off
|
||||||
|
else {
|
||||||
|
robot.orangeDispenser.setPosition(0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if one of triggers pressed arm extends or unextends, there is also a limit on how far arm can extend
|
||||||
|
if (robot.orangeArmBobbin.getCurrentPosition() <= maxArmTravelDistance && engine.gamepad1.left_trigger > 0) {
|
||||||
|
|
||||||
|
robot.orangeArmBobbin.setPower(engine.gamepad1.left_trigger * maxDepositorArmSpeed);
|
||||||
} else {
|
} else {
|
||||||
robot.depositorDispenser.setPosition(0);
|
if (engine.gamepad1.left_trigger <= 0 && robot.orangeArmBobbin.getCurrentPosition() >= minArmTravelDistance) {
|
||||||
|
robot.orangeArmBobbin.setPower(-engine.gamepad1.right_trigger * maxDepositorArmSpeed);
|
||||||
|
} else {
|
||||||
|
robot.orangeArmBobbin.setPower(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine.gamepad1.right_bumper){
|
turretOrbitControl(engine.gamepad1, robot.turretServoOrange, allianceRedDriver1);
|
||||||
robot.collectorDispenser.setPosition(.5);
|
|
||||||
} else {
|
// if dpad verticles pressed arm rises or lowers...
|
||||||
robot.collectorDispenser.setPosition(0);
|
if (engine.gamepad1.dpad_up || engine.gamepad1.dpad_down) {
|
||||||
|
|
||||||
|
if (engine.gamepad1.dpad_up) {
|
||||||
|
robot.orangeArmRiser.setPower(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine.gamepad1.dpad_down) {
|
||||||
|
robot.orangeArmRiser.setPower(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// nothing pressed nothing move...
|
||||||
|
else {
|
||||||
|
robot.orangeArmRiser.setPower(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
robot.collectorArmBobbin.setPower(engine.gamepad1.right_trigger * maxCollectorArmSpeed);
|
// button x pressed carousel wheel move, for blue side, if b pressed wheel spins for red side;
|
||||||
|
|
||||||
if (engine.gamepad1.right_trigger <= 0){
|
if (engine.gamepad2.b){
|
||||||
robot.collectorArmBobbin.setPower(-engine.gamepad1.left_trigger * maxCollectorArmSpeed);
|
robot.carouselWheel.setPower(1);
|
||||||
|
}
|
||||||
|
else if (engine.gamepad2.x){
|
||||||
|
robot.carouselWheel.setPower(-1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
robot.carouselWheel.setPower(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GamePad 2
|
// GamePad 2
|
||||||
robot.depositorArmBobbin.setPower(engine.gamepad2.right_trigger * maxDepositorArmSpeed);
|
|
||||||
|
|
||||||
if (engine.gamepad2.right_trigger <= 0) {
|
// if triggers are pressed then arm extends or unextends, there is also a limit on how far arm can extend
|
||||||
robot.depositorArmBobbin.setPower(-engine.gamepad2.left_trigger * maxDepositorArmSpeed);
|
if (robot.whiteArmBobbin.getCurrentPosition() <= maxArmTravelDistance && engine.gamepad2.left_trigger > 0) {
|
||||||
|
|
||||||
|
robot.whiteArmBobbin.setPower(engine.gamepad2.left_trigger * maxDepositorArmSpeed);
|
||||||
|
} else {
|
||||||
|
if (engine.gamepad2.left_trigger <= 0 && robot.whiteArmBobbin.getCurrentPosition() >= minArmTravelDistance) {
|
||||||
|
robot.whiteArmBobbin.setPower(-engine.gamepad2.right_trigger * maxDepositorArmSpeed);
|
||||||
|
} else {
|
||||||
|
robot.whiteArmBobbin.setPower(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if b is pressed then depositor door opens, if not pressed not opening.
|
||||||
|
if (engine.gamepad2.a){
|
||||||
|
robot.whiteDispenser.setPosition(.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
robot.whiteDispenser.setPosition(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
turretOrbitControl(engine.gamepad2, robot.turretServoWhite, allianceRedDriver2);
|
||||||
|
// if dpad verticles pressed arm rises or lowers
|
||||||
|
if (engine.gamepad2.dpad_down || engine.gamepad2.dpad_up) {
|
||||||
|
|
||||||
|
if (engine.gamepad2.dpad_up) {
|
||||||
|
robot.whiteArmRiser.setPower(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine.gamepad2.dpad_down) {
|
||||||
|
robot.whiteArmRiser.setPower(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// nothing pressed nothing move...
|
||||||
|
else {
|
||||||
|
robot.whiteArmRiser.setPower(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void telemetry() {
|
||||||
|
engine.telemetry.addData("arm limit toggle", armLimitToggle);
|
||||||
|
engine.telemetry.addData("driver A turret inverted", allianceRedDriver1);
|
||||||
|
engine.telemetry.addData("driver B turret inverted", allianceRedDriver2);
|
||||||
|
engine.telemetry.addLine();
|
||||||
|
|
||||||
|
engine.telemetry.addData("white arm extension", robot.whiteArmBobbin.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("White Riser Arm", robot.whiteArmRiser.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("white collector toggle ", whiteCollectorToggle);
|
||||||
|
engine.telemetry.addData("white Turret Switch", robot.whiteMag.isPressed());
|
||||||
|
engine.telemetry.addData("white Turret orbit Power", robot.turretServoWhite.getPower());
|
||||||
|
engine.telemetry.addData("White Door Position", robot.whiteDispenser.getPosition());
|
||||||
|
engine.telemetry.addLine();
|
||||||
|
|
||||||
|
engine.telemetry.addData("Orange Riser Arm", robot.orangeArmRiser.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("orange arm extension", robot.orangeArmBobbin.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("orange collector toggle ", orangeCollectorToggle);
|
||||||
|
engine.telemetry.addData("orange Turret Switch", robot.orangeMag.isPressed());
|
||||||
|
engine.telemetry.addData("orange Turret Orbit Power", robot.turretServoOrange.getPower());
|
||||||
|
engine.telemetry.addData("Orange Door Position", robot.orangeDispenser.getPosition());
|
||||||
|
engine.telemetry.addLine();
|
||||||
|
|
||||||
|
engine.telemetry.addData("driveWarehouseLeft", robot.driveWarehouseLeft.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("driveWarehouseRight", robot.driveWarehouseRight.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("driveGoalLeft", robot.driveGoalLeft.getCurrentPosition());
|
||||||
|
engine.telemetry.addData("driveGoalRight", robot.driveGoalRight.getCurrentPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buttonUp(Gamepad gamepad, String button) {
|
||||||
|
// this is a toggle of a limit for arm extension in the case of the robot crashes
|
||||||
|
// in the middle of the game we can bring the arm back in and extend and reset its position.
|
||||||
|
System.out.println("GamePad: " + gamepad.getGamepadId() + " Button: " + button);
|
||||||
|
|
||||||
|
if (button.equals("y")) {
|
||||||
|
System.out.println("Y has been pressed! (" + armLimitToggle + ")");
|
||||||
|
|
||||||
|
if (!armLimitToggle) {
|
||||||
|
armLimitToggle = true;
|
||||||
|
minArmTravelDistance = -8500;
|
||||||
|
maxArmTravelDistance = 8500;
|
||||||
|
} else {
|
||||||
|
armLimitToggle = false;
|
||||||
|
minArmTravelDistance = 0;
|
||||||
|
maxArmTravelDistance = 4000;
|
||||||
|
robot.orangeArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.whiteArmBobbin.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
|
||||||
|
robot.orangeArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
robot.whiteArmBobbin.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamepad == engine.gamepad1) {
|
||||||
|
switch (button) {
|
||||||
|
case "left_bumper":
|
||||||
|
if (orangeCollectorToggle) {
|
||||||
|
orangeCollectorToggle = false;
|
||||||
|
robot.collectorOrange.setPower(0);
|
||||||
|
} else {
|
||||||
|
orangeCollectorToggle = true;
|
||||||
|
robot.collectorOrange.setPower(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "right_bumper":
|
||||||
|
if (orangeCollectorToggle) {
|
||||||
|
orangeCollectorToggle = false;
|
||||||
|
robot.collectorOrange.setPower(0);
|
||||||
|
} else {
|
||||||
|
orangeCollectorToggle = true;
|
||||||
|
robot.collectorOrange.setPower(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "guide":
|
||||||
|
allianceRedDriver1 = !allianceRedDriver1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamepad == engine.gamepad2) {
|
||||||
|
switch (button) {
|
||||||
|
|
||||||
|
case "left_bumper":
|
||||||
|
if (whiteCollectorToggle) {
|
||||||
|
whiteCollectorToggle = false;
|
||||||
|
robot.collectorWhite.setPower(0);
|
||||||
|
} else {
|
||||||
|
whiteCollectorToggle = true;
|
||||||
|
robot.collectorWhite.setPower(-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "right_bumper":
|
||||||
|
if (whiteCollectorToggle) {
|
||||||
|
whiteCollectorToggle = false;
|
||||||
|
robot.collectorWhite.setPower(0);
|
||||||
|
} else {
|
||||||
|
whiteCollectorToggle = true;
|
||||||
|
robot.collectorWhite.setPower(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "guide":
|
||||||
|
allianceRedDriver2 = !allianceRedDriver2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void turretOrbitControl (Gamepad gamepad, CRServo turretServo, boolean bias){
|
||||||
|
|
||||||
|
// if either of these buttons... move the servo
|
||||||
|
// turretServo1 = orange
|
||||||
|
if (gamepad.dpad_right || gamepad.dpad_left) {
|
||||||
|
if (bias) {
|
||||||
|
if (gamepad.dpad_right) {
|
||||||
|
turretServo.setPower(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamepad.dpad_left) {
|
||||||
|
turretServo.setPower(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (gamepad.dpad_right) {
|
||||||
|
turretServo.setPower(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gamepad.dpad_left) {
|
||||||
|
turretServo.setPower(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
turretServo.setPower(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.MecanumRobot_Spencer;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
|
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||||
|
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
public class MecanumRobot {
|
||||||
|
|
||||||
|
private final CyberarmEngine engine;
|
||||||
|
|
||||||
|
// Drivetrain
|
||||||
|
|
||||||
|
public DcMotor driveFrontLeft, driveFrontRight, driveBackLeft, driveBackRight;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public MecanumRobot(CyberarmEngine engine) {
|
||||||
|
this.engine = engine;
|
||||||
|
initDrivetrain();
|
||||||
|
}
|
||||||
|
private void initDrivetrain() {
|
||||||
|
|
||||||
|
driveFrontRight = engine.hardwareMap.dcMotor.get("driveFrontRight");
|
||||||
|
driveFrontLeft = engine.hardwareMap.dcMotor.get("driveFrontLeft");
|
||||||
|
driveBackRight = engine.hardwareMap.dcMotor.get("driveBackRight");
|
||||||
|
driveBackLeft = engine.hardwareMap.dcMotor.get("driveBackLeft");
|
||||||
|
|
||||||
|
driveFrontLeft.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||||
|
driveFrontRight.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||||
|
|
||||||
|
driveBackLeft.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||||
|
driveBackRight.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.MecanumRobot_Spencer;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
|
||||||
|
@TeleOp(name = "TeleOp Mecanum Robot")
|
||||||
|
|
||||||
|
public class Mecanum_Drive_Engine extends CyberarmEngine {
|
||||||
|
@Override
|
||||||
|
public void setup() { addState(new TeleOpStateMecanumRobot(new MecanumRobot(this)));}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package org.timecrafters.FreightFrenzy.MecanumRobot_Spencer;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.FreightFrenzy.MecanumRobot_Spencer.MecanumRobot;
|
||||||
|
|
||||||
|
public class TeleOpStateMecanumRobot extends CyberarmState {
|
||||||
|
|
||||||
|
MecanumRobot robot;
|
||||||
|
|
||||||
|
public TeleOpStateMecanumRobot(MecanumRobot mecanumRobot) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
|
||||||
|
// Slow Mode
|
||||||
|
|
||||||
|
if (engine.gamepad1.left_trigger > 0.5){
|
||||||
|
// TankDrive
|
||||||
|
// Left joystick forward; Left side forward;
|
||||||
|
|
||||||
|
robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 0.5);
|
||||||
|
robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 0.5);
|
||||||
|
|
||||||
|
// Right joystick forward; Right side forward;
|
||||||
|
robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 0.5);
|
||||||
|
robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
// Strafing left and right
|
||||||
|
|
||||||
|
if (engine.gamepad1.left_bumper) {
|
||||||
|
robot.driveFrontLeft.setPower(0.5);
|
||||||
|
robot.driveBackLeft.setPower(-0.5);
|
||||||
|
robot.driveFrontRight.setPower(-0.5);
|
||||||
|
robot.driveBackRight.setPower(0.5);
|
||||||
|
} else if (engine.gamepad1.right_bumper) {
|
||||||
|
robot.driveFrontLeft.setPower(-0.5);
|
||||||
|
robot.driveBackLeft.setPower(0.5);
|
||||||
|
robot.driveFrontRight.setPower(0.5);
|
||||||
|
robot.driveBackRight.setPower(-0.5);
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 0.5);
|
||||||
|
// robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 0.5);
|
||||||
|
// robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 0.5);
|
||||||
|
// robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// Normal Speed
|
||||||
|
|
||||||
|
if (engine.gamepad1.right_stick_button) {
|
||||||
|
|
||||||
|
// left stick forward; right side foward
|
||||||
|
robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
|
||||||
|
// right stick foward; right side foward;
|
||||||
|
robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
// Strafing left and right
|
||||||
|
|
||||||
|
if (engine.gamepad1.left_bumper) {
|
||||||
|
robot.driveFrontLeft.setPower(1);
|
||||||
|
robot.driveBackLeft.setPower(-1);
|
||||||
|
robot.driveFrontRight.setPower(-1);
|
||||||
|
robot.driveBackRight.setPower(1);
|
||||||
|
} else if (engine.gamepad1.right_bumper) {
|
||||||
|
robot.driveFrontLeft.setPower(-1);
|
||||||
|
robot.driveBackLeft.setPower(1);
|
||||||
|
robot.driveFrontRight.setPower(1);
|
||||||
|
robot.driveBackRight.setPower(-1);
|
||||||
|
} else {
|
||||||
|
robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
// left stick foward; right side foward
|
||||||
|
robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
|
||||||
|
// right stick foward; right side foward;
|
||||||
|
robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
|
||||||
|
|
||||||
|
// Strafing left and right
|
||||||
|
|
||||||
|
// if (engine.gamepad1.left_bumper) {
|
||||||
|
// robot.driveFrontLeft.setPower(1);
|
||||||
|
// robot.driveBackLeft.setPower(-1);
|
||||||
|
// robot.driveFrontRight.setPower(-1);
|
||||||
|
// robot.driveBackRight.setPower(1);
|
||||||
|
// } else if (engine.gamepad1.right_bumper) {
|
||||||
|
// robot.driveFrontLeft.setPower(-1);
|
||||||
|
// robot.driveBackLeft.setPower(1);
|
||||||
|
// robot.driveFrontRight.setPower(1);
|
||||||
|
// robot.driveBackRight.setPower(-1);
|
||||||
|
// } else {
|
||||||
|
// robot.driveFrontLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
// robot.driveBackLeft.setPower(engine.gamepad1.left_stick_y * 1);
|
||||||
|
// robot.driveFrontRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
// robot.driveBackRight.setPower(engine.gamepad1.right_stick_y * 1);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,8 +85,8 @@ public class TensorFlowCheck extends CyberarmState {
|
|||||||
|
|
||||||
setHasFinished(true);
|
setHasFinished(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void telemetry() {
|
public void telemetry() {
|
||||||
engine.telemetry.addData("Chosen Path", path);
|
engine.telemetry.addData("Chosen Path", path);
|
||||||
|
|||||||
Reference in New Issue
Block a user