Mavros or mavsdk, which one should I choose

Hello guys,
I am starting a project on machine learning with drones for landing and doing certain missions. I am quite new to using px4 and ROS2 and I am stuck on if I should choose mavros or mavsdk. Im leaning more towards mavsdk since it works well with python which is a language I prefer more and I dont need to learn ROS in order to use it. However I will be using drone GPS and battery level data and im not sure if mavsdk is capable of using them or if mavsdk works well with machine learning algorithms. Any advice would be much appreciated thanks.

Try to use the telemetry module provided by mavsdk

import asyncio
from mavsdk import System

async def run():
drone = System()
await drone.connect(system_address=“udp://:14540”)

async for battery in drone.telemetry.battery():
    print(f"Battery voltage: {battery.voltage_v:.2f} V")
    print(f"Battery percentage: {battery.remaining_percent:.2f} %")

if name == “main”:
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

1 Like

In my opinion MAVSDK is more limited than mavros but also easier to learn and use. I would recommend reading up on the API reference and decide if what MAVSDK offers is enough: http://mavsdk-python-docs.s3-website.eu-central-1.amazonaws.com/
Battery and GPS are supported.

ROS integrates very well if you have a lot of modules and sensors that need to work together.

1 Like