Skip to content

Commit 2ec994d

Browse files
authored
Autostory: Area Zero Station 4 (#876)
* checkpoint 100: navigation routine to cutscene inside cave, on way to station 4. * rename onnx model * move_player_until_yolo_object_detected: add X movement parameter * checkpoint_101: nav routine to station 4. * minor change * minor changes to station 4 navigation routine * clean up
1 parent 4016909 commit 2ec994d

10 files changed

+621
-124
lines changed

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ std::vector<std::unique_ptr<AutoStory_Segment>> make_autoStory_segment_list(){
130130
segment_list.emplace_back(std::make_unique<AutoStory_Segment_35>());
131131
segment_list.emplace_back(std::make_unique<AutoStory_Segment_36>());
132132
segment_list.emplace_back(std::make_unique<AutoStory_Segment_37>());
133-
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_38>());
133+
segment_list.emplace_back(std::make_unique<AutoStory_Segment_38>());
134134
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_39>());
135135
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_40>());
136136
}
@@ -304,8 +304,8 @@ std::vector<std::unique_ptr<AutoStory_Checkpoint>> make_autoStory_checkpoint_lis
304304
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_97>());
305305
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_98>());
306306
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_99>());
307-
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_100>());
308-
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_101>());
307+
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_100>());
308+
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_101>());
309309
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_102>());
310310
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_103>());
311311
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_104>());
@@ -703,7 +703,7 @@ AutoStory::AutoStory()
703703
false,
704704
"<b>YOLO Path:</b>",
705705
LockMode::LOCK_WHILE_RUNNING,
706-
"PokemonSV/YOLO/yolo_area0_station1.onnx",
706+
"PokemonSV/YOLO/A0-station-2.onnx",
707707
"<.onnx file>"
708708
)
709709
, TARGET_LABEL(
@@ -1032,8 +1032,8 @@ void AutoStory::test_checkpoints(
10321032
checkpoint_list.push_back([&](){checkpoint_97(env, context, notif_status_update, stats);});
10331033
checkpoint_list.push_back([&](){checkpoint_98(env, context, notif_status_update, stats);});
10341034
checkpoint_list.push_back([&](){checkpoint_99(env, context, notif_status_update, stats);});
1035-
// checkpoint_list.push_back([&](){checkpoint_100(env, context, notif_status_update, stats);});
1036-
// checkpoint_list.push_back([&](){checkpoint_101(env, context, notif_status_update, stats);});
1035+
checkpoint_list.push_back([&](){checkpoint_100(env, context, notif_status_update, stats);});
1036+
checkpoint_list.push_back([&](){checkpoint_101(env, context, notif_status_update, stats);});
10371037
// checkpoint_list.push_back([&](){checkpoint_102(env, context, notif_status_update, stats);});
10381038
// checkpoint_list.push_back([&](){checkpoint_103(env, context, notif_status_update, stats);});
10391039
// checkpoint_list.push_back([&](){checkpoint_104(env, context, notif_status_update, stats);});
@@ -1282,7 +1282,7 @@ void AutoStory::test_code(SingleSwitchProgramEnvironment& env, ProControllerCont
12821282
DirectionDetector direction;
12831283

12841284

1285-
YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/yolo_area0_station1.onnx");
1285+
YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-2.onnx");
12861286
// move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "tree-tera", 0.294444);
12871287
// move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "tree-tera", 0.604688);
12881288

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ void do_action_and_monitor_for_battles_early(
752752
if (ret == 0){ // if see no minimap. stop and see if we detect a battle. if so, throw Battl exception
753753
do_action_and_monitor_for_battles(info, stream, context,
754754
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
755-
pbf_wait(context, Seconds(15));
755+
pbf_wait(context, Seconds(30));
756756
});
757757

758758
// if no battle seen, then throw Exception.
@@ -1557,14 +1557,15 @@ void move_forward_until_yolo_object_above_min_size(
15571557

15581558

15591559

1560-
void move_forward_until_yolo_object_detected(
1560+
void move_player_until_yolo_object_detected(
15611561
SingleSwitchProgramEnvironment& env,
15621562
ProControllerContext& context,
15631563
YOLOv5Detector& yolo_detector,
15641564
const std::string& target_label,
15651565
std::function<void()>&& recovery_action,
15661566
uint16_t max_rounds,
15671567
uint16_t forward_ticks,
1568+
uint8_t x,
15681569
uint8_t y,
15691570
uint16_t delay_after_forward_move,
15701571
uint16_t delay_after_lets_go
@@ -1588,7 +1589,7 @@ void move_forward_until_yolo_object_detected(
15881589

15891590

15901591

1591-
pbf_move_left_joystick(context, 128, y, forward_ticks, 0);
1592+
pbf_move_left_joystick(context, x, y, forward_ticks, 0);
15921593
// pbf_press_button(context, BUTTON_R, 20, delay_after_lets_go);
15931594
// pbf_move_left_joystick(context, 128, y, forward_ticks, delay_after_forward_move);
15941595
});
@@ -1605,7 +1606,7 @@ void move_forward_until_yolo_object_detected(
16051606
if (round_num > max_rounds){
16061607
OperationFailedException::fire(
16071608
ErrorReport::SEND_ERROR_REPORT,
1608-
"move_forward_until_yolo_object_detected(): Unable to detect target object.",
1609+
"move_player_until_yolo_object_detected(): Unable to detect target object.",
16091610
env.console
16101611
);
16111612
}
@@ -1739,7 +1740,7 @@ void move_camera_yolo(
17391740
push_magnitude_scale_factor = 60 / std::sqrt(std::abs(diff));
17401741
break;
17411742
case CameraAxis::Y:
1742-
duration_scale_factor = 100 / std::sqrt(std::abs(diff));
1743+
duration_scale_factor = 50 / std::sqrt(std::abs(diff));
17431744
if (std::abs(diff) < 0.1){
17441745
duration_scale_factor *= 0.5;
17451746
}

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,15 @@ void move_forward_until_yolo_object_above_min_size(
422422
// walk until we find the target object.
423423
// if caught in battle, run recovery_action
424424
// throw exception if exceed max_rounds.
425-
void move_forward_until_yolo_object_detected(
425+
void move_player_until_yolo_object_detected(
426426
SingleSwitchProgramEnvironment& env,
427427
ProControllerContext& context,
428428
YOLOv5Detector& yolo_detector,
429429
const std::string& target_label,
430430
std::function<void()>&& recovery_action,
431431
uint16_t max_rounds,
432432
uint16_t forward_ticks = 100,
433+
uint8_t x = 128,
433434
uint8_t y = 0,
434435
uint16_t delay_after_forward_move = 50,
435436
uint16_t delay_after_lets_go = 105

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_35.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void checkpoint_94(SingleSwitchProgramEnvironment& env, ProControllerContext& co
217217
[&](size_t attempt_number){
218218

219219

220-
YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/yolo_area0_station1.onnx");
220+
YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-1.onnx");
221221

222222

223223
move_player_forward(env, context, 6,
@@ -227,7 +227,7 @@ void checkpoint_94(SingleSwitchProgramEnvironment& env, ProControllerContext& co
227227
);
228228

229229
// confirm we can see tree-tera
230-
move_forward_until_yolo_object_detected(env, context, yolo_detector, "tree-tera",
230+
move_player_until_yolo_object_detected(env, context, yolo_detector, "tree-tera",
231231
[&](){
232232
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
233233
},

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void checkpoint_96(SingleSwitchProgramEnvironment& env, ProControllerContext& co
220220
pbf_press_button(context, BUTTON_L, 240ms, 100ms);
221221

222222
// confirm we can see station-2
223-
move_forward_until_yolo_object_detected(env, context, yolo_detector, "station-2",
223+
move_player_until_yolo_object_detected(env, context, yolo_detector, "station-2",
224224
[&](){
225225
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
226226
},

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& co
156156

157157

158158
// move forward until we see rock-3-1
159-
move_forward_until_yolo_object_detected(env, context, yolo_detector, "rock-3-1",
159+
move_player_until_yolo_object_detected(env, context, yolo_detector, "rock-3-1",
160160
[&](){
161161
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
162162
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
@@ -222,7 +222,7 @@ void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& co
222222
0.118, 0.2,
223223
[&](){
224224
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
225-
move_player_to_realign_via_yolo(env, context, yolo_detector, "tree-3-1", 0.000); // realign to target X
225+
move_player_to_realign_via_yolo(env, context, yolo_detector, "tree-3-1", 0.5); // realign to target X
226226
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
227227
}
228228
);

0 commit comments

Comments
 (0)