30 Mayıs 2026 Cumartesi

Autonomous Drone Project (On going...)


In thıs project I planned to learn Drone technology and increasıng my Autonomous programming skills.

I will work with Pixhawk's Library, because it is a standart in this field nowadays (2026). I bought my all hardware from Aliexpress because it was cheaper there. Probably they are clone but I dont know, ı didn't search well. But yeah, I need to figure out first, if all hardwares work or not. Thats why I need to run my all hardwares now quickly then after that I will check all path planning, IMU, STM cards , etc.

Here is the hardware list;









First ı download this app. Let's see if it is working or not together.

https://ardupilot.org/planner/docs/mission-planner-installation.html




All the hardware connection must be as in the picture


https://docs.px4.io/main/en/assembly/quick_start_pixhawk








Normally I bought a PDB but you no need to buy because the drone body works as a Power Distribution Board you can directl make your Battery connection and all motors power connection from there, it works well.


This is an emergency button we use this when we think the drone is ready to fly. We need to give a control clause, like if we push during two minutes that but it means we are ready to fly. You can make connection with Safety Signal connector.


This small board use for connection with your Remote controller in the beginning you must use a jumper on left side connection, when you make your first recognation connection you are ready to use the controller but of course board can understand the commands you must make left side connection the yellow color cable.



This is ESC PWM Signal Siplitter board. White cables must be on top and make your connection for each motor, you can check the rotation with Ardupilot. And if there is a wrong direction only change one cable with the other which are directly connected with the motor.



This is a signal splitter board, I also made connection for the ToF laser Ranging Sensor there.



This is ESC if you make connection wrong you will hear a buzzer noice, if there is no noice it means you made your connection correct.



https://www.youtube.com/watch?v=j3sjFCG0vjE
https://www.youtube.com/watch?v=_ketmb8u2UI

You can also watch these videos if you want to see all the steps with details.




You can take-off and landing wıth those codes ın Gazebo


code ~/PX4-Autopilot/Tools/simulation/gz/models/x500/model.sdf


<?xml version="1.0" encoding="UTF-8"?>
<sdf version='1.9'>
<model name='x500'>
<include merge='true'>
<uri>model://x500_base</uri>
</include>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_0_joint</jointName>
<linkName>rotor_0</linkName>
<turningDirection>ccw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>0</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_1_joint</jointName>
<linkName>rotor_1</linkName>
<turningDirection>ccw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>1</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_2_joint</jointName>
<linkName>rotor_2</linkName>
<turningDirection>cw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>2</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="gz-sim-multicopter-motor-model-system"
name="gz::sim::systems::MulticopterMotorModel">
<jointName>rotor_3_joint</jointName>
<linkName>rotor_3</linkName>
<turningDirection>cw</turningDirection>
<timeConstantUp>0.0125</timeConstantUp>
<timeConstantDown>0.025</timeConstantDown>
<maxRotVelocity>1000.0</maxRotVelocity>
<motorConstant>8.54858e-06</motorConstant>
<momentConstant>0.016</momentConstant>
<commandSubTopic>command/motor_speed</commandSubTopic>
<motorNumber>3</motorNumber>
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
<motorType>velocity</motorType>
</plugin>
<plugin filename="MotorFailurePlugin"
name="gz::sim::systems::MotorFailureSystem">
</plugin>


</model>
</sdf>



python3 takeoff_test.py

import asyncio
from mavsdk import System
from mavsdk.offboard import VelocityNedYaw, OffboardError

async def run():
    drone = System()
    # Using the correct connection address for SITL
    await drone.connect(system_address="udpin://127.0.0.1:14540")

    print("Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print("[SUCCESS] Connected to Pixhawk simulator!")
            break

    # Short pause for the system to settle
    await asyncio.sleep(2)

    # Arm the motors
    print("-- Arming motors...")
    try:
        await drone.action.arm()
        print("[SUCCESS] Motors are spinning!")
    except Exception as e:
        print(f"[ERROR] Arming failed: {e}")
        return

    # Autonomous Takeoff
    print("-- Taking off...")
    await drone.action.takeoff()
    
    # Wait for the drone to reach altitude and stabilize
    print("Waiting for drone to hover (8 seconds)...")
    await asyncio.sleep(8)

    # Mission completed, safe landing
    print("-- Landing...")
    await drone.action.land()
    print("Mission completed.")

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


Now I want to gıve a command for take off and after go straıght a bıt then landıng.


















































































Autonomous Drone Project (On going...)

In thıs project I planned to learn Drone technology and increasıng my Autonomous programming skills. I will work with Pixhawk's Library,...