telemetry.actuator_output_status() in MAVSDK-Python is not working

17 views Asked by At

I would like to view the Actuator status of a SITL environment drone using the MAVSDK-Python library.

Here is my code.

import asyncio
from mavsdk import System

async def takeoff_and_land():
    drone = System()
    await drone.connect(system_address="udp://:14540")

    print("[*] Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print(f"-- Connected to drone!")
            break

    print("[*] Waiting for drone to have a global position estimate...")
    async for health in drone.telemetry.health():
        if health.is_global_position_ok and health.is_home_position_ok:
            print("-- Global position estimate OK")
            break

    print("[*] Arming")
    await drone.action.arm()

    task_1 = asyncio.ensure_future(print_actuator_status(drone))

    print("[*] Taking off")
    await drone.action.takeoff()
    await asyncio.sleep(10)

    print("[*] Landing")
    await drone.action.land()
    await asyncio.sleep(5)

    task_1.cancel()

async def print_actuator_status(drone):
    async for ac in drone.telemetry.actuator_output_status():
        print(ac)

if __name__ == "__main__":
    asyncio.run(takeoff_and_land())

But it's not working.

How can I view the actuator status using MAVSDK-Python? Please help me.

I just follow the example code in MAVSDK-Python github repository.

0

There are 0 answers