Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ std::vector<std::unique_ptr<AutoStory_Segment>> make_autoStory_segment_list(){
segment_list.emplace_back(std::make_unique<AutoStory_Segment_35>());
segment_list.emplace_back(std::make_unique<AutoStory_Segment_36>());
segment_list.emplace_back(std::make_unique<AutoStory_Segment_37>());
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_38>());
segment_list.emplace_back(std::make_unique<AutoStory_Segment_38>());
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_39>());
// segment_list.emplace_back(std::make_unique<AutoStory_Segment_40>());
}
Expand Down Expand Up @@ -304,8 +304,8 @@ std::vector<std::unique_ptr<AutoStory_Checkpoint>> make_autoStory_checkpoint_lis
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_97>());
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_98>());
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_99>());
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_100>());
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_101>());
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_100>());
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_101>());
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_102>());
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_103>());
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_104>());
Expand Down Expand Up @@ -703,7 +703,7 @@ AutoStory::AutoStory()
false,
"<b>YOLO Path:</b>",
LockMode::LOCK_WHILE_RUNNING,
"PokemonSV/YOLO/yolo_area0_station1.onnx",
"PokemonSV/YOLO/A0-station-2.onnx",
"<.onnx file>"
)
, TARGET_LABEL(
Expand Down Expand Up @@ -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);});
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1557,14 +1557,15 @@ 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,
const std::string& target_label,
std::function<void()>&& 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
Expand All @@ -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);
});
Expand All @@ -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
);
}
Expand Down Expand Up @@ -1739,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,15 @@ 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,
const std::string& target_label,
std::function<void()>&& 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
);
Expand Down
Loading