mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-15 16:42:35 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
package org.timecrafters.Autonomous.States;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
import org.timecrafters.testing.states.PrototypeBot1;
|
||||||
|
|
||||||
|
public class UpperArm extends CyberarmState {
|
||||||
|
|
||||||
|
PrototypeBot1 robot;
|
||||||
|
double UpperRiserRightPos, UpperRiserLeftPos;
|
||||||
|
long time;
|
||||||
|
long lastStepTime = 0;
|
||||||
|
|
||||||
|
public UpperArm(PrototypeBot1 robot, String groupName, String actionName) {
|
||||||
|
this.robot = robot;
|
||||||
|
this.UpperRiserLeftPos = robot.configuration.variable(groupName, actionName, "LowerRiserLeftPos").value();
|
||||||
|
this.UpperRiserRightPos = robot.configuration.variable(groupName, actionName, "LowerRiserRightPos").value();
|
||||||
|
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
if (robot.HighRiserLeft.getPosition() > UpperRiserLeftPos) {
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= time) {
|
||||||
|
lastStepTime = System.currentTimeMillis();
|
||||||
|
robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() - UpperRiserLeftPos);
|
||||||
|
robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() - UpperRiserRightPos);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user