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) |
Tushar Pankaj | 6274273 | 2024-02-19 21:11:30 -0800 | [diff] [blame] | 40 | Robot2024 = RobotType(width=0.85979, length=0.9906) # 33.85 in x 39.0 in |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 41 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 42 | FIELDS = { |
| 43 | "2019 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 44 | FieldType("2019 Field", |
| 45 | tags=[], |
| 46 | year=2019, |
| 47 | width=8.258302, |
| 48 | length=8.258302, |
| 49 | robot=Robot2019, |
| 50 | field_id="2019"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 51 | "2020 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 52 | FieldType("2020 Field", |
| 53 | tags=[], |
| 54 | year=2020, |
| 55 | width=15.98295, |
| 56 | length=8.21055, |
| 57 | robot=Robot2020, |
| 58 | field_id="2020"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 59 | "2021 Galactic Search BRed": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 60 | FieldType("2021 Galactic Search BRed", |
| 61 | tags=[GALACTIC_SEARCH, BRED], |
| 62 | year=2021, |
| 63 | width=9.144, |
| 64 | length=4.572, |
| 65 | robot=Robot2021, |
| 66 | field_id="red_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 67 | "2021 Galactic Search ARed": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 68 | FieldType("2021 Galactic Search ARed", |
| 69 | tags=[GALACTIC_SEARCH, ARED], |
| 70 | year=2021, |
| 71 | width=9.144, |
| 72 | length=4.572, |
| 73 | robot=Robot2021, |
| 74 | field_id="red_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 75 | "2021 Galactic Search BBlue": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 76 | FieldType("2021 Galactic Search BBlue", |
| 77 | tags=[GALACTIC_SEARCH, BBLUE], |
| 78 | year=2021, |
| 79 | width=9.144, |
| 80 | length=4.572, |
| 81 | robot=Robot2021, |
| 82 | field_id="blue_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 83 | "2021 Galactic Search ABlue": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 84 | FieldType("2021 Galactic Search ABlue", |
| 85 | tags=[GALACTIC_SEARCH, ABLUE], |
| 86 | year=2021, |
| 87 | width=9.144, |
| 88 | length=4.572, |
| 89 | robot=Robot2021, |
| 90 | field_id="blue_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 91 | "2021 AutoNav Barrel": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 92 | FieldType("2021 AutoNav Barrel", |
| 93 | tags=[AUTONAV, BARREL], |
| 94 | year=2021, |
| 95 | width=9.144, |
| 96 | length=4.572, |
| 97 | robot=Robot2021, |
| 98 | field_id="autonav_barrel"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 99 | "2021 AutoNav Slalom": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 100 | FieldType("2021 AutoNav Slalom", |
| 101 | tags=[AUTONAV, SLALOM], |
| 102 | year=2021, |
| 103 | width=9.144, |
| 104 | length=4.572, |
| 105 | robot=Robot2021, |
| 106 | field_id="autonav_slalom"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 107 | "2021 AutoNav Bounce": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 108 | FieldType("2021 AutoNav Bounce", |
| 109 | tags=[AUTONAV, BOUNCE], |
| 110 | year=2021, |
| 111 | width=9.144, |
| 112 | length=4.572, |
| 113 | robot=Robot2021, |
| 114 | field_id="autonav_bounce"), |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 115 | "2022 Field": |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 116 | FieldType("2022 Field", |
| 117 | tags=[], |
| 118 | year=2022, |
| 119 | width=16.4592, |
| 120 | length=8.2296, |
| 121 | robot=Robot2022, |
| 122 | field_id="2022"), |
Maxwell Henderson | 4a18b19 | 2023-03-10 15:04:04 -0800 | [diff] [blame] | 123 | "2023 Field": |
| 124 | FieldType("2023 Field", |
| 125 | tags=[], |
| 126 | year=2023, |
| 127 | width=16.59255, |
| 128 | length=8.10895, |
| 129 | robot=Robot2023, |
| 130 | field_id="//third_party/y2023/field/2023.png"), |
Nathan Leong | 5d69015 | 2024-01-10 21:10:10 -0800 | [diff] [blame] | 131 | "2024 Field": |
| 132 | FieldType("2024 Field", |
| 133 | tags=[], |
| 134 | year=2024, |
| 135 | width=16.54175, |
| 136 | length=8.21055, |
| 137 | robot=Robot2024, |
| 138 | field_id="//third_party/y2024/field/2024.png"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Nathan Leong | 5d69015 | 2024-01-10 21:10:10 -0800 | [diff] [blame] | 141 | FIELD = FIELDS["2024 Field"] |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 142 | |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 143 | |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 144 | def get_json_folder(field): |
| 145 | if field.year == 2020 or field.year == 2021: |
| 146 | return "y2020/actors/splines" |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 147 | elif field.year == 2022: |
| 148 | return "y2022/actors/splines" |
Maxwell Henderson | f136b05 | 2023-03-10 15:09:24 -0800 | [diff] [blame] | 149 | elif field.year == 2023: |
| 150 | return "y2023/autonomous/splines" |
James Kuszmaul | d7938a6 | 2024-03-15 21:21:23 -0700 | [diff] [blame^] | 151 | elif field.year == 2024: |
| 152 | return "y2024/autonomous/splines" |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 153 | else: |
| 154 | return "frc971/control_loops/python/spline_jsons" |
| 155 | |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 156 | |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 157 | def inToM(i): |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 158 | return (i * 0.0254) |