From 9084cc875ac232ad84b42580003c0f046b79527d Mon Sep 17 00:00:00 2001 From: Alex Dickhans <55064247+alexDickhans@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:28:15 -0600 Subject: [PATCH 1/3] ready for new bot changes --- .../stateMachine/state/competition/auton.hpp | 9 +- src/main.cpp | 123 ++++++------ static/close_mid_rush.json | 6 - static/close_mid_rush_elim.json | 1 - static/close_rush_mid_2.json | 42 ---- static/close_rush_mid_awp.json | 111 ++++++++++ static/close_rush_mid_no_triball.json | 137 +++++++++++++ static/close_rush_mid_triball.json | 189 ++++++++++++++++++ static/far_6_2.json | 43 +++- static/skills_3.json | 28 +-- static/skills_5.json | 8 +- static/skills_8.json | 6 +- static/skills_9.json | 62 ++++-- 13 files changed, 599 insertions(+), 166 deletions(-) delete mode 100644 static/close_mid_rush.json delete mode 100644 static/close_mid_rush_elim.json delete mode 100644 static/close_rush_mid_2.json create mode 100644 static/close_rush_mid_awp.json create mode 100644 static/close_rush_mid_no_triball.json create mode 100644 static/close_rush_mid_triball.json diff --git a/include/stateMachine/state/competition/auton.hpp b/include/stateMachine/state/competition/auton.hpp index c3c5966d..0f0d58b1 100644 --- a/include/stateMachine/state/competition/auton.hpp +++ b/include/stateMachine/state/competition/auton.hpp @@ -83,15 +83,18 @@ namespace Pronounce { class Auton : public Enabled { private: pros::task_fn_t auton; + void* args; pros::Task task; public: - Auton(pros::task_fn_t auton) : task([=]() -> void { return; }), Enabled("Auton") { + Auton(pros::task_fn_t auton, void* args = nullptr) : task([=]() -> void { return; }), Enabled("Auton") { this->auton = auton; + this->args = args; } - void setAuton(pros::task_fn_t auton) { + void setAuton(pros::task_fn_t auton, void* args = nullptr) { Log("Set auton"); this->auton = auton; + this->args = args; } void initialize() override { @@ -103,7 +106,7 @@ namespace Pronounce { if (task.get_state() == 2) task.remove(); - task = pros::Task(auton, nullptr, TASK_PRIORITY_MAX-1, TASK_STACK_DEPTH_DEFAULT, "User auton"); + task = pros::Task(auton, args, TASK_PRIORITY_MAX-1, TASK_STACK_DEPTH_DEFAULT, "User auton"); } void update() override { diff --git a/src/main.cpp b/src/main.cpp index 3e15f935..b9d23465 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,24 +4,24 @@ std::shared_ptr tabview; // SECTION Auton -SMOOTH_SPLINE_PATH_ASSET(close_mid_rush); -SMOOTH_SPLINE_PATH_ASSET(safe_close_awp); -SMOOTH_SPLINE_PATH_ASSET(far_6_1); -SMOOTH_SPLINE_PATH_ASSET(far_6_2); -SMOOTH_SPLINE_PATH_ASSET(far_6_3); -SMOOTH_SPLINE_PATH_ASSET(far_6_4); -SMOOTH_SPLINE_PATH_ASSET(skills_1); -SMOOTH_SPLINE_PATH_ASSET(skills_2); -SMOOTH_SPLINE_PATH_ASSET(skills_3); -SMOOTH_SPLINE_PATH_ASSET(skills_5); -SMOOTH_SPLINE_PATH_ASSET(skills_6); -SMOOTH_SPLINE_PATH_ASSET(skills_6_5); -SMOOTH_SPLINE_PATH_ASSET(skills_7); -SMOOTH_SPLINE_PATH_ASSET(skills_7_5); -SMOOTH_SPLINE_PATH_ASSET(skills_8); -SMOOTH_SPLINE_PATH_ASSET(skills_9); -SMOOTH_SPLINE_PATH_ASSET(close_mid_rush_elim); -SMOOTH_SPLINE_PATH_ASSET(close_rush_mid_2); +SMOOTH_SPLINE_PATH_ASSET(close_rush_mid_awp) +SMOOTH_SPLINE_PATH_ASSET(close_rush_mid_triball) +SMOOTH_SPLINE_PATH_ASSET(close_rush_mid_no_triball) +SMOOTH_SPLINE_PATH_ASSET(safe_close_awp) +SMOOTH_SPLINE_PATH_ASSET(far_6_1) +SMOOTH_SPLINE_PATH_ASSET(far_6_2) +SMOOTH_SPLINE_PATH_ASSET(far_6_3) +SMOOTH_SPLINE_PATH_ASSET(far_6_4) +SMOOTH_SPLINE_PATH_ASSET(skills_1) +SMOOTH_SPLINE_PATH_ASSET(skills_2) +SMOOTH_SPLINE_PATH_ASSET(skills_3) +SMOOTH_SPLINE_PATH_ASSET(skills_5) +SMOOTH_SPLINE_PATH_ASSET(skills_6) +SMOOTH_SPLINE_PATH_ASSET(skills_6_5) +SMOOTH_SPLINE_PATH_ASSET(skills_7) +SMOOTH_SPLINE_PATH_ASSET(skills_7_5) +SMOOTH_SPLINE_PATH_ASSET(skills_8) +SMOOTH_SPLINE_PATH_ASSET(skills_9) void turnTo(Angle angle, QTime waitTimeMS, RotationOptimizer rotationOptimizer = none, double idleSpeed = 0.0) { auto angleRotation = std::make_shared("AngleTurn", drivetrain, @@ -30,7 +30,7 @@ void turnTo(Angle angle, QTime waitTimeMS, RotationOptimizer rotationOptimizer = drivetrainStateController->sb(angleRotation); - pros::Task::delay(waitTimeMS.Convert(millisecond)); + pros::Task::delay(static_cast(waitTimeMS.Convert(millisecond))); drivetrainStateController->ud(); pros::Task::delay(10); @@ -129,22 +129,24 @@ void skills(void *args) { frontRightWingStateController->sb(frontRightWingIn); frontLeftWingStateController->sb(frontLeftWingIn); - turnTo(-15.0_deg, 600_ms, clockwise); + turnTo(180.0_deg, 600_ms, clockwise); catapultStateController->sb(catapultHoldHigh); pathFollower->setMotionProfile(skills_3); drivetrainStateController->sb(pathFollower)->wait(); - move(20_in, speedProfileConstraints, 0.0, 100_deg); + move(20_in, speedProfileConstraints, 0.0, -80_deg); - turnTo(115_deg, 1.0_s, closest, -12000); + turnTo(-70_deg, 1.0_s, closest, -12000); - move(20_in, speedProfileConstraints, 0.0, 100_deg); + move(20_in, speedProfileConstraints, 0.0, -80_deg); backRightWingStateController->ud(); backLeftWingStateController->ud(); - turnTo(115_deg, 1.0_s, closest, -12000); + turnTo(-70_deg, 1.0_s, closest, -12000); + + turnTo(-170_deg, 0.4_s, closest); pathFollower->setMotionProfile(skills_5); drivetrainStateController->sb(pathFollower)->wait(); @@ -194,22 +196,22 @@ void skills(void *args) { pushingProfileConstraints)})); drivetrainStateController->sb(pathFollower)->wait(); - turnTo(125_deg, 0.4_s, closest); + turnTo(-55_deg, 0.4_s, closest); pathFollower->setMotionProfile(skills_8); drivetrainStateController->sb(pathFollower)->wait(); - move(20_in, speedProfileConstraints, 0.0, -100_deg); + move(20_in, speedProfileConstraints, 0.0, 90_deg); - turnTo(-115_deg, 1.0_s, closest, -12000); + turnTo(80_deg, 1.0_s, closest, -12000); winchStateController->sb(winchUp); - move(20_in, speedProfileConstraints, 0.0, -100_deg); + move(20_in, speedProfileConstraints, 0.0, 90_deg); backLeftWingStateController->ud(); - turnTo(-115_deg, 1.0_s, closest, -12000); + turnTo(80_deg, 1.0_s, closest, -12000); pathFollower->setMotionProfile(skills_9); drivetrainStateController->sb(pathFollower)->wait(); @@ -238,7 +240,7 @@ void safeCloseAWPDelay(void *args) { } -void closeRushMid(void *args) { +void closeRushMidAwp(void *args) { imuOrientation.setRotation(-75.7_deg); frontLeftWingStateController->sb(std::make_shared(frontLeftWingOut, 300_ms)); @@ -247,48 +249,38 @@ void closeRushMid(void *args) { move(41_in, speedProfileConstraints, 0.0, -75.7_deg); - intakeExtensionStateController->ud(); - intakeStateController->sb(intakeIntaking); - - move(-13_in, speedProfileConstraints, 0.0, -75.7_deg); - - turnTo(104.3_deg, 600_ms); - - intakeStateController->sb(intakeEject); - - turnTo(104.3_deg, 200_ms); - - turnTo(-35.3_deg, 600_ms); - - pathFollower->setMotionProfile(PathPlanner::SmoothSplineProfile::build(close_mid_rush_json)); + pathFollower->setMotionProfile(close_rush_mid_awp); drivetrainStateController->sb(pathFollower)->wait(); - move(-10_in, speedProfileConstraints, 0.0, 56_deg); - - intakeStateController->sb(intakeEject); - - pathFollower->setMotionProfile(PathPlanner::SmoothSplineProfile::build(close_rush_mid_2_json)); - drivetrainStateController->sb(pathFollower)->wait(); + pros::Task::delay(15000); } void closeRushMidElim(void *args) { - closeRushMid(args); + imuOrientation.setRotation(-75.7_deg); - turnTo(-180_deg, 800_ms); + frontLeftWingStateController->sb(std::make_shared(frontLeftWingOut, 300_ms)); - intakeStateController->sb(intakeIntaking); + intakeExtensionStateController->sb(deploySequence); - pathFollower->setMotionProfile(PathPlanner::SmoothSplineProfile::build(close_mid_rush_elim_json)); - drivetrainStateController->sb(pathFollower)->wait(); -} + move(41_in, speedProfileConstraints, 0.0, -75.7_deg); -void tuneTurnPid(void *args) { - imuOrientation.setRotation(0.0_deg); - for (int i = 0; i < 5; ++i) { - turnTo(180_deg, 2_s); - turnTo(0.0_deg, 2_s); + move(-10_in, speedProfileConstraints, 0.0, -75.7_deg); + + if (hopperDistanceSensor.get() * 1_mm < 160_mm) { + // Has triball in the intake + pathFollower->setMotionProfile(close_rush_mid_triball); + turnTo(50_deg, 0.5_s); + drivetrainStateController->sb(pathFollower)->wait(); + } else { + // Doesn't have a triball in the intake + pathFollower->setMotionProfile(close_rush_mid_no_triball); + turnTo(0_deg, 0.4_s); + drivetrainStateController->sb(pathFollower)->wait(); } + + pros::Task::delay(15000); } + // !SECTION // SECTION INIT @@ -401,15 +393,18 @@ void initialize() { #elif AUTON == 1 auton->setAuton(far6BallAWP); #elif AUTON == 2 - auton->setAuton(safeCloseAWPDelay); + auton->setAuton(safeCloseAWP); #elif AUTON == 3 - auton->setAuton(closeRushMidElim); + auton->setAuton(safeCloseAWPDelay); #elif AUTON == 4 - auton->setAuton(closeRushMid); + auton->setAuton(closeRushMidElim); #elif AUTON == 5 + auton->setAuton(closeRushMidAwp); +#elif AUTON == 6 auton->setAuton(skills); #endif // !1 + // Initialize functions initHardware(); initIntake(); diff --git a/static/close_mid_rush.json b/static/close_mid_rush.json deleted file mode 100644 index 96562e19..00000000 --- a/static/close_mid_rush.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "startSpeed": 0.0, - "endSpeed": 0.0, - "segments": [], - "commands": [] -} \ No newline at end of file diff --git a/static/close_mid_rush_elim.json b/static/close_mid_rush_elim.json deleted file mode 100644 index 847b2abd..00000000 --- a/static/close_mid_rush_elim.json +++ /dev/null @@ -1 +0,0 @@ -{"segments":[{"inverted":true,"stopEnd":false,"paths":[{"x":3.277,"y":1.509},{"x":3.261,"y":1.145},{"x":3.213,"y":0.756},{"x":3.183,"y":0.461}],"constraints":{"velocity":35,"accel":120}}],"commands":[{"t":0.0,"name":"leftWingOut"},{"t":0.77,"name":"outtake"}]} \ No newline at end of file diff --git a/static/close_rush_mid_2.json b/static/close_rush_mid_2.json deleted file mode 100644 index d1462d73..00000000 --- a/static/close_rush_mid_2.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "startSpeed": 0.0, - "endSpeed": 0.0, - "segments": [ - { - "inverted": false, - "stopEnd": false, - "paths": [ - { - "x": 3.016, - "y": 0.45 - }, - { - "x": 3.247, - "y": 0.555 - }, - { - "x": 3.429, - "y": 1.221 - }, - { - "x": 3.43, - "y": 1.485 - } - ], - "constraints": { - "velocity": 35, - "accel": 120 - } - } - ], - "commands": [ - { - "t": 0.0, - "name": "leftWingOut" - }, - { - "t": 0.77, - "name": "outtake" - } - ] -} \ No newline at end of file diff --git a/static/close_rush_mid_awp.json b/static/close_rush_mid_awp.json new file mode 100644 index 00000000..e11996b6 --- /dev/null +++ b/static/close_rush_mid_awp.json @@ -0,0 +1,111 @@ +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 1.946, + "y": 1.237 + }, + { + "x": 2.307, + "y": 1.248 + }, + { + "x": 2.238, + "y": 1.006 + }, + { + "x": 3.558, + "y": 0.959 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 3.558, + "y": 0.959 + }, + { + "x": 3.265, + "y": 0.88 + }, + { + "x": 3.146, + "y": 0.277 + }, + { + "x": 2.746, + "y": 0.297 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 2.746, + "y": 0.297 + }, + { + "x": 3.33, + "y": 0.405 + }, + { + "x": 3.316, + "y": 0.826 + }, + { + "x": 2.981, + "y": 0.892 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.981, + "y": 0.892 + }, + { + "x": 3.271, + "y": 0.967 + }, + { + "x": 3.36, + "y": 1.184 + }, + { + "x": 3.347, + "y": 1.711 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + } + ], + "commands": [] +} \ No newline at end of file diff --git a/static/close_rush_mid_no_triball.json b/static/close_rush_mid_no_triball.json new file mode 100644 index 00000000..07d34d9d --- /dev/null +++ b/static/close_rush_mid_no_triball.json @@ -0,0 +1,137 @@ +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.176, + "y": 1.251 + }, + { + "x": 2.125, + "y": 1.418 + }, + { + "x": 2.061, + "y": 1.699 + }, + { + "x": 1.924, + "y": 1.702 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 1.924, + "y": 1.702 + }, + { + "x": 2.339, + "y": 1.575 + }, + { + "x": 2.492, + "y": 0.932 + }, + { + "x": 3.501, + "y": 0.897 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 3.501, + "y": 0.897 + }, + { + "x": 2.991, + "y": 0.794 + }, + { + "x": 3.024, + "y": 0.329 + }, + { + "x": 2.727, + "y": 0.276 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 2.727, + "y": 0.276 + }, + { + "x": 3.258, + "y": 0.39 + }, + { + "x": 3.269, + "y": 0.757 + }, + { + "x": 2.933, + "y": 0.881 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.933, + "y": 0.881 + }, + { + "x": 3.314, + "y": 1.001 + }, + { + "x": 3.387, + "y": 1.249 + }, + { + "x": 3.387, + "y": 1.671 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + } + ], + "commands": [] +} \ No newline at end of file diff --git a/static/close_rush_mid_triball.json b/static/close_rush_mid_triball.json new file mode 100644 index 00000000..2cb4a7b3 --- /dev/null +++ b/static/close_rush_mid_triball.json @@ -0,0 +1,189 @@ +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.176, + "y": 1.251 + }, + { + "x": 2.379, + "y": 1.404 + }, + { + "x": 2.724, + "y": 1.519 + }, + { + "x": 3.022, + "y": 1.513 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 3.021, + "y": 1.514 + }, + { + "x": 2.618, + "y": 1.496 + }, + { + "x": 2.444, + "y": 1.533 + }, + { + "x": 2.358, + "y": 1.204 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.358, + "y": 1.204 + }, + { + "x": 2.317, + "y": 1.483 + }, + { + "x": 2.134, + "y": 1.586 + }, + { + "x": 1.941, + "y": 1.725 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 1.924, + "y": 1.702 + }, + { + "x": 2.267, + "y": 1.488 + }, + { + "x": 2.492, + "y": 0.932 + }, + { + "x": 3.501, + "y": 0.897 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 3.501, + "y": 0.897 + }, + { + "x": 2.991, + "y": 0.794 + }, + { + "x": 3.024, + "y": 0.329 + }, + { + "x": 2.727, + "y": 0.276 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 2.727, + "y": 0.276 + }, + { + "x": 3.258, + "y": 0.39 + }, + { + "x": 3.269, + "y": 0.757 + }, + { + "x": 2.933, + "y": 0.881 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 2.933, + "y": 0.881 + }, + { + "x": 3.314, + "y": 1.0 + }, + { + "x": 3.401, + "y": 1.276 + }, + { + "x": 3.401, + "y": 1.698 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + } + ], + "commands": [] +} \ No newline at end of file diff --git a/static/far_6_2.json b/static/far_6_2.json index 57a4ff6c..2ef723ef 100644 --- a/static/far_6_2.json +++ b/static/far_6_2.json @@ -1 +1,42 @@ -{"segments":[{"inverted":true,"stopEnd":false,"paths":[{"x":3.349,"y":2.118},{"x":3.534,"y":2.985},{"x":3.202,"y":3.455},{"x":2.197,"y":3.214}],"constraints":{"velocity":76,"accel":200}}],"commands":[{"t":0.18,"name":"backRightWingOut"},{"t":0.36,"name":"backLeftWingOut"},{"t":0.6,"name":"backLeftWingIn"}]} \ No newline at end of file +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": true, + "stopEnd": false, + "paths": [ + { + "x": 3.349, + "y": 2.118 + }, + { + "x": 3.534, + "y": 2.985 + }, + { + "x": 3.202, + "y": 3.455 + }, + { + "x": 2.197, + "y": 3.214 + } + ], + "constraints": { + "velocity": 76, + "accel": 200 + } + } + ], + "commands": [ + { + "t": 0.41, + "name": "frontLeftWingOut" + }, + { + "t": 0.81, + "name": "frontLeftWingIn" + } + ] +} \ No newline at end of file diff --git a/static/skills_3.json b/static/skills_3.json index f7b90de5..b6335ee2 100644 --- a/static/skills_3.json +++ b/static/skills_3.json @@ -3,7 +3,7 @@ "endSpeed": -72.0, "segments": [ { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { @@ -29,7 +29,7 @@ } }, { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { @@ -55,7 +55,7 @@ } }, { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { @@ -84,27 +84,7 @@ "commands": [ { "t": 0.0, - "name": "backRightWingOut" - }, - { - "t": 0.0, - "name": "frontWingsIn" - }, - { - "t": 0.84, - "name": "backLeftWingOut" - }, - { - "t": 1.12, - "name": "backLeftWingIn" - }, - { - "t": 2.13, - "name": "backLeftWingOut" - }, - { - "t": 2.5, - "name": "backLeftWingIn" + "name": "frontLeftWingOut" } ] } \ No newline at end of file diff --git a/static/skills_5.json b/static/skills_5.json index 19e1ab59..fe9ae637 100644 --- a/static/skills_5.json +++ b/static/skills_5.json @@ -7,12 +7,12 @@ "stopEnd": false, "paths": [ { - "x": 2.646, - "y": 3.331 + "x": 2.685, + "y": 3.333 }, { - "x": 2.826, - "y": 3.337 + "x": 2.696, + "y": 2.961 }, { "x": 2.669, diff --git a/static/skills_8.json b/static/skills_8.json index 8552128c..dc0fa744 100644 --- a/static/skills_8.json +++ b/static/skills_8.json @@ -3,7 +3,7 @@ "endSpeed": -72.0, "segments": [ { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { @@ -29,7 +29,7 @@ } }, { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { @@ -55,7 +55,7 @@ } }, { - "inverted": true, + "inverted": false, "stopEnd": false, "paths": [ { diff --git a/static/skills_9.json b/static/skills_9.json index a6be5268..c43e658e 100644 --- a/static/skills_9.json +++ b/static/skills_9.json @@ -3,24 +3,24 @@ "endSpeed": 12.0, "segments": [ { - "inverted": false, + "inverted": true, "stopEnd": false, "paths": [ { - "x": 1.408, - "y": 3.344 + "x": 1.244, + "y": 3.293 }, { - "x": 1.022, - "y": 3.346 + "x": 1.086, + "y": 3.294 }, { - "x": 0.409, - "y": 3.146 + "x": 0.99, + "y": 3.357 }, { - "x": 0.359, - "y": 2.41 + "x": 0.999, + "y": 3.488 } ], "constraints": { @@ -33,25 +33,51 @@ "stopEnd": false, "paths": [ { - "x": 0.359, - "y": 2.41 + "x": 0.999, + "y": 3.488 }, { - "x": 0.347, - "y": 2.213 + "x": 0.996, + "y": 3.23 }, { - "x": 0.434, - "y": 2.109 + "x": 0.275, + "y": 3.17 }, { - "x": 0.429, - "y": 1.967 + "x": 0.262, + "y": 2.626 } ], "constraints": { "velocity": 76, - "accel": 200 + "accel": 140 + } + }, + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 0.262, + "y": 2.626 + }, + { + "x": 0.25, + "y": 2.319 + }, + { + "x": 0.387, + "y": 2.262 + }, + { + "x": 0.388, + "y": 1.883 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 } } ], From ca8f569d38037d308ad30318fd8cf98baf58b4b9 Mon Sep 17 00:00:00 2001 From: Alex Dickhans <55064247+alexDickhans@users.noreply.github.com> Date: Mon, 15 Apr 2024 21:29:15 -0600 Subject: [PATCH 2/3] Working on 6 ball --- src/main.cpp | 4 ++-- static/far_6_1.json | 2 +- static/far_6_2.json | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b9d23465..fd899606 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -61,7 +61,7 @@ void far6Ball(void* args) { intakeExtensionStateController->sb(deploySequence); - move(51_in, speedProfileConstraints, 0.0, -120.5_deg); + move(56_in, speedProfileConstraints, 0.0, -120.5_deg); intakeExtensionStateController->ud(); @@ -70,7 +70,7 @@ void far6Ball(void* args) { turnTo(-180_deg, 0.4_s); intakeStateController->sb(intakeIntaking); - move(5_in, speedProfileConstraints, 0.0, -180_deg); + move(7_in, speedProfileConstraints, 0.0, -180_deg); pathFollower->setMotionProfile(far_6_2); drivetrainStateController->sb(pathFollower)->wait(); diff --git a/static/far_6_1.json b/static/far_6_1.json index 42f0ba5a..9f19d15c 100644 --- a/static/far_6_1.json +++ b/static/far_6_1.json @@ -199,7 +199,7 @@ "name": "outtake" }, { - "t": 3.77, + "t": 3.43, "name": "intake" }, { diff --git a/static/far_6_2.json b/static/far_6_2.json index 2ef723ef..9c0a72da 100644 --- a/static/far_6_2.json +++ b/static/far_6_2.json @@ -11,12 +11,12 @@ "y": 2.118 }, { - "x": 3.534, - "y": 2.985 + "x": 3.343, + "y": 3.008 }, { - "x": 3.202, - "y": 3.455 + "x": 3.004, + "y": 3.361 }, { "x": 2.197, @@ -31,7 +31,7 @@ ], "commands": [ { - "t": 0.41, + "t": 0.33, "name": "frontLeftWingOut" }, { From 347746beae16483b763915702e5a3a6eeeb1e687 Mon Sep 17 00:00:00 2001 From: Alex Dickhans <55064247+alexDickhans@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:23:11 -0600 Subject: [PATCH 3/3] 6 ball ready for worlds --- include/auton.h | 2 +- .../behaviors/intake/initIntake.hpp | 2 +- src/main.cpp | 14 ++++++-- static/far_6_1.json | 26 +++++++------- static/far_6_2.json | 8 ++--- static/far_6_3.json | 34 ++++++++++++++++++- static/far_6_5.json | 33 ++++++++++++++++++ static/safe_close_awp.json | 32 ++++++++--------- 8 files changed, 112 insertions(+), 39 deletions(-) create mode 100644 static/far_6_5.json diff --git a/include/auton.h b/include/auton.h index 358f067c..a2ca5c7e 100755 --- a/include/auton.h +++ b/include/auton.h @@ -1 +1 @@ -#define AUTON 0 +#define AUTON 2 diff --git a/include/stateMachine/behaviors/intake/initIntake.hpp b/include/stateMachine/behaviors/intake/initIntake.hpp index ee044263..0349326e 100644 --- a/include/stateMachine/behaviors/intake/initIntake.hpp +++ b/include/stateMachine/behaviors/intake/initIntake.hpp @@ -9,7 +9,7 @@ namespace Pronounce { auto intakeStopped = std::make_shared("IntakeStopped", intakeMotors, 0.0); auto intakeIntaking = std::make_shared("IntakeIntaking", intakeMotors, 1.0); - auto intakeHold = std::make_shared("IntakeHold", intakeMotors, 0.55); + auto intakeHold = std::make_shared("IntakeHold", intakeMotors, 0.65); auto intakeEject = std::make_shared("IntakeEject", intakeMotors, -1.0); auto intakeStateController = std::make_shared("IntakeStateController", intakeStopped); diff --git a/src/main.cpp b/src/main.cpp index fd899606..6f510bae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,8 @@ void far6Ball(void* args) { move(56_in, speedProfileConstraints, 0.0, -120.5_deg); + pros::Task::delay(200); + intakeExtensionStateController->ud(); pathFollower->setMotionProfile(far_6_1); @@ -77,7 +79,7 @@ void far6Ball(void* args) { backRightWingStateController->ud(); move(15_in, speedProfileConstraints, 0.0, -250_deg); - turnTo(-430_deg, 0.6_s); + turnTo(-45_deg, 0.6_s, counterclockwise); frontLeftWingStateController->sb(frontLeftWingOut); @@ -88,7 +90,12 @@ void far6Ball(void* args) { move(-15_in, defaultProfileConstraints, 0.0, -430_deg); - frontLeftWingStateController->ud(); +// frontLeftWingStateController->ud(); + +} + +void far6BallElim(void* args) { + far6Ball(args); pathFollower->setMotionProfile(far_6_3); drivetrainStateController->sb(pathFollower)->wait(); @@ -97,7 +104,8 @@ void far6Ball(void* args) { } void far6BallAWP(void* args) { - far6Ball(args); + pathFollower->setMotionProfile(far_6_4); + drivetrainStateController->sb(pathFollower)->wait(); } void skills(void *args) { diff --git a/static/far_6_1.json b/static/far_6_1.json index 9f19d15c..4ad29476 100644 --- a/static/far_6_1.json +++ b/static/far_6_1.json @@ -16,11 +16,11 @@ }, { "x": 2.271, - "y": 2.036 + "y": 2.101 }, { "x": 2.271, - "y": 1.926 + "y": 1.991 } ], "constraints": { @@ -93,12 +93,12 @@ "y": 2.354 }, { - "x": 2.378, - "y": 2.147 + "x": 2.392, + "y": 2.206 }, { - "x": 2.334, - "y": 1.915 + "x": 2.348, + "y": 1.974 } ], "constraints": { @@ -171,12 +171,12 @@ "y": 2.671 }, { - "x": 2.678, - "y": 2.389 + "x": 2.663, + "y": 2.277 }, { - "x": 3.567, - "y": 2.764 + "x": 3.564, + "y": 2.619 } ], "constraints": { @@ -187,7 +187,7 @@ ], "commands": [ { - "t": 0.88, + "t": 0.72, "name": "outtake" }, { @@ -195,7 +195,7 @@ "name": "intake" }, { - "t": 2.24, + "t": 2.35, "name": "outtake" }, { @@ -203,7 +203,7 @@ "name": "intake" }, { - "t": 4.84, + "t": 4.73, "name": "outtake" }, { diff --git a/static/far_6_2.json b/static/far_6_2.json index 9c0a72da..a59bc6af 100644 --- a/static/far_6_2.json +++ b/static/far_6_2.json @@ -15,12 +15,12 @@ "y": 3.008 }, { - "x": 3.004, - "y": 3.361 + "x": 3.138, + "y": 3.445 }, { - "x": 2.197, - "y": 3.214 + "x": 2.836, + "y": 3.194 } ], "constraints": { diff --git a/static/far_6_3.json b/static/far_6_3.json index c7f133bc..5c7c48be 100644 --- a/static/far_6_3.json +++ b/static/far_6_3.json @@ -1 +1,33 @@ -{"segments":[{"inverted":false,"stopEnd":false,"paths":[{"x":2.917,"y":3.215},{"x":2.8,"y":3.395},{"x":2.673,"y":3.469},{"x":2.429,"y":3.473}],"constraints":{"velocity":76,"accel":200}}],"commands":[]} \ No newline at end of file +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 3.004, + "y": 3.183 + }, + { + "x": 2.901, + "y": 3.391 + }, + { + "x": 2.673, + "y": 3.469 + }, + { + "x": 2.429, + "y": 3.473 + } + ], + "constraints": { + "velocity": 76, + "accel": 200 + } + } + ], + "commands": [] +} \ No newline at end of file diff --git a/static/far_6_5.json b/static/far_6_5.json new file mode 100644 index 00000000..71c48d39 --- /dev/null +++ b/static/far_6_5.json @@ -0,0 +1,33 @@ +{ + "startSpeed": 0.0, + "endSpeed": 0.0, + "segments": [ + { + "inverted": false, + "stopEnd": false, + "paths": [ + { + "x": 3.257, + "y": 3.215 + }, + { + "x": 3.003, + "y": 2.948 + }, + { + "x": 3.313, + "y": 2.413 + }, + { + "x": 3.318, + "y": 2.064 + } + ], + "constraints": { + "velocity": 76, + "accel": 140 + } + } + ], + "commands": [] +} \ No newline at end of file diff --git a/static/safe_close_awp.json b/static/safe_close_awp.json index 94866c4c..05a4163a 100644 --- a/static/safe_close_awp.json +++ b/static/safe_close_awp.json @@ -15,12 +15,12 @@ "y": 0.452 }, { - "x": 2.952, - "y": 0.35 + "x": 2.946, + "y": 0.436 }, { - "x": 2.763, - "y": 0.322 + "x": 2.757, + "y": 0.408 } ], "constraints": { @@ -33,16 +33,16 @@ "stopEnd": false, "paths": [ { - "x": 2.76, - "y": 0.325 + "x": 2.763, + "y": 0.409 }, { - "x": 3.153, - "y": 0.388 + "x": 3.255, + "y": 0.408 }, { - "x": 3.326, - "y": 0.748 + "x": 3.235, + "y": 0.791 }, { "x": 2.975, @@ -67,12 +67,12 @@ "y": 0.944 }, { - "x": 3.445, - "y": 1.229 + "x": 3.43, + "y": 1.19 }, { - "x": 3.442, - "y": 1.464 + "x": 3.427, + "y": 1.425 } ], "constraints": { @@ -88,11 +88,11 @@ }, { "t": 0.86, - "name": "backLeftWingOut" + "name": "frontLeftWingOut" }, { "t": 1.3, - "name": "backLeftWingIn" + "name": "frontLeftWingIn" }, { "t": 2.04,