From e4a049c3c28c3682664909d46f69f1fc21ca010e Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 21:04:46 -0800 Subject: [PATCH 1/7] checkpoint 100: navigation routine to cutscene inside cave, on way to station 4. --- .../AutoStory/PokemonSV_AutoStory.cpp | 4 +- .../AutoStory/PokemonSV_AutoStoryTools.cpp | 2 +- .../PokemonSV_AutoStory_Segment_38.cpp | 174 +++++++++++++++++- .../PokemonSV_AutoStory_Segment_38.h | 8 +- 4 files changed, 173 insertions(+), 15 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index 2b3a73761..dcd68d942 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -1032,8 +1032,8 @@ void AutoStory::test_checkpoints( checkpoint_list.push_back([&](){checkpoint_97(env, context, notif_status_update, stats);}); checkpoint_list.push_back([&](){checkpoint_98(env, context, notif_status_update, stats);}); checkpoint_list.push_back([&](){checkpoint_99(env, context, notif_status_update, stats);}); - // checkpoint_list.push_back([&](){checkpoint_100(env, context, notif_status_update, stats);}); - // checkpoint_list.push_back([&](){checkpoint_101(env, context, notif_status_update, stats);}); + checkpoint_list.push_back([&](){checkpoint_100(env, context, notif_status_update, stats);}); + checkpoint_list.push_back([&](){checkpoint_101(env, context, notif_status_update, stats);}); // checkpoint_list.push_back([&](){checkpoint_102(env, context, notif_status_update, stats);}); // checkpoint_list.push_back([&](){checkpoint_103(env, context, notif_status_update, stats);}); // checkpoint_list.push_back([&](){checkpoint_104(env, context, notif_status_update, stats);}); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 415dacd25..2ee6dd4aa 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -752,7 +752,7 @@ void do_action_and_monitor_for_battles_early( if (ret == 0){ // if see no minimap. stop and see if we detect a battle. if so, throw Battl exception do_action_and_monitor_for_battles(info, stream, context, [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ - pbf_wait(context, Seconds(15)); + pbf_wait(context, Seconds(30)); }); // if no battle seen, then throw Exception. diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp index bfefa927f..adf879afd 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp @@ -28,15 +28,15 @@ namespace PokemonSV{ std::string AutoStory_Segment_38::name() const{ - return ""; + return "38: Area Zero Station 4"; } std::string AutoStory_Segment_38::start_text() const{ - return "Start: "; + return "Start: Inside Area Zero Station 2. Deactivated the locks."; } std::string AutoStory_Segment_38::end_text() const{ - return "End: "; + return "End: Inside Area Zero Station 3. Deactivated the locks."; } void AutoStory_Segment_38::run_segment( @@ -52,7 +52,8 @@ void AutoStory_Segment_38::run_segment( context.wait_for_all_requests(); env.console.log("Start Segment " + name(), COLOR_ORANGE); - // AutoStory_Checkpoint_9().run_checkpoint(env, context, options, stats); + AutoStory_Checkpoint_100().run_checkpoint(env, context, options, stats); + AutoStory_Checkpoint_101().run_checkpoint(env, context, options, stats); context.wait_for_all_requests(); env.console.log("End Segment " + name(), COLOR_GREEN); @@ -60,15 +61,15 @@ void AutoStory_Segment_38::run_segment( } std::string AutoStory_Checkpoint_100::name() const{ return "0100 - " + AutoStory_Segment_38().name(); } -std::string AutoStory_Checkpoint_100::start_text() const{ return "";} -std::string AutoStory_Checkpoint_100::end_text() const{ return "";} +std::string AutoStory_Checkpoint_100::start_text() const{ return "Inside Area Zero Station 3. Deactivated the locks.";} +std::string AutoStory_Checkpoint_100::end_text() const{ return "Entered inner cave. Finished cutscene, admiring the waterfall/large crystals.";} void AutoStory_Checkpoint_100::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ checkpoint_100(env, context, options.notif_status_update, stats); } std::string AutoStory_Checkpoint_101::name() const{ return "0101 - " + AutoStory_Segment_38().name(); } -std::string AutoStory_Checkpoint_101::start_text() const{ return "";} -std::string AutoStory_Checkpoint_101::end_text() const{ return "";} +std::string AutoStory_Checkpoint_101::start_text() const{ return AutoStory_Checkpoint_100().end_text();} +std::string AutoStory_Checkpoint_101::end_text() const{ return "Inside Area Zero Station 4. Deactivated the locks.";} void AutoStory_Checkpoint_101::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ checkpoint_101(env, context, options.notif_status_update, stats); } @@ -107,6 +108,163 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-4a.onnx"); + pbf_move_left_joystick(context, 128, 255, 500, 100); + pbf_wait(context, 3 * TICKS_PER_SECOND); + // wait for overworld after leaving research station + wait_for_overworld(env.program_info(), env.console, context, 30); + + pbf_move_right_joystick(context, 128, 160, 30, 0); // adjust camera so that head doesn't cover the rock. + + + + // align to rock-4-1. + // center before: + // center after: center-y: 0.295833 center-x: 0.511719 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock-4-1", 0.295833, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-1", 0.5); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock-4-1", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards rock-4-1 until box: {0.404688, 0.091667, 0.246875, 0.400000} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock-4-1", + 0.24, 0.3950, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-1", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // align to cave-entrance. + // center before: y: 0.35 x: 0.211719 + // center after: center-y: 0.329167 center-x: 0.517188 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "cave-entrance", 0.329167, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "cave-entrance", 0.25); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-entrance", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move forward until we see rock-4-2 + move_forward_until_yolo_object_detected(env, context, yolo_detector, "rock-4-2", + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-entrance", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + }, + 30 + ); + + move_player_forward(env, context, 2, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + } + ); + + // align to rock-4-2. + // center before: y: 0.463 x: 0.6085 + // center after: center-y: 0.295833 center-x: 0.550781 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock-4-2", 0.295833, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-2", 0.6); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock-4-2", 0.550781, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards rock-4-2 until box: {0.595313, 0.263889, 0.089063, 0.086111} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock-4-2", + 0.08, 0.086, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-2", 0.55); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // align to rock-4-3. + // center before: Y: 0.211 x: 0.789 + // center after: 0.181944 center-x: 0.503125 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock-4-3", 0.181944, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-3", 0.75); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock-4-3", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards rock-4-3 until box: {0.396875, 0.047222, 0.142187, 0.211111} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock-4-3", + 0.142, 0.211, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock-4-3", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + move_camera_until_yolo_object_detected(env, context, yolo_detector, "cave-archway-1", 255, 60); + + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-archway-1", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + do_action_until_dialog(env.program_info(), env.console, context, + [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ + move_player_forward(env, context, 20, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-archway-1", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + } + ); + + + mash_button_till_overworld(env.console, context, BUTTON_A); + #if 0 // align to rock. // center before: diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h index f64c4538b..8f45b22c3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h @@ -75,12 +75,12 @@ class AutoStory_Checkpoint_102 : public AutoStory_Checkpoint{ // virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; // }; -// start: -// end: +// start: Inside Area Zero Station 3. Deactivated the locks. +// end: Entered inner cave. Finished cutscene, admiring the waterfall/large crystals. void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); -// start: -// end: +// start: Entered inner cave. Finished cutscene, admiring the waterfall/large crystals. +// end: Inside Area Zero Station 4. Deactivated the locks. void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); // start: From 4cfe4d4fef103470776f2b48030f3a1ad4f5f779 Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 21:32:06 -0800 Subject: [PATCH 2/7] rename onnx model --- .../PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp | 4 ++-- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index dcd68d942..dd626539e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -703,7 +703,7 @@ AutoStory::AutoStory() false, "YOLO Path:", LockMode::LOCK_WHILE_RUNNING, - "PokemonSV/YOLO/yolo_area0_station1.onnx", + "PokemonSV/YOLO/A0-station-2.onnx", "<.onnx file>" ) , TARGET_LABEL( @@ -1282,7 +1282,7 @@ void AutoStory::test_code(SingleSwitchProgramEnvironment& env, ProControllerCont DirectionDetector direction; - YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/yolo_area0_station1.onnx"); + YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-2.onnx"); // move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "tree-tera", 0.294444); // move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "tree-tera", 0.604688); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp index b7d354b7a..72cc7f813 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp @@ -217,7 +217,7 @@ void checkpoint_94(SingleSwitchProgramEnvironment& env, ProControllerContext& co [&](size_t attempt_number){ - YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/yolo_area0_station1.onnx"); + YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-1.onnx"); move_player_forward(env, context, 6, From 5f0821bb8c2d82e507e09c4df483cb896c7aae4f Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 22:39:10 -0800 Subject: [PATCH 3/7] move_player_until_yolo_object_detected: add X movement parameter --- .../Programs/AutoStory/PokemonSV_AutoStoryTools.cpp | 7 ++++--- .../Programs/AutoStory/PokemonSV_AutoStoryTools.h | 3 ++- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp | 2 +- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp | 2 +- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 2ee6dd4aa..09fde0300 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -1557,7 +1557,7 @@ void move_forward_until_yolo_object_above_min_size( -void move_forward_until_yolo_object_detected( +void move_player_until_yolo_object_detected( SingleSwitchProgramEnvironment& env, ProControllerContext& context, YOLOv5Detector& yolo_detector, @@ -1565,6 +1565,7 @@ void move_forward_until_yolo_object_detected( std::function&& recovery_action, uint16_t max_rounds, uint16_t forward_ticks, + uint8_t x, uint8_t y, uint16_t delay_after_forward_move, uint16_t delay_after_lets_go @@ -1588,7 +1589,7 @@ void move_forward_until_yolo_object_detected( - pbf_move_left_joystick(context, 128, y, forward_ticks, 0); + pbf_move_left_joystick(context, x, y, forward_ticks, 0); // pbf_press_button(context, BUTTON_R, 20, delay_after_lets_go); // pbf_move_left_joystick(context, 128, y, forward_ticks, delay_after_forward_move); }); @@ -1605,7 +1606,7 @@ void move_forward_until_yolo_object_detected( if (round_num > max_rounds){ OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, - "move_forward_until_yolo_object_detected(): Unable to detect target object.", + "move_player_until_yolo_object_detected(): Unable to detect target object.", env.console ); } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h index 1f8e283e8..c8d1361dd 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h @@ -422,7 +422,7 @@ void move_forward_until_yolo_object_above_min_size( // walk until we find the target object. // if caught in battle, run recovery_action // throw exception if exceed max_rounds. -void move_forward_until_yolo_object_detected( +void move_player_until_yolo_object_detected( SingleSwitchProgramEnvironment& env, ProControllerContext& context, YOLOv5Detector& yolo_detector, @@ -430,6 +430,7 @@ void move_forward_until_yolo_object_detected( std::function&& recovery_action, uint16_t max_rounds, uint16_t forward_ticks = 100, + uint8_t x = 128, uint8_t y = 0, uint16_t delay_after_forward_move = 50, uint16_t delay_after_lets_go = 105 diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp index 72cc7f813..c560046c4 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp @@ -227,7 +227,7 @@ void checkpoint_94(SingleSwitchProgramEnvironment& env, ProControllerContext& co ); // confirm we can see tree-tera - move_forward_until_yolo_object_detected(env, context, yolo_detector, "tree-tera", + move_player_until_yolo_object_detected(env, context, yolo_detector, "tree-tera", [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); }, diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp index 2c762e6b0..eabf34450 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp @@ -220,7 +220,7 @@ void checkpoint_96(SingleSwitchProgramEnvironment& env, ProControllerContext& co pbf_press_button(context, BUTTON_L, 240ms, 100ms); // confirm we can see station-2 - move_forward_until_yolo_object_detected(env, context, yolo_detector, "station-2", + move_player_until_yolo_object_detected(env, context, yolo_detector, "station-2", [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); }, diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp index b38573bcf..ebfe451c6 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp @@ -156,7 +156,7 @@ void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& co // move forward until we see rock-3-1 - move_forward_until_yolo_object_detected(env, context, yolo_detector, "rock-3-1", + move_player_until_yolo_object_detected(env, context, yolo_detector, "rock-3-1", [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera From d0d3a7ef807edcecf4170eb623d79507af9c88a2 Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 23:09:20 -0800 Subject: [PATCH 4/7] checkpoint_101: nav routine to station 4. --- .../PokemonSV_AutoStory_Segment_37.cpp | 2 +- .../PokemonSV_AutoStory_Segment_38.cpp | 342 +++++++++++++++++- 2 files changed, 333 insertions(+), 11 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp index ebfe451c6..d38dd29a0 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp @@ -222,7 +222,7 @@ void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& co 0.118, 0.2, [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - move_player_to_realign_via_yolo(env, context, yolo_detector, "tree-3-1", 0.000); // realign to target X + move_player_to_realign_via_yolo(env, context, yolo_detector, "tree-3-1", 0.5); // realign to target X pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera } ); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp index adf879afd..4a74135e7 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp @@ -162,7 +162,7 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c ); // move forward until we see rock-4-2 - move_forward_until_yolo_object_detected(env, context, yolo_detector, "rock-4-2", + move_player_until_yolo_object_detected(env, context, yolo_detector, "rock-4-2", [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-entrance", 0.5, @@ -265,14 +265,341 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c mash_button_till_overworld(env.console, context, BUTTON_A); + + }); +} + +void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ + // checkpoint_reattempt_loop(env, context, notif_status_update, stats, + // [&](size_t attempt_number){ + + + YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-4b.onnx"); + #if 0 - // align to rock. + #endif + + // align to crystal-4-1. + // center before: X: 0.84 + // center after: center-y: 0.195833 center-x: 0.621875 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "crystal-4-1", 0.195833, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-1", 0.8); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "crystal-4-1", 0.621875, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards crystal-4-1 until box: {0.804688, 0.075000, 0.187500, 0.338889} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "crystal-4-1", + 0.1, 0.338, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-1", 0.7); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // confirm we can see cave-archway-2 + move_player_until_yolo_object_detected(env, context, yolo_detector, "cave-archway-2", + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + }, + 5, + 100, + 0, 128 + ); + + + // align to cave-archway-2. + // center before: x: 0.7 + // center after: center-y: 0.173611 center-x: 0.531250 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "cave-archway-2", 0.173611, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "cave-archway-2", 0.7); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "cave-archway-2", 0.531250, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move forward until cave-archway-2 not detected + move_forward_until_yolo_object_not_detected(env, context, yolo_detector, "cave-archway-2", + 3, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "cave-archway-2", 0.5); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + move_camera_until_yolo_object_detected(env, context, yolo_detector, "crystal-4-3", 255, 60); + + + + // align to crystal-4-3. + // center before: y: x: 0.59 + // center after: center-y: 0.390278 center-x: 0.495313 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "crystal-4-3", 0.390278, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-3", 0.59); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "crystal-4-3", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards crystal-4-3 until box: {0.420313, 0.052778, 0.118750, 0.263889} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "crystal-4-3", + 0.118750, 0.2, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-3", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + + + // align to crystal-4-4. + // center before: y: x: 0.9 + // center after: center-y: 0.184722 center-x: 0.524219 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "crystal-4-4", 0.184722, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-4", 0.9); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "crystal-4-4", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards crystal-4-4 until box: {0.468750, 0.052778, 0.046875, 0.102778} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "crystal-4-4", + 0.046875, 0.102778, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-4", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + + // align to crystal-4-4. + // center before: y: x: + // center after: center-y: 0.375000 center-x: 0.492188 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "crystal-4-4", 0.375, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-4", 0.5); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + + // move towards crystal-4-4 until box: {0.420313, 0.013889, 0.118750, 0.283333} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "crystal-4-4", + 0.118750, 0.25, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-4", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + pbf_move_right_joystick(context, 128, 160, 30, 0); // adjust camera so that head doesn't cover the crystal. + + move_camera_until_yolo_object_detected(env, context, yolo_detector, "crystal-4-5", 255, 30); + + + // align to crystal-4-5. + // center before: y: x: 0.75 + // center after: center-y: 0.288889 center-x: 0.564844 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "crystal-4-5", 0.288889, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-5", 0.75); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "crystal-4-5", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards crystal-4-5 until box: {0.407813, 0.152778, 0.207813, 0.400000} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "crystal-4-5", + 0.207813, 0.400000, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "crystal-4-5", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // confirm we can see station-crystal-4 + move_player_until_yolo_object_detected(env, context, yolo_detector, "station-crystal-4", + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + }, + 5, + 100, + 0, 128 + ); + + // align to station-crystal-4. + // center before: y: x: 0.67 + // center after: center-y: 0.456944 center-x: 0.539844 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "station-crystal-4", 0.45, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-crystal-4", 0.67); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "station-crystal-4", 0.539844, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards station-crystal-4 until box: {0.423438, 0.144444, 0.393750, 0.211111} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "station-crystal-4", + 0.393, 0.2111, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-crystal-4", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // align to station-4. + // center before: y: x: 0.87 + // center after: center-y: 0.231944 center-x: 0.496875 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "station-4", 0.231944, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-4", 0.87); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "station-4", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards station-4 until box: {0.339063, 0.002778, 0.284375, 0.277778} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "station-4", + 0.284375, 0.2, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-4", 0.5); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // align to station-door-4. + // center before: y: x: 0.53 + // center after: center-y: 0.227778 center-x: 0.354688 + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "station-door-4", 0.227778, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-door-4", 0.5); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "station-door-4", 0.354688, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards station-door-4 until box: {0.056250, 0.194444, 0.184375, 0.316667} + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "station-door-4", + 0.1, 0.316667, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-door-4", 0.3); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // align to station-door-4. // center before: + // center after: center-y: 0.318056 center-x: 0.514844 + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "station-door-4", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "station-door-4", 0.318056, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-door-4", 0.5); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + + do_action_until_dialog(env.program_info(), env.console, context, + [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ + move_player_forward(env, context, 20, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "station-door-4", 0.5, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + } + ); + + + clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 120, {CallbackEnum::OVERWORLD, CallbackEnum::BLACK_DIALOG_BOX}); + pbf_move_left_joystick(context, 128, 0, 100, 0); + // disable Lock at Station 4 + walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 20); + mash_button_till_overworld(env.console, context, BUTTON_A); // black dialog, prompt + + #if 0 + // align to rock. + // center before: y: x: // center after: move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock", 0.000, [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // x-position of target object prior to camera move + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.5000); // x-position of target object prior to camera move pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera } ); @@ -293,13 +620,8 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c } ); - #endif - - - }); -} - -void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ + #endif + // }); } void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ From 24c52c395466309aad86664f799ee030aadb918d Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 23:19:26 -0800 Subject: [PATCH 5/7] minor change --- .../PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 09fde0300..e09f94a40 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -1740,7 +1740,7 @@ void move_camera_yolo( push_magnitude_scale_factor = 60 / std::sqrt(std::abs(diff)); break; case CameraAxis::Y: - duration_scale_factor = 100 / std::sqrt(std::abs(diff)); + duration_scale_factor = 50 / std::sqrt(std::abs(diff)); if (std::abs(diff) < 0.1){ duration_scale_factor *= 0.5; } From 63109b6595d7968991f744c9bb26b7c98a161ad1 Mon Sep 17 00:00:00 2001 From: jw098 Date: Mon, 1 Dec 2025 23:43:04 -0800 Subject: [PATCH 6/7] minor changes to station 4 navigation routine --- .../AutoStory/PokemonSV_AutoStory_Segment_38.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp index 4a74135e7..58f7d128b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp @@ -270,8 +270,8 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c } void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ - // checkpoint_reattempt_loop(env, context, notif_status_update, stats, - // [&](size_t attempt_number){ + checkpoint_reattempt_loop(env, context, notif_status_update, stats, + [&](size_t attempt_number){ YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-4b.onnx"); @@ -491,7 +491,7 @@ void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& c 0.393, 0.2111, [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - move_player_to_realign_via_yolo(env, context, yolo_detector, "station-crystal-4", 0.5); // realign to target X + move_player_to_realign_via_yolo(env, context, yolo_detector, "station-crystal-4", 0.58); // realign to target X pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera } ); @@ -542,7 +542,7 @@ void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& c // move towards station-door-4 until box: {0.056250, 0.194444, 0.184375, 0.316667} move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "station-door-4", - 0.1, 0.316667, + 0.1, 0.316, [&](){ run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); move_player_to_realign_via_yolo(env, context, yolo_detector, "station-door-4", 0.3); // realign to target X @@ -621,7 +621,7 @@ void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& c ); #endif - // }); + }); } void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ From a255e39cc035f32fb5383b90bfb053c026195b2b Mon Sep 17 00:00:00 2001 From: jw098 Date: Tue, 2 Dec 2025 21:12:11 -0800 Subject: [PATCH 7/7] clean up --- .../AutoStory/PokemonSV_AutoStory.cpp | 6 +- .../PokemonSV_AutoStory_Segment_38.cpp | 71 +--------------- .../PokemonSV_AutoStory_Segment_38.h | 47 ----------- .../PokemonSV_AutoStory_Segment_39.cpp | 82 ++++++++++++++++++- .../PokemonSV_AutoStory_Segment_39.h | 51 ++++++++++++ 5 files changed, 136 insertions(+), 121 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index dd626539e..1016df710 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -130,7 +130,7 @@ std::vector> make_autoStory_segment_list(){ segment_list.emplace_back(std::make_unique()); segment_list.emplace_back(std::make_unique()); segment_list.emplace_back(std::make_unique()); - // segment_list.emplace_back(std::make_unique()); + segment_list.emplace_back(std::make_unique()); // segment_list.emplace_back(std::make_unique()); // segment_list.emplace_back(std::make_unique()); } @@ -304,8 +304,8 @@ std::vector> make_autoStory_checkpoint_lis checkpoint_list.emplace_back(std::make_unique()); checkpoint_list.emplace_back(std::make_unique()); checkpoint_list.emplace_back(std::make_unique()); - // checkpoint_list.emplace_back(std::make_unique()); - // checkpoint_list.emplace_back(std::make_unique()); + checkpoint_list.emplace_back(std::make_unique()); + checkpoint_list.emplace_back(std::make_unique()); // checkpoint_list.emplace_back(std::make_unique()); // checkpoint_list.emplace_back(std::make_unique()); // checkpoint_list.emplace_back(std::make_unique()); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp index 58f7d128b..b1ef667b9 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.cpp @@ -74,33 +74,6 @@ void AutoStory_Checkpoint_101::run_checkpoint(SingleSwitchProgramEnvironment& en checkpoint_101(env, context, options.notif_status_update, stats); } -std::string AutoStory_Checkpoint_102::name() const{ return "0102 - " + AutoStory_Segment_38().name(); } -std::string AutoStory_Checkpoint_102::start_text() const{ return "";} -std::string AutoStory_Checkpoint_102::end_text() const{ return "";} -void AutoStory_Checkpoint_102::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ - checkpoint_102(env, context, options.notif_status_update, stats); -} - -// std::string AutoStory_Checkpoint_103::name() const{ return "0103 - " + AutoStory_Segment_3().name(); } -// std::string AutoStory_Checkpoint_103::start_text() const{ return "";} -// std::string AutoStory_Checkpoint_103::end_text() const{ return "";} -// void AutoStory_Checkpoint_103::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ -// checkpoint_103(env, context, options.notif_status_update, stats); -// } - -// std::string AutoStory_Checkpoint_104::name() const{ return "0104 - " + AutoStory_Segment_3().name(); } -// std::string AutoStory_Checkpoint_104::start_text() const{ return "";} -// std::string AutoStory_Checkpoint_104::end_text() const{ return "";} -// void AutoStory_Checkpoint_104::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ -// checkpoint_104(env, context, options.notif_status_update, stats); -// } - -// std::string AutoStory_Checkpoint_105::name() const{ return "0105 - " + AutoStory_Segment_3().name(); } -// std::string AutoStory_Checkpoint_105::start_text() const{ return "";} -// std::string AutoStory_Checkpoint_105::end_text() const{ return "";} -// void AutoStory_Checkpoint_105::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ -// checkpoint_105(env, context, options.notif_status_update, stats); -// } void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ checkpoint_reattempt_loop(env, context, notif_status_update, stats, @@ -276,9 +249,6 @@ void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& c YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-4b.onnx"); - #if 0 - #endif - // align to crystal-4-1. // center before: X: 0.84 // center after: center-y: 0.195833 center-x: 0.621875 @@ -592,49 +562,10 @@ void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& c walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 20); mash_button_till_overworld(env.console, context, BUTTON_A); // black dialog, prompt - #if 0 - // align to rock. - // center before: y: x: - // center after: - move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock", 0.000, - [&](){ - run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.5000); // x-position of target object prior to camera move - pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera - } - ); - move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock", 0.000, - [&](){ - run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera - } - ); - - // move towards rock until box: - move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock", - 0.000, 0.000, - [&](){ - run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); - move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // realign to target X - pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera - } - ); - - #endif + }); } -void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ -} - -void checkpoint_103(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ -} - -void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ -} - -void checkpoint_105(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ -} } } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h index 8f45b22c3..a5b26e44e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_38.h @@ -43,37 +43,6 @@ class AutoStory_Checkpoint_101 : public AutoStory_Checkpoint{ virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; }; -class AutoStory_Checkpoint_102 : public AutoStory_Checkpoint{ -public: - virtual std::string name() const override; - virtual std::string start_text() const override; - virtual std::string end_text() const override; - virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; -}; - -// class AutoStory_Checkpoint_103 : public AutoStory_Checkpoint{ -// public: -// virtual std::string name() const override; -// virtual std::string start_text() const override; -// virtual std::string end_text() const override; -// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; -// }; - -// class AutoStory_Checkpoint_104 : public AutoStory_Checkpoint{ -// public: -// virtual std::string name() const override; -// virtual std::string start_text() const override; -// virtual std::string end_text() const override; -// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; -// }; - -// class AutoStory_Checkpoint_105 : public AutoStory_Checkpoint{ -// public: -// virtual std::string name() const override; -// virtual std::string start_text() const override; -// virtual std::string end_text() const override; -// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; -// }; // start: Inside Area Zero Station 3. Deactivated the locks. // end: Entered inner cave. Finished cutscene, admiring the waterfall/large crystals. @@ -83,22 +52,6 @@ void checkpoint_100(SingleSwitchProgramEnvironment& env, ProControllerContext& c // end: Inside Area Zero Station 4. Deactivated the locks. void checkpoint_101(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); -// start: -// end: -void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); - -// start: -// end: -void checkpoint_103(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); - -// start: -// end: -void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); - -// start: -// end: -void checkpoint_105(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); - } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.cpp index bc9e910a7..ea9a5caa1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.cpp @@ -52,13 +52,93 @@ void AutoStory_Segment_39::run_segment( context.wait_for_all_requests(); env.console.log("Start Segment " + name(), COLOR_ORANGE); - // AutoStory_Checkpoint_9().run_checkpoint(env, context, options, stats); + // AutoStory_Checkpoint_10().run_checkpoint(env, context, options, stats); context.wait_for_all_requests(); env.console.log("End Segment " + name(), COLOR_GREEN); } +std::string AutoStory_Checkpoint_102::name() const{ return "0102 - " + AutoStory_Segment_39().name(); } +std::string AutoStory_Checkpoint_102::start_text() const{ return "";} +std::string AutoStory_Checkpoint_102::end_text() const{ return "";} +void AutoStory_Checkpoint_102::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ + checkpoint_102(env, context, options.notif_status_update, stats); +} + +// std::string AutoStory_Checkpoint_103::name() const{ return "0103 - " + AutoStory_Segment_3().name(); } +// std::string AutoStory_Checkpoint_103::start_text() const{ return "";} +// std::string AutoStory_Checkpoint_103::end_text() const{ return "";} +// void AutoStory_Checkpoint_103::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ +// checkpoint_103(env, context, options.notif_status_update, stats); +// } + +// std::string AutoStory_Checkpoint_104::name() const{ return "0104 - " + AutoStory_Segment_3().name(); } +// std::string AutoStory_Checkpoint_104::start_text() const{ return "";} +// std::string AutoStory_Checkpoint_104::end_text() const{ return "";} +// void AutoStory_Checkpoint_104::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ +// checkpoint_104(env, context, options.notif_status_update, stats); +// } + +// std::string AutoStory_Checkpoint_105::name() const{ return "0105 - " + AutoStory_Segment_3().name(); } +// std::string AutoStory_Checkpoint_105::start_text() const{ return "";} +// std::string AutoStory_Checkpoint_105::end_text() const{ return "";} +// void AutoStory_Checkpoint_105::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{ +// checkpoint_105(env, context, options.notif_status_update, stats); +// } + +void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ + // checkpoint_reattempt_loop(env, context, notif_status_update, stats, + // [&](size_t attempt_number){ + + // YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-4b.onnx"); + + #if 0 + // align to rock. + // center before: y: x: + // center after: + move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock", 0.000, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.5000); // x-position of target object prior to camera move + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock", 0.000, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + // move towards rock until box: + move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock", + 0.000, 0.000, + [&](){ + run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD); + move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // realign to target X + pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera + } + ); + + #endif + // }); +} + +void checkpoint_103(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ + // checkpoint_reattempt_loop(env, context, notif_status_update, stats, + // [&](size_t attempt_number){ + + + // }); +} + +void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ +} + +void checkpoint_105(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){ +} + } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.h index 58760b738..929e803e4 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_39.h @@ -26,6 +26,57 @@ class AutoStory_Segment_39 : public AutoStory_Segment{ ) const override; }; +class AutoStory_Checkpoint_102 : public AutoStory_Checkpoint{ +public: + virtual std::string name() const override; + virtual std::string start_text() const override; + virtual std::string end_text() const override; + virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; +}; + +// class AutoStory_Checkpoint_103 : public AutoStory_Checkpoint{ +// public: +// virtual std::string name() const override; +// virtual std::string start_text() const override; +// virtual std::string end_text() const override; +// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; +// }; + +// class AutoStory_Checkpoint_104 : public AutoStory_Checkpoint{ +// public: +// virtual std::string name() const override; +// virtual std::string start_text() const override; +// virtual std::string end_text() const override; +// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; +// }; + +// class AutoStory_Checkpoint_105 : public AutoStory_Checkpoint{ +// public: +// virtual std::string name() const override; +// virtual std::string start_text() const override; +// virtual std::string end_text() const override; +// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override; +// }; + + + +// start: Inside Area Zero Station 4. Deactivated the locks. +// end: +void checkpoint_102(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); + +// start: +// end: +void checkpoint_103(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); + +// start: +// end: +void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); + +// start: +// end: +void checkpoint_105(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats); + +