Skip to content

Fix default gamecontroller interface for macos#3819

Merged
williamckha merged 3 commits into
UBC-Thunderbots:robocup_2026from
nycrat:avah/macos_fix_gamecontroller_interface
Jun 30, 2026
Merged

Fix default gamecontroller interface for macos#3819
williamckha merged 3 commits into
UBC-Thunderbots:robocup_2026from
nycrat:avah/macos_fix_gamecontroller_interface

Conversation

@nycrat

@nycrat nycrat commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description

Discovered this cause we don't have good wifi here at robocup, found out by turning off wifi macos can't use the en0 interface which is referenced in gamecontroller binary context manager. This PR uses netifaces to get primary interface instead of relying on en0 for macos, this does not need to be changed on linux since the multicast messages get sent to the loopback interface.

Testing Done

Without the changes, running ./tbots.py run thunderscope --enable_autoref with wifi turned off results in this error:

Traceback (most recent call last):
  File "/private/var/tmp/_bazel_avah/c66e7f3b6f9fffee22646d89d33fc0ae/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/software/thunderscope/thunderscope_main.runfiles/_main/software/thunderscope/thunderscope_main.py", line 483, in <module>
    gamecontroller.setup_proto_unix_io(
  File "/private/var/tmp/_bazel_avah/c66e7f3b6f9fffee22646d89d33fc0ae/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/software/thunderscope/thunderscope_main.runfiles/_main/software/thunderscope/binary_context_managers/game_controller.py", line 253, in setup_proto_unix_io
    self.receive_referee_command = tbots_cpp.SSLRefereeProtoListener(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
software.python_bindings.TbotsNetworkException: Could not find the local ip address for the given interface: en0

After the changes, everything works including gamecontroller.

NOTE: there is an additional bug fix for a bug introduced in #3766 about gamecontroller ports

Resolved Issues

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

@nycrat nycrat force-pushed the avah/macos_fix_gamecontroller_interface branch from bdba8a7 to af24265 Compare June 30, 2026 06:42
@nycrat nycrat marked this pull request as ready for review June 30, 2026 06:43
@williamckha williamckha merged commit e46e25d into UBC-Thunderbots:robocup_2026 Jun 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants