Symptoms: LLUAVConnectionError immediately on connect().
Causes & Fixes:
1. Drone not reachable โ Verify network connectivity:
bash
ping <host>
telnet <host> 53001
2. Firewall blocking port 53001 โ Ensure the drone's firewall allows inbound WebSocket connections.
3. Wrong host/port โ Double-check the IP and port. Some firmware builds use a non-default port.
4. Password mismatch โ If password protection is enabled but no password is provided, the server may immediately close the connection after the login failure.
Symptoms: connect() hangs and then raises timeout.
Causes & Fixes:
1. High latency link (e.g., 4G/5G telemetry) โ Increase timeout:
python
client = LLUAVClient("192.168.1.100", timeout=30.0)
2. Drone CPU overloaded โ The WebSocket server may be slow to respond if the flight controller is under heavy load. Check sysinfo after connecting.
Symptoms: Log shows "Reconnecting..." repeatedly every few seconds.
Causes & Fixes:
1. Unstable network โ Check wireless signal strength. Consider using a dedicated ground-station radio instead of WiFi.
2. Heartbeat too aggressive โ If the heartbeat command itself causes timeouts, increase heartbeat_interval:
python
client = LLUAVClient(..., heartbeat_interval=15.0)
3. Server crashed โ The drone firmware may have restarted. Verify via ping.
Symptoms: Every command returns ret=-1, msg="Login first!".
Fix: Provide the password in the constructor or call login() explicitly after connecting:
client = LLUAVClient("192.168.1.100", password="your_password")
client.connect() # auto-login happens here
Symptoms: LLUAVCommandError: Command timeout.
Causes & Fixes:
1. Command blocked by server โ Some commands (e.g., savemap, preflight_check) can take several seconds. Increase the per-command timeout:
python
client.save_map("/big_map", timeout=60.0)
2. Queue congestion โ If many periodic tasks are registered with short intervals, the queue may grow faster than the drone can process. Reduce task frequency or remove unnecessary tasks.
3. Server busy โ Check get_statics() for high CPU load or communication latency.
Symptoms: Command fails after 3 retries.
Causes & Fixes:
1. Connection drops mid-flight โ The command was sent but the response was lost. The SDK retries automatically. If this happens frequently, check network stability.
2. Command rejected by server โ If the server consistently returns ret != 0, the SDK does not retry (only network failures trigger retry). Check the error message.
3. Too few retries โ Increase max_retries:
python
client = LLUAVClient(..., max_retries=5)
Symptoms: Memory usage increases over time; commands take longer and longer to complete.
Causes & Fixes:
1. Periodic tasks too frequent โ Tasks are enqueued faster than the drone can respond. Increase interval or remove tasks.
2. Blocking the caller โ In the sync Python client, calling send_cmd(block=True) from a tight loop without consuming the response can back up if the caller thread is slower than the queue drain. Use block=False and check the Future status.
Symptoms: Command returns ret=-1 with this message.
Explanation: The drone firmware blocks certain commands while the motors are armed. This is a safety feature.
Affected commands: reboot_node, set_maplocate, set_mappath, disarm (actually allowed), savemap, etc. See the runOnArm column in the firmware command table.
Fix: Only send these commands when disarmed, or use land() / rtl() first, then wait for disarm.
Symptoms: Command rejected with this message.
Explanation: The server is in admin lock mode. Only commands marked runInLock=true are allowed for non-admin users.
Fix: Log in with admin password ("1025") and call admin_unlock().
ImportError: websocket-client is requiredFix:
pip install websocket-client
# For async support:
pip install websockets
RuntimeError: Event loop is closedCause: Creating an LLUAVAsyncClient after the event loop has already been closed.
Fix: Ensure asyncio.run() or equivalent is active before calling connect().
websocketpp not foundFix (Ubuntu/Debian):
sudo apt install libwebsocketpp-dev nlohmann-json3-dev
pthreadFix: Ensure CMake links Threads::Threads (already included in provided CMakeLists.txt).
WebSocket implementation not foundFix:
npm install ws
WebSocket connection failedCause: Browsers enforce same-origin and mixed-content policies. Connecting to ws:// from an https:// page may be blocked.
Fix: Serve the page over http:// or configure the drone with a TLS terminator for wss://.
python
client = LLUAVClient(..., heartbeat_interval=0)python
client = LLUAVClient(..., timeout=3.0)python
client = LLUAVClient(
...,
timeout=30.0,
reconnect_interval=5.0,
max_reconnect_interval=120.0,
)Python:
import logging
logging.basicConfig(level=logging.DEBUG)
C++: Rebuild with DCMAKE_BUILD_TYPE=Debug and add print statements in the callback handlers.
JavaScript:
// Patch _processQueue to log
const orig = client._processQueue.bind(client);
client._processQueue = function() {
console.log("Queue length:", client._queue.length);
return orig();
};
Use a WebSocket proxy or packet capture:
# Using wscat for manual inspection
npm install -g wscat
wscat -c ws://192.168.1.100:53001
> login your_password
> state