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