* New translations index.md (Korean) * New translations payload.md (Korean) * New translations traffic_management.md (Korean) * New translations index.md (Chinese Simplified) * New translations payload.md (Chinese Simplified) * New translations traffic_management.md (Chinese Simplified) * New translations define_xml_element.md (Korean) * New translations define_xml_element.md (Chinese Simplified) * New translations mavlink_version.md (Korean) * New translations index.md (Korean) * New translations overview.md (Korean) * New translations support.md (Korean) * New translations contributing.md (Korean) * New translations use_libraries.md (Korean) * New translations generate_libraries.md (Korean) * New translations installation.md (Korean) * New translations mavlink_2.md (Korean) * New translations message_signing.md (Korean) * New translations routing.md (Korean) * New translations scripts.md (Korean) * New translations serialization.md (Korean) * New translations wireshark.md (Korean) * New translations xml_schema.md (Korean) * New translations crc.md (Korean) * New translations index.md (Korean) * New translations example_c_udp.md (Korean) * New translations index.md (Korean) * New translations message_signing.md (Korean) * New translations image_transmission.md (Korean) * New translations landing_target.md (Korean) * New translations mavlink_id_assignment.md (Korean) * New translations mission.md (Korean) * New translations opendroneid.md (Korean) * New translations parameter.md (Korean) * New translations parameter_ext.md (Korean) * New translations ping.md (Korean) * New translations standard_modes.md (Korean) * New translations terrain.md (Korean) * New translations timesync.md (Korean) * New translations trajectory.md (Korean) * New translations mavlink_version.md (Chinese Simplified) * New translations index.md (Chinese Simplified) * New translations overview.md (Chinese Simplified) * New translations support.md (Chinese Simplified) * New translations tunnel.md (Korean) * New translations battery.md (Korean) * New translations camera.md (Korean) * New translations camera_def.md (Korean) * New translations camera_v1.md (Korean) * New translations component_information.md (Korean) * New translations events.md (Korean) * New translations ftp.md (Korean) * New translations gimbal.md (Korean) * New translations gimbal_v2.md (Korean) * New translations contributing.md (Chinese Simplified) * New translations use_libraries.md (Chinese Simplified) * New translations generate_libraries.md (Chinese Simplified) * New translations installation.md (Chinese Simplified) * New translations mavlink_2.md (Chinese Simplified) * New translations message_signing.md (Chinese Simplified) * New translations routing.md (Chinese Simplified) * New translations scripts.md (Chinese Simplified) * New translations serialization.md (Chinese Simplified) * New translations wireshark.md (Chinese Simplified) * New translations xml_schema.md (Chinese Simplified) * New translations crc.md (Chinese Simplified) * New translations index.md (Chinese Simplified) * New translations example_c_udp.md (Chinese Simplified) * New translations index.md (Chinese Simplified) * New translations message_signing.md (Chinese Simplified) * New translations image_transmission.md (Chinese Simplified) * New translations landing_target.md (Chinese Simplified) * New translations mavlink_id_assignment.md (Chinese Simplified) * New translations mission.md (Chinese Simplified) * New translations opendroneid.md (Chinese Simplified) * New translations parameter.md (Chinese Simplified) * New translations parameter_ext.md (Chinese Simplified) * New translations ping.md (Chinese Simplified) * New translations standard_modes.md (Chinese Simplified) * New translations terrain.md (Chinese Simplified) * New translations timesync.md (Chinese Simplified) * New translations trajectory.md (Chinese Simplified) * New translations tunnel.md (Chinese Simplified) * New translations battery.md (Chinese Simplified) * New translations camera.md (Chinese Simplified) * New translations camera_def.md (Chinese Simplified) * New translations camera_v1.md (Chinese Simplified) * New translations component_information.md (Chinese Simplified) * New translations events.md (Chinese Simplified) * New translations ftp.md (Chinese Simplified) * New translations gimbal.md (Chinese Simplified) * New translations gimbal_v2.md (Chinese Simplified) * New translations heartbeat.md (Korean) * New translations high_latency.md (Korean) * New translations heartbeat.md (Chinese Simplified) * New translations high_latency.md (Chinese Simplified)
3.7 KiB
PING Protocol
The PING Protocol enables a system to measure system latencies on any connection: serial port, radio modem, UDP etc.
The PING protocol is implemented with just the PING message. The message is sent with a timestamp and a sequence number that are returned by recipients, and can hence be used to determine the round-trip time.
Ping Sequence
A simplified sequence diagram is given below:
The pinging system initially populates a PING message with:
time_usec: Current system timestamp.seq: CurrentPINGsequence number (n, n+1, ...). This should be iterated for everyPINGmessage sent and overflow back to zero.target_systemandtarget_component: 0 (indicates a PING request).- The message header automatically includes the sender system.
The message may be received by multiple systems.
All pinged systems should respond with another PING message where:
- The original timestamp and sequence number from the receive
PINGare sent back in the response. target_systemandtarget_componentare set to the ids of the pinging system from the incoming ping message header.
The original pinging system:
-
Receives a
PINGmessage withtarget_systemandtarget_componentmatching its address.::: tip Any non-zero target system/component indicates a response message. The matching ids inform the system that it is the intended recipient. :::
-
The system calculates the latency from the current system time and the time in the response
PINGfor the matching sequence number. -
A system that is sending a single
PINGcan use a timeout to detect a dropped packet. A system that is streaming (multiple)PINGmessages should not start detecting dropped packets until after the first responses have been received (to ensure that dropped packets are not just "late").
C Implementation
The protocol has been implemented in C by PX4 and QGroundControl. This implementation can be used in your own code within the terms of their software licenses.
PX4 Implementation:
QGroundControl implementation: