mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-15 16:42:35 +00:00
Configuration
This commit is contained in:
@@ -1,11 +1,32 @@
|
||||
package org.timecrafters.Autonomous.States;
|
||||
|
||||
import org.cyberarm.engine.V2.CyberarmState;
|
||||
import org.timecrafters.testing.states.PrototypeBot1;
|
||||
|
||||
public class LowerArm extends CyberarmState {
|
||||
|
||||
PrototypeBot1 robot;
|
||||
double LowerRiserRightPos, LowerRiserLeftPos;
|
||||
long time;
|
||||
long lastStepTime = 0;
|
||||
|
||||
public LowerArm(PrototypeBot1 robot, String groupName, String actionName) {
|
||||
this.robot = robot;
|
||||
this.LowerRiserLeftPos = robot.configuration.variable(groupName, actionName, "LowerRiserLeftPos").value();
|
||||
this.LowerRiserRightPos = robot.configuration.variable(groupName, actionName, "LowerRiserRightPos").value();
|
||||
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exec() {
|
||||
if (robot.LowRiserLeft.getPosition() > LowerRiserLeftPos) {
|
||||
if (System.currentTimeMillis() - lastStepTime >= time) {
|
||||
lastStepTime = System.currentTimeMillis();
|
||||
robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() - LowerRiserLeftPos);
|
||||
robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() - LowerRiserRightPos);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.qualcomm.robotcore.hardware.Servo;
|
||||
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||
import org.firstinspires.ftc.robotcore.external.navigation.Position;
|
||||
import org.firstinspires.ftc.robotcore.external.navigation.Velocity;
|
||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersConfiguration;
|
||||
|
||||
public class PrototypeBot1 {
|
||||
|
||||
@@ -21,6 +22,8 @@ public class PrototypeBot1 {
|
||||
|
||||
public BNO055IMU imu;
|
||||
|
||||
public TimeCraftersConfiguration configuration;
|
||||
|
||||
// public Servo collectorWrist;
|
||||
|
||||
public PrototypeBot1(CyberarmEngine engine) {
|
||||
@@ -42,7 +45,7 @@ public class PrototypeBot1 {
|
||||
|
||||
imu.startAccelerationIntegration(new Position(), new Velocity(), 10);
|
||||
|
||||
|
||||
configuration = new TimeCraftersConfiguration("Phoenix");
|
||||
|
||||
//motors configuration
|
||||
frontLeftDrive = engine.hardwareMap.dcMotor.get("Front Left");
|
||||
|
||||
Reference in New Issue
Block a user