Het Satasiya | 9633d4b | 2020-08-16 15:31:17 -0700 | [diff] [blame] | 1 | from gi.repository import Gtk |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 2 | from collections import namedtuple |
John Park | 91e6973 | 2019-03-03 13:12:43 -0800 | [diff] [blame] | 3 | |
Het Satasiya | 9633d4b | 2020-08-16 15:31:17 -0700 | [diff] [blame] | 4 | window = Gtk.Window() |
| 5 | screen = window.get_screen() |
| 6 | |
| 7 | #Set screen size for rest of program. |
Austin Schuh | b2d77af | 2021-03-31 20:07:21 -0700 | [diff] [blame] | 8 | SCREEN_SIZE = screen.get_height() / 1.5 |
John Park | 91e6973 | 2019-03-03 13:12:43 -0800 | [diff] [blame] | 9 | |
Het Satasiya | 9633d4b | 2020-08-16 15:31:17 -0700 | [diff] [blame] | 10 | # Placeholder value |
| 11 | ROBOT_SIDE_TO_BALL_CENTER = 0.15 |
John Park | 91e6973 | 2019-03-03 13:12:43 -0800 | [diff] [blame] | 12 | BALL_RADIUS = 0.165 |
Het Satasiya | 9633d4b | 2020-08-16 15:31:17 -0700 | [diff] [blame] | 13 | |
| 14 | # Placeholder value |
| 15 | ROBOT_SIDE_TO_HATCH_PANEL = 0.1 |
John Park | 91e6973 | 2019-03-03 13:12:43 -0800 | [diff] [blame] | 16 | HATCH_PANEL_WIDTH = 0.4826 |
| 17 | |
Maxwell Henderson | 4a18b19 | 2023-03-10 15:04:04 -0800 | [diff] [blame] | 18 | # field_id is either just a file prefix for a .png in field_images/ or is a |
| 19 | # full path preceded by // specifying a location relative to the root of the |
| 20 | # repository. |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 21 | FieldType = namedtuple( |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 22 | 'Field', ['name', 'tags', 'year', 'width', 'length', 'robot', 'field_id']) |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 23 | RobotType = namedtuple("Robot", ['width', 'length']) |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 24 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 25 | GALACTIC_SEARCH = "Galactic Search" |
| 26 | ARED = "A Red" |
| 27 | BRED = "B Red" |
| 28 | ABLUE = "A Blue" |
| 29 | BBLUE = "B Blue" |
| 30 | AUTONAV = "AutoNav" |
| 31 | BOUNCE = "Bounce" |
| 32 | SLALOM = "Slalom" |
| 33 | BARREL = "Barrel" |
| 34 | |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 35 | Robot2019 = RobotType(width=0.65, length=0.8) |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 36 | Robot2020 = RobotType(width=0.8128, length=0.8636) # 32 in x 34 in |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 37 | Robot2021 = Robot2020 |
Henry Speiser | b0703aa | 2022-03-14 22:19:40 -0700 | [diff] [blame] | 38 | Robot2022 = RobotType(width=0.8763, length=0.96647) |
Maxwell Henderson | f136b05 | 2023-03-10 15:09:24 -0800 | [diff] [blame^] | 39 | Robot2023 = RobotType(width=0.6061, length=0.77581) |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 40 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 41 | FIELDS = { |
| 42 | "2019 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 43 | FieldType("2019 Field", |
| 44 | tags=[], |
| 45 | year=2019, |
| 46 | width=8.258302, |
| 47 | length=8.258302, |
| 48 | robot=Robot2019, |
| 49 | field_id="2019"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 50 | "2020 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 51 | FieldType("2020 Field", |
| 52 | tags=[], |
| 53 | year=2020, |
| 54 | width=15.98295, |
| 55 | length=8.21055, |
| 56 | robot=Robot2020, |
| 57 | field_id="2020"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 58 | "2021 Galactic Search BRed": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 59 | FieldType("2021 Galactic Search BRed", |
| 60 | tags=[GALACTIC_SEARCH, BRED], |
| 61 | year=2021, |
| 62 | width=9.144, |
| 63 | length=4.572, |
| 64 | robot=Robot2021, |
| 65 | field_id="red_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 66 | "2021 Galactic Search ARed": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 67 | FieldType("2021 Galactic Search ARed", |
| 68 | tags=[GALACTIC_SEARCH, ARED], |
| 69 | year=2021, |
| 70 | width=9.144, |
| 71 | length=4.572, |
| 72 | robot=Robot2021, |
| 73 | field_id="red_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 74 | "2021 Galactic Search BBlue": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 75 | FieldType("2021 Galactic Search BBlue", |
| 76 | tags=[GALACTIC_SEARCH, BBLUE], |
| 77 | year=2021, |
| 78 | width=9.144, |
| 79 | length=4.572, |
| 80 | robot=Robot2021, |
| 81 | field_id="blue_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 82 | "2021 Galactic Search ABlue": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 83 | FieldType("2021 Galactic Search ABlue", |
| 84 | tags=[GALACTIC_SEARCH, ABLUE], |
| 85 | year=2021, |
| 86 | width=9.144, |
| 87 | length=4.572, |
| 88 | robot=Robot2021, |
| 89 | field_id="blue_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 90 | "2021 AutoNav Barrel": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 91 | FieldType("2021 AutoNav Barrel", |
| 92 | tags=[AUTONAV, BARREL], |
| 93 | year=2021, |
| 94 | width=9.144, |
| 95 | length=4.572, |
| 96 | robot=Robot2021, |
| 97 | field_id="autonav_barrel"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 98 | "2021 AutoNav Slalom": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 99 | FieldType("2021 AutoNav Slalom", |
| 100 | tags=[AUTONAV, SLALOM], |
| 101 | year=2021, |
| 102 | width=9.144, |
| 103 | length=4.572, |
| 104 | robot=Robot2021, |
| 105 | field_id="autonav_slalom"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 106 | "2021 AutoNav Bounce": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 107 | FieldType("2021 AutoNav Bounce", |
| 108 | tags=[AUTONAV, BOUNCE], |
| 109 | year=2021, |
| 110 | width=9.144, |
| 111 | length=4.572, |
| 112 | robot=Robot2021, |
| 113 | field_id="autonav_bounce"), |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 114 | "2022 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 115 | FieldType("2022 Field", |
| 116 | tags=[], |
| 117 | year=2022, |
| 118 | width=16.4592, |
| 119 | length=8.2296, |
| 120 | robot=Robot2022, |
| 121 | field_id="2022"), |
Maxwell Henderson | 4a18b19 | 2023-03-10 15:04:04 -0800 | [diff] [blame] | 122 | "2023 Field": |
| 123 | FieldType("2023 Field", |
| 124 | tags=[], |
| 125 | year=2023, |
| 126 | width=16.59255, |
| 127 | length=8.10895, |
| 128 | robot=Robot2023, |
| 129 | field_id="//third_party/y2023/field/2023.png"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 130 | } |
| 131 | |
Maxwell Henderson | 4a18b19 | 2023-03-10 15:04:04 -0800 | [diff] [blame] | 132 | FIELD = FIELDS["2023 Field"] |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 133 | |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 134 | |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 135 | def get_json_folder(field): |
| 136 | if field.year == 2020 or field.year == 2021: |
| 137 | return "y2020/actors/splines" |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 138 | elif field.year == 2022: |
| 139 | return "y2022/actors/splines" |
Maxwell Henderson | f136b05 | 2023-03-10 15:09:24 -0800 | [diff] [blame^] | 140 | elif field.year == 2023: |
| 141 | return "y2023/autonomous/splines" |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 142 | else: |
| 143 | return "frc971/control_loops/python/spline_jsons" |
| 144 | |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 145 | |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 146 | def inToM(i): |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 147 | return (i * 0.0254) |