Skip to content

[BUG]: MagicBot: LiveWindow in test mode crashes with CTRE CANrange #233

@james-ward

Description

@james-ward

Problem description

  1. Add a phoenix6.hardware.CANrange to a magicbot component.
  2. Run sim
  3. Enable test mode
  4. Crash

Report indicates the issue is when LiveWindow is enabled.

The above stacktrace can help determine where the error occurred.
Traceback (most recent call last):
  File "C:\Users\james\frc\pyrebuilt\.venv\Lib\site-packages\wpilib\_impl\start.py", line 160, in start
    return self._start(robot_cls)
           ~~~~~~~~~~~^^^^^^^^^^^
  File "C:\Users\james\frc\pyrebuilt\.venv\Lib\site-packages\wpilib\_impl\start.py", line 247, in _start
    self.robot.startCompetition()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\james\frc\pyrebuilt\.venv\Lib\site-packages\magicbot\magicrobot.py", line 379, in startCompetition
    self._test()
    ~~~~~~~~~~^^
  File "C:\Users\james\frc\pyrebuilt\.venv\Lib\site-packages\magicbot\magicrobot.py", line 523, in _test
    wpilib.LiveWindow.setEnabled(True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\james\frc\pyrebuilt\.venv\Lib\site-packages\phoenix6\hardware\canrange.py", line 150, in initSendable
    builder.addDoubleProperty("Distance", self.__distance_getter.as_supplier(), None)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: addDoubleProperty(): incompatible function arguments. The following argument types are supported:
    1. (self: wpilib._wpilib.SendableBuilderImpl, key: str, getter: collections.abc.Callable[[], float], setter: collections.abc.Callable[[typing.SupportsFloat | typing.SupportsIndex], None]) -> None

Invoked with: <wpilib._wpilib.SendableBuilderImpl object at 0x000001BBDA4D9F70>, 'Distance', <function StatusSignal.as_supplier.<locals>.<lambda> at 0x000001BC20F19BC0>, None


Locals at innermost frame:

{'self': <phoenix6.hardware.canrange.CANrange object at 0x000001BC20EE1A30>, 'builder': <wpilib._...

Commenting out line 523 in magicbot.py fixes the problem, but this probably isn't the correct solution.

Simulated teleop and auto are fine.

Operating System

RoboRIO, Linux

Installed Python Packages

Package                  Version
------------------------ -----------
bcrypt                   5.0.0
cffi                     2.0.0
colorama                 0.4.6
coverage                 7.13.1
cryptography             46.0.3
flexcache                0.3
flexparser               0.4
hypothesis               6.150.2
importlib_resources      6.5.2
iniconfig                2.3.0
invoke                   2.2.1
librt                    0.7.8
msvc_runtime             14.44.35112
mypy                     1.19.1
mypy_extensions          1.1.0
numpy                    2.3.5
opencv-python            4.13.0.92
packaging                26.0rc3
paramiko                 4.0.0
pathspec                 1.0.3
phoenix6                 26.1.2
photonlibpy              2026.3.2
Pint                     0.25.2
pip                      25.3
platformdirs             4.5.1
pluggy                   1.6.0
pycparser                3.0
pyfrc                    2026.0.2
Pygments                 2.19.2
PyNaCl                   1.6.2
pynetconsole             2.0.4
pyntcore                 2026.2.2
pytest                   9.0.2
pytest-integration       0.2.3
pytest-reraise           2.1.2
robotpy                  2026.2.2
robotpy-apriltag         2026.2.2
robotpy-cli              2026.0.1
robotpy-commands-v2      2026.2.2
robotpy-cscore           2026.2.2
robotpy-hal              2026.2.2
robotpy-halsim-gui       2026.2.2
robotpy-installer        2026.0.1
robotpy-native-apriltag  2026.2.2
robotpy-native-ntcore    2026.2.2
robotpy-native-wpihal    2026.2.2
robotpy-native-wpilib    2026.2.2
robotpy-native-wpimath   2026.2.2
robotpy-native-wpinet    2026.2.2
robotpy-native-wpiutil   2026.2.2
robotpy-pathplannerlib   2026.1.2
robotpy-rev              2026.0.1
robotpy-wpilib-utilities 2026.1.0
robotpy-wpimath          2026.2.2
robotpy-wpinet           2026.2.2
robotpy-wpiutil          2026.2.2
sortedcontainers         2.4.0
tomli                    2.4.0
tomlkit                  0.14.0
toposort                 1.10
typing_extensions        4.15.0
wpilib                   2026.2.2

Reproducible example code


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions