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 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 18 | FieldType = namedtuple( |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 19 | 'Field', ['name', 'tags', 'year', 'width', 'length', 'robot', 'field_id']) |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 20 | RobotType = namedtuple( |
| 21 | "Robot", ['width', 'length']) |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 22 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 23 | GALACTIC_SEARCH = "Galactic Search" |
| 24 | ARED = "A Red" |
| 25 | BRED = "B Red" |
| 26 | ABLUE = "A Blue" |
| 27 | BBLUE = "B Blue" |
| 28 | AUTONAV = "AutoNav" |
| 29 | BOUNCE = "Bounce" |
| 30 | SLALOM = "Slalom" |
| 31 | BARREL = "Barrel" |
| 32 | |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 33 | Robot2019 = RobotType(width=0.65, length=0.8) |
| 34 | Robot2020 = RobotType(width=0.8128, length=0.8636) # 32 in x 34 in |
| 35 | Robot2021 = Robot2020 |
Henry Speiser | b0703aa | 2022-03-14 22:19:40 -0700 | [diff] [blame] | 36 | Robot2022 = RobotType(width=0.8763, length=0.96647) |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 37 | |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 38 | FIELDS = { |
| 39 | "2019 Field": |
| 40 | FieldType( |
| 41 | "2019 Field", |
| 42 | tags=[], |
| 43 | year=2019, |
| 44 | width=8.258302, |
| 45 | length=8.258302, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 46 | robot=Robot2019, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 47 | field_id="2019"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 48 | "2020 Field": |
| 49 | FieldType( |
| 50 | "2020 Field", |
| 51 | tags=[], |
| 52 | year=2020, |
| 53 | width=15.98295, |
| 54 | length=8.21055, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 55 | robot=Robot2020, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 56 | field_id="2020"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 57 | "2021 Galactic Search BRed": |
| 58 | FieldType( |
| 59 | "2021 Galactic Search BRed", |
| 60 | tags=[GALACTIC_SEARCH, BRED], |
| 61 | year=2021, |
| 62 | width=9.144, |
| 63 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 64 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 65 | field_id="red_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 66 | "2021 Galactic Search ARed": |
| 67 | FieldType( |
| 68 | "2021 Galactic Search ARed", |
| 69 | tags=[GALACTIC_SEARCH, ARED], |
| 70 | year=2021, |
| 71 | width=9.144, |
| 72 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 73 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 74 | field_id="red_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 75 | "2021 Galactic Search BBlue": |
| 76 | FieldType( |
| 77 | "2021 Galactic Search BBlue", |
| 78 | tags=[GALACTIC_SEARCH, BBLUE], |
| 79 | year=2021, |
| 80 | width=9.144, |
| 81 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 82 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 83 | field_id="blue_b"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 84 | "2021 Galactic Search ABlue": |
| 85 | FieldType( |
| 86 | "2021 Galactic Search ABlue", |
| 87 | tags=[GALACTIC_SEARCH, ABLUE], |
| 88 | year=2021, |
| 89 | width=9.144, |
| 90 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 91 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 92 | field_id="blue_a"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 93 | "2021 AutoNav Barrel": |
| 94 | FieldType( |
| 95 | "2021 AutoNav Barrel", |
| 96 | tags=[AUTONAV, BARREL], |
| 97 | year=2021, |
| 98 | width=9.144, |
| 99 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 100 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 101 | field_id="autonav_barrel"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 102 | "2021 AutoNav Slalom": |
| 103 | FieldType( |
| 104 | "2021 AutoNav Slalom", |
| 105 | tags=[AUTONAV, SLALOM], |
| 106 | year=2021, |
| 107 | width=9.144, |
| 108 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 109 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 110 | field_id="autonav_slalom"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 111 | "2021 AutoNav Bounce": |
| 112 | FieldType( |
| 113 | "2021 AutoNav Bounce", |
| 114 | tags=[AUTONAV, BOUNCE], |
| 115 | year=2021, |
| 116 | width=9.144, |
| 117 | length=4.572, |
Ravago Jones | 5e09c07 | 2021-03-27 13:21:03 -0700 | [diff] [blame] | 118 | robot=Robot2021, |
Ravago Jones | c26b916 | 2021-06-30 20:12:48 -0700 | [diff] [blame] | 119 | field_id="autonav_bounce"), |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 120 | "2022 Field": |
| 121 | FieldType( |
| 122 | "2022 Field", |
| 123 | tags=[], |
| 124 | year=2022, |
| 125 | width=16.4592, |
| 126 | length=8.2296, |
| 127 | robot=Robot2022, |
| 128 | field_id="2022"), |
Ravago Jones | 5f787df | 2021-01-23 16:26:27 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 131 | FIELD = FIELDS["2022 Field"] |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 132 | |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 133 | |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 134 | def get_json_folder(field): |
| 135 | if field.year == 2020 or field.year == 2021: |
| 136 | return "y2020/actors/splines" |
Griffin Bui | 41a08f3 | 2022-02-26 16:20:29 -0800 | [diff] [blame] | 137 | elif field.year == 2022: |
| 138 | return "y2022/actors/splines" |
Ravago Jones | 09f5972 | 2021-03-03 21:11:41 -0800 | [diff] [blame] | 139 | else: |
| 140 | return "frc971/control_loops/python/spline_jsons" |
| 141 | |
John Park | cf54516 | 2020-02-23 20:07:25 -0800 | [diff] [blame] | 142 | def inToM(i): |
James Kuszmaul | 1c933e0 | 2020-03-07 16:17:51 -0800 | [diff] [blame] | 143 | return (i * 0.0254) |