Skip to content

Commit 05f2bc0

Browse files
author
Gin
committed
modify all md files to point to new wiki
1 parent f1becbc commit 05f2bc0

File tree

205 files changed

+817
-17393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+817
-17393
lines changed
Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,4 @@
1-
# Build ONNX Runtime From Source
2-
3-
We use ONNX Runtime to run ML model inference efficiently. To download the source code:
4-
5-
```
6-
git clone --recursive https://github.com/Microsoft/onnxruntime.git
7-
cd onnxruntime
8-
```
9-
10-
Make sure the downloaded onnxruntime/ is in the same folder as our project's codebase Arduino-Source/ (or Arduino-Source-Internal/ for internal repo).
11-
12-
## macOS
13-
14-
Build command:
15-
16-
```
17-
./build.sh --config Release --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64 --cmake_extra_defines FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER --use_coreml
18-
```
19-
20-
If you want some debug info, change "Release" to "RelWithDebInfo".
21-
22-
### Explain the build command
23-
24-
By default, the build script uses the third-party libraries installed in the OS system as dependency. but this may create conflict: the ONNX library installed by Homebrew may be too old for the latest ONNX Runtime. To avoid this, you need to add
25-
`--cmake_extra_defines FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER` as above to let the build script download the correct third-party libraries from server.
26-
Alternatively, you can use `--use_vcpkg` to achieve the same result.
27-
28-
`--use_coreml` is needed to build ONNX Runtime with CoreML, Apple's ML acceleration library.
29-
30-
31-
If you encounter such error as below:
32-
```
33-
CMake Error at .../onnxruntime/build/MacOS/Release/_deps/fp16-src/CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
34-
Compatibility with CMake < 3.5 has been removed from CMake.
35-
36-
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
37-
to tell CMake that the project requires at least <min> but has been updated
38-
to work with policies introduced by <max> or earlier.
39-
40-
Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
41-
```
42-
this means your CMake is too old or too new to work with the downloaded third-party libraries. If too old, upgrade your CMake. If too new, you can just open the CMakeLists.txt file that has the error and comment out or delete the line that throws the error:
43-
```
44-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
45-
```
1+
# Build ONNX Runtime From Source
2+
3+
This page has moved here: https://pokemonautomation.github.io/Developer/BuildONNXRuntimeFromSource.html
4+

Wiki/Developer/Button.md

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,4 @@
1-
# Send Button Commands
2-
3-
[<img src="https://canary.discordapp.com/api/guilds/695809740428673034/widget.png?style=banner2">](https://discord.gg/cQ4gWxN)
4-
5-
We mostly use a group of functions with prefix `pbf_` to send buttong commands to a micro-controller (like Arduino or Teensy).
6-
The controller then sends the button commands to a connected Nintendo Switch to control a game.
7-
Those functions are defined in [NintendoSwitch_Commands_PushButtons.h](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h).
8-
Example button commands are `pbf_press_button()` and `pbf_press_dpad()`.
9-
You can read the comments of those functions to understand how to use them.
10-
11-
Note we use ticks to measure the amount of time a button action is executed. Inside the micro-controller 125 ticks is one second. Access this number via [`TICKS_PER_SECOND`](https://github.com/PokemonAutomation/Arduino-Source/blob/main/Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h).
12-
13-
An example automation program that uses those functions is [**PokemonLA_BraviaryHeightGlitch**](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_BraviaryHeightGlitch.cpp).
14-
15-
## Button Command Buffer on Micro-Controller
16-
17-
When a `pbf` function is called, the program may not wait for the micro-controller to finish executing the button command.
18-
It may just send the command to the micro-controller and continue executing following lines of code.
19-
Our software that runs on the micro-controller uses a buffer to hold incoming button commands.
20-
The `pbf` function has to wait only when the buffer on the micro-controller is full. It will wait until the micro-controller finishes executing the oldest command in the buffer so that the buffer has space to receive the new command.*
21-
22-
For example, if the micro-controller buffer is empty and a program sends a command of holding button A for 200 ticks and releasing it for 100 ticks,
23-
the program will not wait for 300 ticks during exeuction of `pbf_press_button()`.
24-
The function quickly returns and the program begins executing the next line of code.
25-
At the same time, the micro-controller will start spending 300 ticks to execute the button command.
26-
It will keep pressing button A to the Switch for 200 ticks, then release it and wait for 100 ticks.
27-
28-
This is like the case of asynchronous IO processing in some software systems.
29-
30-
**Important:** You should not *rely* this asynchronous behavior to perform parallelization. The internal buffer sizes are undocumented and may change at any time. And some functions may break into a sequence of instructions that occupy multiple buffer slots. The purpose of the asynchronous buffering is to preserve the exact timing of button sequences across an otherwise high-latency serial bus.
31-
32-
## Wait for Commands to Finish
33-
34-
So in the case like you would want the program to wait for the button commands to finish before doing some other tasks (e.g. reading the video stream),
35-
you need to call `context.wait_for_all_requests()` after the code of button commands.
36-
This function stops the program from doing anything until all the commands sent to the micro-controller have finished.
37-
An example usage is in [**PokemonLA_PokedexTasksReader**](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_PokedexTasksReader.cpp).
38-
The program reads Pokédex tasks. After it sends button commands that tells the game to go to the next Pokédex page,
39-
it calls `context.wait_for_all_requests()` before reading the video stream. In this way, when the program reads the video stream, the game is indeed showing the next page.
1+
# Send Button Commands
2+
3+
This page has moved here: https://pokemonautomation.github.io/Developer/Button.html
4+

Wiki/Developer/Color.md

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
# Check Color
2-
3-
[<img src="https://canary.discordapp.com/api/guilds/695809740428673034/widget.png?style=banner2">](https://discord.gg/cQ4gWxN)
4-
5-
A simple visual detection method is to check the color of a region of the image. See [this topic](SubImage.md) on how to get a region of the image.
6-
7-
We use [`image_stats()`](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/CommonFramework/ImageTools/ImageStats.h) to extract color stats from an image.
8-
An example usage is in [PokemonBDSP_MenuDetector.cpp](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonBDSP/Inference/PokemonBDSP_MenuDetector.cpp).
9-
`image_stats()` returns a struct `ImageStats` that stores average per-pixel color, pixel color stddev and pixel count on this image. Then it calls `is_white()` declared in [SolidColorTest.h](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/CommonFramework/ImageTools/SolidColorTest.h) to check whether the stats reflect the image is all white.
10-
11-
We also commonly use `is_solid()` in SolidColorTest.h to check whether the image is full of a particular color.
12-
For example you can check [PokemonLA_DialogDetector.cpp](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLA/Inference/PokemonLA_DialogDetector.cpp).
13-
14-
## Determine Color Thresholds
15-
16-
When doing color check, you need to set thresholds in `is_solid()` and other functions,
17-
like what is the maximum color deviation that can still pass the check.
18-
You can first collect a few test images by taking screenshots using the screenshot button on the **SerialPrograms** executable.
19-
Pick some thresholds to pass all your test images.
20-
You can add command line tests (See [its topic](Tests.md)) to run color detection on images directly without temporarily hardcoding tests.
21-
22-
Finally, keep the thresholds a little higher than needed on your test images so that users with different capture card color distortions than yours can still pass the check.
23-
24-
25-
## Color Values
26-
27-
We have a `Color` class in [Color.h](https://github.com/PokemonAutomation/Arduino-Source/blob/main/Common/Cpp/Color.h) to represent a 32-bit-precision ARGB pixel color. Each color channel precision is 8-bit `uint8`. The data in `Color` is stored as a `uint32_t`. Some of our color-related functions also take `uint32_t` as color inputs. See `combine_argb()` and `combine_rgb()` in Color.h to know how individual A, R, G, B values form a `uint32_t`.
28-
1+
# Check Color
2+
3+
This page has moved here: https://pokemonautomation.github.io/Developer/Color.html
4+

Wiki/Developer/Exception.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# Exception
2-
3-
[<img src="https://canary.discordapp.com/api/guilds/695809740428673034/widget.png?style=banner2">](https://discord.gg/cQ4gWxN)
4-
5-
We have a custom exception [`OperationFailedException`](https://github.com/PokemonAutomation/Arduino-Source/blob/main/Common/Cpp/Exceptions.h) to abort a program.
6-
This is very handy when we detect an error and wish to stop the program right now and display an error message to user.
7-
Many programs use this mechanism.
8-
One example is [**PokemonLA_DistortionWaiter**](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp).
1+
# Exception
2+
3+
This page has moved here: https://pokemonautomation.github.io/Developer/Exception.html
4+

Wiki/Developer/Git.md

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,4 @@
1-
# Develop Using Github
2-
3-
[<img src="https://canary.discordapp.com/api/guilds/695809740428673034/widget.png?style=banner2">](https://discord.gg/cQ4gWxN)
4-
5-
We use Github to host our codebase and allow open-source development. This guide is for developers who know a little bit of Git but don't know how to use it and Github to contribute to an open-source Github project, or for developers who want to refresh the knowledge of Github development. It also contains some tips about building and developing the code.
6-
7-
For a more detailed guide to using git itself, you can refer to the [git book](https://git-scm.com/book/en). If you prefer videos instead, here are some good introductory videos: [Introduction](https://www.youtube.com/watch?v=uR6G2v_WsRA), [Branching and Merging](https://www.youtube.com/watch?v=FyAAIHHClqI), [Remotes](https://www.youtube.com/watch?v=Gg4bLk8cGNo).
8-
9-
To add a new feature to the code, we use the standard Github development cycle:
10-
11-
- Fork the [Arduino-Source](https://github.com/PokemonAutomation/Arduino-Source/tree/main/SerialPrograms/Source) repository (repo for short) so that you have a complete copy of the codebase repo under your own Github account.
12-
- Clone your copied repo to your local machine. Make sure your downloaded local repo is linked to your online Github repo.
13-
- Build the **SerialPrograms** executable. See the [Build guide](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/README.md) for more details on how to build our programs.
14-
- Some of the automation programs listed in the **SerialPrograms** require additional resources in the form of files in a folder named `Resources`.
15-
- You can download the folder from our latest [program releases](https://github.com/PokemonAutomation/ComputerControl/releases) or from the Github repo [Packages](https://github.com/PokemonAutomation/Packages).
16-
- Place the `Resources` folder at the same folder hierarchy as the folder of the built **SerialPrograms** executable, so that when launching the executable it can correctly find the resource folder.
17-
For example, if the path of **SerialPrograms** is `C:\git\Arduino-Source\build\SerialPrograms.exe` then the resource folder should be `C:\git\Arduino-Source\Resources`.
18-
- Make a new Git branch on your local machine. You can name the branch by the name of the new feature you would like to implement. **Do not add any new code directly to the main branch**. All new code should be added to your feature branch.
19-
- Before adding commits to the branch, set correct author name and email info in the Git config file. If you want to maintain anonymous, make sure you don't expose your personal info in your Github account and commit messages. Double check you don't set a global author and email info across that could add your personal info on a new Git repo.
20-
- Write the feature code. Add commits of the new code change to the feature branch.
21-
- If you add or remove code files in the source-code folder, you need to update the file list in [CMakeLists.txt](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/CMakeLists.txt) and [SerialPrograms.pro](https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/SerialPrograms.pro). See [Add New Files](./NewFiles.md) for more details.
22-
23-
- Test the code of this branch to make sure it works and it won't cause problems when merged to the Git trunk (aka main branch) of the codebase.
24-
- Clean the code:
25-
- Remove commented code that no longer used.
26-
- Remove unecessary debugging code.
27-
- Organize and simplify code, like converting duplicate code blocks into reusable functions.
28-
- Add enough comments so that it is easy for you and others to maintain the code in future, and our repo maintainers can understand your code.
29-
- Push (aka upload) this branch from your local machine to your online Github repo.
30-
- On Github, send a pull request (PR for short) to notify our repo maintainers that a feature development is ready for review.
31-
- The repo maintainers review the new code in the PR, comment on it and give some suggestions if needed.
32-
- Discuss and take those suggestions if needed by improving the code on your local machine. Then push them to update the PR. This may take several rounds of back and forth.
33-
- The repo maintainers approve the PR about the feature branch, adding the code into the original repo.
34-
- Prepare for developing next feature:
35-
- After the new code has been added to the original repo as new commits, update the main branch of your online Github repo so that you receive the new commits as well.
36-
- One way to do this is to create a remote branch `upstream` that points to the official repo. Whenever you want to update your main branch, you can call `git fetch upstream`, then `git merge upstream/main`.
37-
- Alternatively, pull (aka download) those commits into the main branch of your local repo.
38-
- You can then delete the feature branch.
39-
40-
There are many online resources on how to use Git and Github. Feel free to study them if you are not familiar with them.
41-
42-
# Q&A
43-
44-
## Why create a new branch on local machine?
45-
46-
To have the repo maintainers reviewing your changes, you need to have your new code in a PR. A PR is like a post you sent to the maintainers, which lists all your code changes and optionally your comments about them. Both you and the maintainers can comment under the PR, like you commenting under an internet post. To create a PR, you need to associate a branch to it. Therefore you need to create a new branch on your local machine, push (aka upload) it and link it to a PR. You automatically link a PR to the branch when you click a "Create a PR" button on your Github repo for a particular branch you pushed to Github.
47-
48-
Why not use the default branch that is created when initializing my local repo on my local machine? Because the default branch is often the main branch, which serves as the "base": where the code is without your new change. You don't want to add change to this main branch, destroying the content of what the code is before your change.
49-
This is also a good habit of making a separate branch for your changes. If you would like to work on two features at the same time, with two branches you can separate the changes cleanly, reducing your mental load. And you never know when something may happen during developing that forces you to write a new feature. Having all your changes in separate branches keep you clean so that you can easily add a new feature on a new branch that is forked from the main branch, without worrying about prior local changes.
1+
# Develop Using Github
2+
3+
This page has moved here: https://pokemonautomation.github.io/Developer/Git.html
4+

0 commit comments

Comments
 (0)