Skip to content

Commit 5181a10

Browse files
author
Gin
committed
Add place holder code for new program GeneratePokemonImageTrainingData
1 parent d127a85 commit 5181a10

File tree

4 files changed

+140
-6
lines changed

4 files changed

+140
-6
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ file(GLOB MAIN_SOURCES
7777
../Common/CRC32.h
7878
../Common/Compiler.h
7979
../Common/ControllerStates/HID_Keyboard_State.h
80-
../Common/ControllerStates/NintendoSwitch_WirelessController_State.h
8180
../Common/ControllerStates/NintendoSwitch2_WiredController_State.h
81+
../Common/ControllerStates/NintendoSwitch_WirelessController_State.h
8282
../Common/Cpp/AbstractLogger.h
8383
../Common/Cpp/BitmapConversion.cpp
8484
../Common/Cpp/BitmapConversion.h
@@ -728,25 +728,25 @@ file(GLOB MAIN_SOURCES
728728
Source/Controllers/SerialPABotBase/SerialPABotBase_StatusThread.h
729729
Source/Controllers/StandardHid/StandardHid_Keyboard.cpp
730730
Source/Controllers/StandardHid/StandardHid_Keyboard.h
731+
Source/Controllers/StandardHid/StandardHid_KeyboardWithScheduler.cpp
732+
Source/Controllers/StandardHid/StandardHid_KeyboardWithScheduler.h
731733
Source/Controllers/StandardHid/StandardHid_Keyboard_ControllerButtons.h
732734
Source/Controllers/StandardHid/StandardHid_Keyboard_SerialPABotBase.cpp
733735
Source/Controllers/StandardHid/StandardHid_Keyboard_SerialPABotBase.h
734-
Source/Controllers/StandardHid/StandardHid_KeyboardWithScheduler.cpp
735-
Source/Controllers/StandardHid/StandardHid_KeyboardWithScheduler.h
736736
Source/Integrations/DiscordIntegrationSettings.cpp
737737
Source/Integrations/DiscordIntegrationSettings.h
738738
Source/Integrations/DiscordIntegrationTable.cpp
739739
Source/Integrations/DiscordIntegrationTable.h
740740
Source/Integrations/DiscordSettingsOption.cpp
741741
Source/Integrations/DiscordSettingsOption.h
742+
Source/Integrations/DiscordSocial/DiscordSocial.cpp
743+
Source/Integrations/DiscordSocial/DiscordSocial.h
742744
Source/Integrations/DiscordWebhook.cpp
743745
Source/Integrations/DiscordWebhook.h
744746
Source/Integrations/DiscordWebhookSettings.cpp
745747
Source/Integrations/DiscordWebhookSettings.h
746748
Source/Integrations/DppIntegration/DppClient.cpp
747749
Source/Integrations/DppIntegration/DppClient.h
748-
Source/Integrations/DiscordSocial/DiscordSocial.cpp
749-
Source/Integrations/DiscordSocial/DiscordSocial.h
750750
Source/Integrations/DppIntegration/DppCommandHandler.cpp
751751
Source/Integrations/DppIntegration/DppCommandHandler.h
752752
Source/Integrations/DppIntegration/DppUtility.cpp
@@ -1492,6 +1492,8 @@ file(GLOB MAIN_SOURCES
14921492
Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.h
14931493
Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.cpp
14941494
Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.h
1495+
Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp
1496+
Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.h
14951497
Source/PokemonLA/Programs/PokemonLA_BattleRoutines.cpp
14961498
Source/PokemonLA/Programs/PokemonLA_BattleRoutines.h
14971499
Source/PokemonLA/Programs/PokemonLA_EscapeFromAttack.cpp
@@ -1723,7 +1725,7 @@ file(GLOB MAIN_SOURCES
17231725
Source/PokemonSV/Inference/PokemonSV_WhiteButtonDetector.cpp
17241726
Source/PokemonSV/Inference/PokemonSV_WhiteButtonDetector.h
17251727
Source/PokemonSV/Inference/PokemonSV_WhiteTriangleDetector.cpp
1726-
Source/PokemonSV/Inference/PokemonSV_WhiteTriangleDetector.h
1728+
Source/PokemonSV/Inference/PokemonSV_WhiteTriangleDetector.h
17271729
Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.cpp
17281730
Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.h
17291731
Source/PokemonSV/Inference/Tera/PokemonSV_TeraCardDetector.cpp

SerialPrograms/Source/PokemonLA/PokemonLA_Panels.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "Programs/TestPrograms/PokemonLA_FlagNavigationTest.h"
4646
#include "Programs/TestPrograms/PokemonLA_SoundListener.h"
4747

48+
#include "Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.h"
49+
4850
namespace PokemonAutomation{
4951
namespace NintendoSwitch{
5052
namespace PokemonLA{
@@ -99,6 +101,9 @@ std::vector<PanelEntry> PanelListFactory::make_panels() const{
99101
ret.emplace_back(make_single_switch_program<AutoMultiSpawn_Descriptor, AutoMultiSpawn>());
100102
}
101103
if (PreloadSettings::instance().DEVELOPER_MODE){
104+
ret.emplace_back("---- Machine Learning ----");
105+
ret.emplace_back(make_single_switch_program<GeneratePokemonImageTrainingData_Descriptor, GeneratePokemonImageTrainingData>());
106+
102107
ret.emplace_back("---- Developer Tools ----");
103108
ret.emplace_back(make_single_switch_program<MountDetectionTest_Descriptor, MountDetectionTest>());
104109
ret.emplace_back(make_single_switch_program<OverworldWatcher_Descriptor, OverworldWatcher>());
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/* Generate Pokemon Image Training Data
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#include "Common/Cpp/Exceptions.h"
8+
#include "CommonFramework/Exceptions/ProgramFinishedException.h"
9+
#include "CommonFramework/ImageTools/ImageStats.h"
10+
#include "CommonFramework/Notifications/ProgramNotifications.h"
11+
#include "CommonFramework/VideoPipeline/VideoFeed.h"
12+
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
13+
#include "Pokemon/Pokemon_Strings.h"
14+
#include "PokemonLA/Programs/PokemonLA_GameEntry.h"
15+
#include "PokemonLA_GeneratePokemonImageTrainingData.h"
16+
17+
namespace PokemonAutomation{
18+
namespace NintendoSwitch{
19+
namespace PokemonLA{
20+
21+
using namespace Pokemon;
22+
23+
24+
GeneratePokemonImageTrainingData_Descriptor::GeneratePokemonImageTrainingData_Descriptor()
25+
: SingleSwitchProgramDescriptor(
26+
"PokemonLA:GeneratePokemonImageTrainingData",
27+
STRING_POKEMON + " LA", "Generate " + STRING_POKEMON + " Image Training Data",
28+
"ComputerControl/blob/master/Wiki/Programs/PokemonLA/GeneratePokemonImageTrainingData.md",
29+
"Generate training images of " + STRING_POKEMON + " for machine learning purposes.",
30+
ProgramControllerClass::StandardController_NoRestrictions,
31+
FeedbackType::REQUIRED,
32+
AllowCommandsWhenRunning::DISABLE_COMMANDS
33+
)
34+
{}
35+
36+
37+
GeneratePokemonImageTrainingData::GeneratePokemonImageTrainingData()
38+
: NUM_BOXES(
39+
"<b>Number of Boxes to Process:</b><br>How many boxes to capture " + STRING_POKEMON + " from.",
40+
LockMode::LOCK_WHILE_RUNNING,
41+
5, 1, 30
42+
)
43+
, NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(3600))
44+
, NOTIFICATIONS({
45+
&NOTIFICATION_STATUS_UPDATE,
46+
&NOTIFICATION_PROGRAM_FINISH,
47+
&NOTIFICATION_ERROR_FATAL,
48+
})
49+
{
50+
PA_ADD_OPTION(NUM_BOXES);
51+
PA_ADD_OPTION(NOTIFICATIONS);
52+
}
53+
54+
void GeneratePokemonImageTrainingData::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
55+
// Send program starting notification
56+
send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE);
57+
58+
try{
59+
// Send completion notification
60+
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
61+
}catch(ProgramFinishedException&){
62+
// Program was stopped by user
63+
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
64+
throw;
65+
}catch(std::exception& e){
66+
// Handle any other errors
67+
send_program_fatal_error_notification(env, NOTIFICATION_ERROR_FATAL, "Fatal error occurred: " + std::string(e.what()));
68+
throw;
69+
}
70+
}
71+
72+
73+
74+
75+
}
76+
}
77+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* Generate Pokemon Image Training Data
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
* Starting at Jubilife Village or any camp, talk to npc to get pokemon from box to party,
6+
* throw the pokemon out onto the field to take screenshots with it, move around it to take
7+
* screenshots from various angles. Repeat for rest of the pokemon in specified boxes.
8+
*/
9+
10+
#ifndef PokemonAutomation_PokemonLA_GeneratePokemonImageTrainingData_H
11+
#define PokemonAutomation_PokemonLA_GeneratePokemonImageTrainingData_H
12+
13+
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
14+
#include "Common/Cpp/Options/SimpleIntegerOption.h"
15+
#include "Common/Cpp/Options/TimeExpressionOption.h"
16+
#include "CommonFramework/Notifications/EventNotificationsTable.h"
17+
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
18+
19+
namespace PokemonAutomation{
20+
namespace NintendoSwitch{
21+
namespace PokemonLA{
22+
23+
24+
class GeneratePokemonImageTrainingData_Descriptor : public SingleSwitchProgramDescriptor{
25+
public:
26+
GeneratePokemonImageTrainingData_Descriptor();
27+
};
28+
29+
30+
class GeneratePokemonImageTrainingData : public SingleSwitchProgramInstance{
31+
public:
32+
GeneratePokemonImageTrainingData();
33+
34+
virtual void program(SingleSwitchProgramEnvironment& env, ProControllerContext& context) override;
35+
36+
private:
37+
38+
SimpleIntegerOption<uint16_t> NUM_BOXES;
39+
40+
EventNotificationOption NOTIFICATION_STATUS_UPDATE;
41+
EventNotificationsOption NOTIFICATIONS;
42+
};
43+
44+
45+
46+
47+
}
48+
}
49+
}
50+
#endif

0 commit comments

Comments
 (0)