mirror of
https://github.com/TimeCrafters/FreightFrenzy.git
synced 2025-12-13 05:02:34 +00:00
started working on configuration
This commit is contained in:
@@ -12,12 +12,12 @@ public class RedWarehouseEngine extends CyberarmEngine {
|
||||
public void setup() {
|
||||
Robot robot = new Robot(this);
|
||||
|
||||
addState(new TurretOrbit(robot, robot.turretServoWhite, 3, 1));
|
||||
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, 3000, .75, 150));
|
||||
addState(new DepositorDoor(robot.whiteDispenser, .5, 1));
|
||||
addState(new DepositorDoor(robot.whiteDispenser, 0, 0));
|
||||
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, 0, 1, 150));
|
||||
addState(new TurretOrbit(robot, robot.turretServoWhite, 3, -1));
|
||||
addState(new TurretOrbit(robot, robot.turretServoWhite, "autonomous", "01_0"));
|
||||
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "autonomous", "02_0"));
|
||||
addState(new DepositorDoor(robot, robot.whiteDispenser, "autonomous", "03_0"));
|
||||
addState(new DepositorDoor(robot, robot.whiteDispenser, "autonomous", "04_0"));
|
||||
addState(new TurretArmExtension(robot, robot.whiteArmBobbin, "autonomous", "05_0"));
|
||||
addState(new TurretOrbit(robot, robot.turretServoWhite, "autonomous", "01_0"));
|
||||
addState(new DriveState(robot, 1500, 500, 1, .75));
|
||||
addState(new DriveState(robot, 1500, 1500, 1, 1));
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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 {
|
||||
|
||||
@@ -10,10 +11,10 @@ public class DepositorDoor extends CyberarmState {
|
||||
double targetPosition;
|
||||
long time;
|
||||
|
||||
public DepositorDoor(Servo servo, double targetPosition, long time) {
|
||||
public DepositorDoor(Robot robot, Servo servo, String groupName, String actionName) {
|
||||
this.servo = servo;
|
||||
this.targetPosition = targetPosition;
|
||||
this.time = time;
|
||||
this.targetPosition = robot.configuration.variable(groupName, actionName, "targetPosition").value();
|
||||
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,12 +12,12 @@ public class TurretArmExtension extends CyberarmState {
|
||||
private int targetPosition, tolerance;
|
||||
private double power;
|
||||
|
||||
public TurretArmExtension(Robot robot, DcMotor motor, int targetPosition, double power, int tolerance) {
|
||||
public TurretArmExtension(Robot robot, DcMotor motor, String groupName, String actionName) {
|
||||
this.robot = robot;
|
||||
this.motor = motor;
|
||||
this.targetPosition = targetPosition;
|
||||
this.power = power;
|
||||
this.tolerance = tolerance;
|
||||
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
|
||||
|
||||
@@ -4,6 +4,8 @@ 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;
|
||||
@@ -11,11 +13,11 @@ public class TurretOrbit extends CyberarmState {
|
||||
private long time;
|
||||
private double power;
|
||||
|
||||
public TurretOrbit(Robot robot, CRServo servo, long time, double power) {
|
||||
public TurretOrbit(Robot robot, CRServo servo, String groupName, String actionName) {
|
||||
this.robot = robot;
|
||||
this.servo = servo;
|
||||
this.time = time;
|
||||
this. power = power;
|
||||
this.time = robot.configuration.variable(groupName, actionName, "time").value();
|
||||
this. power = robot.configuration.variable(groupName, actionName, "power").value();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user