Skip to content

Commit 9ff95bf

Browse files
authored
Merge pull request #59 from systemetric/2026-changes
2026 changes
2 parents d2b9f07 + 7c13868 commit 9ff95bf

5 files changed

Lines changed: 22 additions & 15 deletions

File tree

robot/game_config/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
BLUE = (255, 0, 0) # Blue
1818
WHITE = (255, 255, 255) # White
1919

20+
SECTOR = TEAM # 2026 ONLY, ALIAS `TEAM` AS `SECTOR`
21+
2022
__all__ = (
2123
"TEAM",
24+
"SECTOR",
2225
"TARGET_TYPE",
2326
"MARKER",
2427
"TARGET_MARKER",

robot/game_config/markers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class MARKER_TYPE(enum.Enum): # Keep something like this to determine if a marker is a wall or not.
2525
TARGET = enum.auto()
2626
ARENA = enum.auto()
27-
ARENA_OBJECT = enum.auto()
27+
TREE = enum.auto()
2828

2929

3030
class BASE_MARKER: # Base marker class that TARGET_MARKER and ARENA_MARKER derive from.
@@ -79,10 +79,10 @@ def __repr__(self) -> str:
7979

8080
class ARENA_OBJECT_MARKER(BASE_MARKER): # A non-interactable object in the arena, that is not a wall.
8181
def __init__(self, id: int) -> None:
82-
super().__init__(id, MARKER_TYPE.ARENA_OBJECT)
82+
super().__init__(id, MARKER_TYPE.TREE)
8383

8484
def __repr__(self) -> str:
85-
return f"<Marker(ARENA_OBJECT)/>"
85+
return f"<Marker(TREE)/>"
8686

8787
class TARGET_MARKER(BASE_MARKER): # This is a game object rather than a wall. Add properties you want to keep track of
8888
def __init__(

robot/game_config/targets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"""
66
class TARGET_TYPE(enum.Enum):
77

8-
SUPPLY_L = "SUPPLY_L" # This matches T0, for example.
9-
SUPPLY_H = "SUPPLY_H"
8+
SUPPLY_CRATE = "SUPPLY_L" # This matches T0, for example.
9+
SUPPLY_DROP = "SUPPLY_H"
1010

1111
# There is no T value for ARENA, so there is no way that the assignment of team to a marker can accidentally assign ARENA if the logic goes wrong.
1212

robot/greengiant.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def _decrement_pin_index(index):
160160
_GG_MOTOR_ERROR_STATE = 40
161161
_GG_SYSTEM_ERROR_STATE = 41
162162

163+
V_ZEN = (10.1)
163164

164165
def read_high_low_data(bus, address):
165166
"""Fetches and combines data stored across two bytes"""
@@ -250,8 +251,14 @@ def get_version(self):
250251
return self._bus.read_byte_data(_GG_I2C_ADDR, _GG_VERSION)
251252

252253
def get_battery_voltage(self):
253-
# both GG and PiLow use a 1/3 divider and a 4.096v reference giving a max readable voltage of ~12.3v
254-
return read_high_low_data(self._bus, _GG_BATTERY_V_H)
254+
# Firmware version 12 and later reports voltage differently
255+
if self._version < 12:
256+
# both GG and PiLow use a 1/3 divider and a 4.096v reference giving a max readable voltage of ~12.3v
257+
return read_high_low_data(self._bus, _GG_BATTERY_V_H) * _GG_BATTERY_MAX_READING / _GG_BATTERY_ADC_MAX
258+
else:
259+
# Hardware change for Cambridge brains in Nov 2025 to use a zener diode
260+
return ((read_high_low_data(self._bus, _GG_BATTERY_V_H) / 65535) * 4.096) + V_ZEN
261+
255262

256263
def get_fvr_reading(self):
257264
"""Return the fixed voltage reading. The number read here is sampling the 4.096v reference using the VCC rail (GG only)

robot/wrapper.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class to their respecitve classes
3434
# this boot cycle. This is to highlight weird behaviour in the arena
3535
COPY_STAT_FILE = "/tmp/usb_file_uploaded"
3636

37-
V_ZEN = (10.1)
38-
3937
def setup_logging(level):
4038
"""Display the just the message when logging events
4139
Sets the logging level to `level`"""
@@ -167,14 +165,13 @@ def report_hardware_status(self):
167165
"""Print out a nice log message at the start of each robot init with
168166
the hardware status"""
169167

170-
battery_voltage = ((self._green_giant.get_battery_voltage() / 65535) * 4.096) + V_ZEN
168+
battery_voltage = self._green_giant.get_battery_voltage()
171169
battery_str = "Battery Voltage: %.2fv" % battery_voltage
172170
# GG cannot read voltages above 12.2v
173-
#if battery_voltage > 12.2:
174-
# battery_str = "Battery Voltage: > 12.2v"
175-
# if battery_voltage < 11.5:
176-
# self._warnings.append("Battery voltage below 11.5v, consider "
177-
# "changing for a charged battery")
171+
if battery_voltage > 12.2:
172+
battery_str = "Battery Voltage: > 12.2v"
173+
elif battery_voltage < 11.5:
174+
self._warnings.append("Battery voltage below 11.5v, consider changing for a charged battery")
178175

179176
if self._gg_version < 3:
180177
self._warnings.append(

0 commit comments

Comments
 (0)