Scripts to Flight Controller

Hello, I am trying to understand how does python scripts work for PWM. I know that you have PWM code for servor, but is it possible to create some kind of object avoidance while drone is flying.
So, for example:
I need to arm drone, make him to take off, flight straight and then land (fully autonomous, without piloting or Mission Planner). So is it possible to control motors with python code while STM32 on Navio2 is making stabilization? And if it is, how can I talk to motors and set right PWM for them?

Hi @vurdlok,

You’re right that you can use Python code to generate the PWM outputs for the servo’s control. But the task of object avoidance requires not only sending the control signal but reading the sensor’s data along the flight. I believe that Dronekit will be the best tool you can choose for creating this kind of script. I can hardly be of much help with the exact code lines as we haven’t done it ourselves. But Dronekit has comprehensive documentation that should guide you through this.