<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How can I use MAVLINK to obtain odometry values]]></title><description><![CDATA[<p dir="auto">I already have the code working with a SITL but I want to be able to connect my laptop to the drone and obtain the data, im able to connect through QGC but not through the code</p>
<pre><code>from pymavlink import mavutil
import asyncio

async def run():
    while True:
        # Start a connection listening on a UDP port
        the_connection = mavutil.mavlink_connection('udpin:localhost:14550')

        # Wait for the first heartbeat 
        #   This sets the system and component ID of remote system for the link
        the_connection.wait_heartbeat()
        print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component))
        asyncio.sleep(2)
        # Once connected, use 'the_connection' to get and send messages
        msg = the_connection.recv_match(type ='ODOMETRY',blocking=True)
        msg = str(msg)
        msg = msg.split(',')
        print(msg[17])
        #print(msg)
        asyncio.sleep(2)
if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())

</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1687812429866-screenshot-from-2023-06-26-14-46-59.png" alt="Screenshot from 2023-06-26 14-46-59.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1687812455360-screenshot-from-2023-06-26-14-47-27.png" alt="Screenshot from 2023-06-26 14-47-27.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1687812489566-screenshot-from-2023-06-26-14-47-45.png" alt="Screenshot from 2023-06-26 14-47-45.png" class=" img-fluid img-markdown" /> <img src="/assets/uploads/files/1687812494280-screenshot-from-2023-06-26-14-47-56.png" alt="Screenshot from 2023-06-26 14-47-56.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.modalai.com/topic/2333/how-can-i-use-mavlink-to-obtain-odometry-values</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 13:51:58 GMT</lastBuildDate><atom:link href="https://forum.modalai.com/topic/2333.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Jun 2023 20:48:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How can I use MAVLINK to obtain odometry values on Mon, 10 Jul 2023 19:58:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.modalai.com/uid/4">@tom</a>  <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.modalai.com/uid/3">@Chad-Sweet</a></p>
]]></description><link>https://forum.modalai.com/post/11094</link><guid isPermaLink="true">https://forum.modalai.com/post/11094</guid><dc:creator><![CDATA[José Quintanilla]]></dc:creator><pubDate>Mon, 10 Jul 2023 19:58:44 GMT</pubDate></item></channel></rss>