MAVSDK-Python: Raspberry Pi : from mavsdk : Illegal Instruction

Im starting off with mavsdk on my raspberry pi connected to a pixhawk via the UART.

the following is the code.

when i run it with “python3 simple_arm.py”

the terminal shows the output as “Illegal Instruction”

i think ive narrowed down the issue to from mavsdk import System

P.S : Does mavsdk python work on raspberry Pi model B+ (with arm6)?

import asyncio
from mavsdk import System

async def run():
    print("In run")
    drone =System()
    await drone.connect(system_address="udp://localhost:14550")
    print("Waiting to connect to drone.....")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print("Conected to drone: %s" % state.uuid)
            break

    print("Waiting for drone to have a global position estimate...")
    async for health in drone.telemetry.health():
        if health.is_global_position_ok:
            print("Global position estimate ok")
            break    
if __name__ == "__main__":
    print("In main loop")
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 37

Most upvoted comments

I’ll try your workaround, thank you @julianoes!

EDIT: It works! 🎉

Check this: https://raspberrypi.stackexchange.com/questions/108985/raspian-buster-lite-grep-fails-with-illegal-instruction

tried a different powersupply. reinstalled everything from scratch. still no luck

Ok, I can reproduce the problem on my RPi 1:

Operating System: Raspbian GNU/Linux 10 (buster) Kernel: Linux 5.10.17+ Architecture: arm

I believe the problem stems from grpcio. When I install grpcio using sudo apt-get install python3-grpcio it works. However, when I install it with pip as part of pip3 install --user mavsdk it doesn’t work and fails with Illegal Instruction.

I’ve followed up in the issues, see: https://github.com/grpc/grpc/issues/26474 https://github.com/piwheels/packages/issues/217

For now, I suggest this workaround:

pip3 uninstall grpcio
sudo apt-get install python3-grpcio

@julianoes Just to follow up

Pi Zero - Raspbian GNU/Linux Version 9 Python v3.9.5

mavsdk version - 0.18.0 also tried version 0.17.0