1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# TOU(ring)ROB(ot)
This is a program designed for use on a robot for the "Robot Tour" Event for the 2025 Science Olympiad Season. It uses the [CircuitPython library (TBD)](https://circuitpython.org/) and uses the [Adafruit Metro M4 Express](https://www.adafruit.com/product/3382) board as the microcontroller.
- 01/05/2025: Able to pathfind to coordinates
# How-To Use
Positions on the course are determined by their X value and Y value. Y values are in reverse (going down on the coordinate plane means the Y value increases). Map dimensions must be rectangular and are defined in `MAPWIDTH` and `MAPHEIGHT`
Start and end points can be determined by changing the values in `STARTPOINT` and `ENDPOINT` in `pathfind.py`. The order of points that the robot travels to is determined by `checkpointList[]`.
```python
checkpointList = [
STARTPOINT, # First Destination
[0, 0], # Next destination after STARTPOINT
[1, 4], # Etc..
[3, 2], # Etc..
[3, 4], # Etc..
ENDPOINT # Travels from [3, 4] to ENDPOINT
]
```
In the robot's path-finding algorithm, it accounts for walls in the course. All wall positions are defined in `wallList[]`. Their position is defined by two values, which are the coordinates of the imaginary boxes/points on both sides of the wall.
```python
wallList = [
[[2, 0], [3, 0]], # This wall is on the border between box [2, 0] and [3, 0]
[[1, 0], [1, 1]],
[[3, 0], [3, 1]],
[[0, 1], [0, 2]],
[[0, 2], [1, 2]],
[[2, 2], [3, 2]],
[[1, 3], [1, 4]],
[[3, 3], [3, 4]],
[[1, 4], [2, 4]]
]
```
The program is instructed to solve the course using the `solveCourse` function.
The actual pathfinding and motor commands are split up between the `pathfind.py` and `code.py` files. `pathfind.py` simply finds an optimal route and `code.py` is the file that must be put on the robot. in `code.py`, you must copy the output produced by `pathfind.py` into the source code file. Eventually, this may be automated where instructions are output to a text file where `code.py` can read it.
|