Skip to content

Add receive_latest() to read the most recent feedback packet - #14

Merged
FLo-ABB merged 2 commits into
FLo-ABB:mainfrom
albsve2:receive-latest
Oct 26, 2026
Merged

FLo-ABB merged 2 commits into
FLo-ABB:mainfrom
albsve2:receive-latest

Conversation

@albsve2

@albsve2 albsve2 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Closes #13.

receive_from_robot() reads one packet per call. If a control loop is occasionally slower than the robot's 4 ms update rate, packets queue up in the socket buffer and later calls return stale positions without any warning.

This adds an opt-in receive_latest(timeout) that waits for a first packet, drains anything already queued, and returns (success, newest_state, skipped). skipped makes it easy to detect a loop that falls behind. receive_from_robot() is unchanged, so streaming and logging still get every packet. A short section is added to the README.

Tested with a local UDP socket acting as the robot: with three queued packets (z = 4, 5, 6), receive_latest returns z = 6 and skipped = 2, while receive_from_robot returns the oldest. With an empty queue it returns (False, None, 0) after the timeout.

@FLo-ABB
FLo-ABB merged commit 612d7e7 into FLo-ABB:main Oct 26, 2026
2 checks passed
@FLo-ABB

FLo-ABB commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Thanks for your input !

PeterBowman added a commit to roboticslab-uc3m/abb_egm_driver that referenced this pull request Nov 7, 2026
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.

Add receive_latest() to read the most recent feedback packet

2 participants