UDP datagram flow
What UDP does and does not guarantee: datagrams travel independently, can be lost or arrive out of order, and the receiver must use sequence numbers to detect and handle both.
Loading simulation…
What it demonstrates
What UDP does and does not guarantee: datagrams travel independently, can be lost or arrive out of order, and the receiver must use sequence numbers to detect and handle both.
How it works
The same link model as the latency experiment, slowed to a few packets per second. Each packet is drawn travelling from sender to receiver. Lost packets fall out of the network; packets that will overtake an older one are highlighted. The receive log lists packets in arrival order and marks those that arrived after a newer packet.
Adjustable parameters
- Send rate (2–60 Hz)
- Base latency (20–600 ms)
- Jitter (0–400 ms)
- Packet loss (0–50%)
- Receiver policy
Known limitations
- Timing is exaggerated (hundreds of milliseconds) so individual packets are visible; on a local machine or a robot's internal network, UDP latency is usually well under a millisecond.
- Duplication, fragmentation and checksum failures are not modelled.
Equations
Core update rule
data, addr = sock.recvfrom(64)
seq, t_us, *imu = struct.unpack("<IQ6f", data)
if seq <= last_seq: # older than what we already have
continue # drop stale / duplicate datagram
lost += seq - last_seq - 1
last_seq = seqExplained in Chapter 5: Communication & Firmware