Skip to content
  • 0 Votes
    2 Posts
    2k Views
    L
    UPDATE I've simplified my snippet and I'm now able to "connect" to the VOXL2 via MAVSDK. It's still now working as I would expect it to, but first, here's my new script: #!/usr/bin/env python3 import asyncio from mavsdk import System target_ip="192.168.1.187" target_port=14550 async def connect_to_drone(): print("Connecting to VOXL2...") # Create a System object with specific system ID and component ID # These match the IDs we're using in the heartbeat sender print("Creating System object...") drone = System() # Different connection string formats to try print("Connecting to drone...") await drone.connect(system_address=f"udp://{target_ip}:{target_port}") print("Waiting for drone to connect...") timeout = 60 # Extended timeout start_time = asyncio.get_event_loop().time() try: async for state in drone.core.connection_state(): print(f"Connection state: {state}") if state.is_connected: print(f"Connected to drone!") return drone # Check if we've timed out current_time = asyncio.get_event_loop().time() if current_time - start_time > timeout: print(f"Connection timed out after {timeout} seconds") break await asyncio.sleep(1) except Exception as e: print(f"Connection error: {e}") return None async def main(): # Try to connect to the drone drone = await connect_to_drone() # If connected, do something with the drone if drone and drone.core: try: # Print basic information info = await drone.info.get_version() print(f"Version Info: {info}") except Exception as e: print(f"Could not get info: {e}") if __name__ == "__main__": # Run the asyncio loop asyncio.run(main()) When I run this script I see only 3 logs: Connecting to VOXL2... Creating System object... Connecting to drone... When I adb shell and run voxl-inspect-mavlink mavlink_from_gcs I now see that the VOXL2 is receiving a heartbeat: ID Mavlink MSG Name Counter Hz 0 heartbeat 5 1.1 But like I mentioned above, the code doesn't execute past await drone.connect(system_address=f"udp://{target_ip}:{target_port}"). I've tried udpout and nothing changes.
  • 0 Votes
    3 Posts
    2k Views
    Jetson NanoJ
    @Zachary-Lowell-0 as mentioned I have set offboard-mode in voxl-vision-hub.conf to "off". I did a flight test shifting to offboard-mode, The drone was able to execute the script in a stable way without any jittery motions or trying to come back to home position. These are the flight logs, https://review.px4.io/plot_app?log=e32a28df-cbba-4765-8499-6fe46e2ff890