Skip to content

Scan Simmyflie UDP ports in addition to CrazySim ports - #616

Open
stefanthorstenson wants to merge 4 commits into
masterfrom
stefan/simmyflie
Open

stefanthorstenson wants to merge 4 commits into
masterfrom
stefan/simmyflie

Conversation

@stefanthorstenson

@stefanthorstenson stefanthorstenson commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The UDP driver's scan only probes ports 19850 to 19859, the range used by CrazySim. Simmyflie, the simulation target in crazyflie-firmware, listens on port 26501 by default, and ports 26501 to 26999 are recommended for further instances. A Simmyflie on its default port is therefore not found when scanning, for example with the Scan button in cfclient.

This change makes the scan probe ports 26501 to 26999 in addition to 19850 to 19859, so CrazySim is still found as before. The ranges are kept in a single table, _SCAN_PORT_RANGES, in udpdriver.py. The probe socket is now always closed, also when the probe fails with an error other than a timeout.

The range 26500 to 26999 is not assigned by IANA and lies below the ephemeral port ranges of Linux (32768 to 60999), Windows and macOS (49152 to 65535), so other programs rarely hold these ports. Port 26500 is Simmyflie's beacon port and is not scanned.

About performance

The scan probes 509 ports instead of 10. On localhost this is fast: a port with nothing listening fails right away, since the OS answers "port unreachable". The full scan takes about 0.02 s in the normal case.

A port held by another program that ignores the probe costs the full 0.1 s timeout. The same goes for every port if SCAN_ADDRESS points to a remote host whose firewall drops the probes without answering.

Tests

Tested on Pop!_OS 24.04 (Ubuntu 24.04) with Simmyflies built from crazyflie-firmware with the new port defaults, running on ports 19850, 19859, 26501, 26999 and 27000 at the same time.

cflib.crtp.scan_interfaces() found the four Simmyflies inside the scanned ranges, and not the one on 27000:

scan took 0.02 s
found: ['udp://127.0.0.1:19850', 'udp://127.0.0.1:19859', 'udp://127.0.0.1:26501', 'udp://127.0.0.1:26999']

Connecting to each found URI with SyncCrazyflie and reading a parameter worked.

Full chain with cfclient:

image

@stefanthorstenson
stefanthorstenson marked this pull request as ready for review November 13, 2026 13:37

This branch has not been deployed

No deployments
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.

1 participant