Skip to main content

7.1 Quadcopter Asoslari — Masalalar

Jami: 25 ta | Yechim bilan: āœ…


Asosiy Masalalar (1-10)​

Masala 1 ⭐⭐​

Quadcopter massasi 2 kg. Hovering uchun har bir motorning thrust kuchi?

Yechim

Ttotal=mg=2Ɨ10=20T_{total} = mg = 2 \times 10 = 20 N

Tmotor=Ttotal4=204=5T_{motor} = \frac{T_{total}}{4} = \frac{20}{4} = 5 N


Masala 2 ⭐⭐​

Motor: kT=1.5Ɨ10āˆ’7k_T = 1.5 \times 10^{-7} N/(rad/s)². Hovering uchun motor RPM? (m = 2 kg)

Yechim

Tmotor=5T_{motor} = 5 N

ω2=TkT=51.5Ɨ10āˆ’7=3.33Ɨ107\omega^2 = \frac{T}{k_T} = \frac{5}{1.5 \times 10^{-7}} = 3.33 \times 10^7

ω=5774\omega = 5774 rad/s

RPM=ω×602Ļ€=5774Ɨ606.28=55130RPM = \frac{\omega \times 60}{2\pi} = \frac{5774 \times 60}{6.28} = 55130 RPM


Masala 3 ⭐⭐​

3S LiPo batareya (11.1V, 5000mAh). Hovering quvvati 150W. Uchish vaqti?

Yechim

Energiya: E=11.1Ɨ5=55.5E = 11.1 \times 5 = 55.5 Wh

Vaqt: t=EP=55.5150=0.37t = \frac{E}{P} = \frac{55.5}{150} = 0.37 h = 22 daqiqa

(Real: 80% efficiency → ~18 min)


Masala 4 ⭐⭐​

Roll burchagi 10°. Horizontal tezlanish? (m = 2 kg, hovering thrust)

Yechim

Horizontal kuch: Fx=Tsin⁔θ=20Ɨsin⁔10°=20Ɨ0.174=3.47F_x = T \sin\theta = 20 \times \sin 10° = 20 \times 0.174 = 3.47 N

Tezlanish: a=Fxm=3.472=1.74a = \frac{F_x}{m} = \frac{3.47}{2} = 1.74 m/s²


Masala 5 ⭐⭐​

Propeller: diametr 10", pitch 4.5". Static thrust taxmini? (Formula: Tā‰ˆD3.5ƗpitchƗRPM21012T \approx \frac{D^{3.5} \times pitch \times RPM^2}{10^{12}} g)

Yechim

D = 10", pitch = 4.5", RPM = 10000 deb faraz qilsak:

Tā‰ˆ103.5Ɨ4.5Ɨ1000021012T \approx \frac{10^{3.5} \times 4.5 \times 10000^2}{10^{12}}

=3162Ɨ4.5Ɨ1081012=1.42Ɨ1012/1012=1423= \frac{3162 \times 4.5 \times 10^8}{10^{12}} = 1.42 \times 10^{12} / 10^{12} = 1423 g ā‰ˆ 1.4 kg = 14 N


Masala 6 ⭐⭐​

Roll moment kerak: τϕ=0.5\tau_\phi = 0.5 Nm. Motor arm L = 0.2 m. Thrust farqi?

Yechim

τϕ=LĆ—Ī”TƗ2\tau_\phi = L \times \Delta T \times 2 (2 ta motor har tomonda)

Ī”T=τϕ2L=0.50.4=1.25\Delta T = \frac{\tau_\phi}{2L} = \frac{0.5}{0.4} = 1.25 N

Motor 1,4 va 2,3 orasidagi farq.


Masala 7 ⭐⭐​

Barometer: dengiz sathida Pā‚€ = 101325 Pa. 100 m balandlikda bosim?

Yechim

Taxminiy formula: Ī”Pā‰ˆĻgh=1.2Ɨ10Ɨ100=1200\Delta P \approx \rho g h = 1.2 \times 10 \times 100 = 1200 Pa

P=P0āˆ’Ī”P=101325āˆ’1200=100125P = P_0 - \Delta P = 101325 - 1200 = 100125 Pa

(1 hPa ā‰ˆ 8.4 m)


Masala 8 ⭐⭐​

GPS: 5 Hz update, 1 m accuracy. 10 m/s tezlikda pozitsiya xatosi?

Yechim

Update interval: Δt=0.2\Delta t = 0.2 s

Xato: 1 m + harakat = 1 + 10 Ɨ 0.2 = 3 m (worst case)

Shuning uchun IMU fusion kerak!


Masala 9 ⭐⭐​

Accelerometer: 0.5g kuch o'lchadi. Dron qaysi burchakda (hovering)?

Yechim

Hoverda accelerometer faqat g ni o'lchaydi (vertikal).

0.5g o'lchash — bu egilish burchagi:

θ=arcsin⁔(0.5)=30°\theta = \arcsin(0.5) = 30°


Masala 10 ⭐⭐​

Gyroscope drift: 0.01°/s. 1 daqiqada qancha drift?

Yechim

drift=0.01Ɨ60=0.6°drift = 0.01 \times 60 = 0.6° per minute

10 daqiqada: 6° — sezilarlı xato!


O'rtacha Masalalar (11-18)​

Masala 11 ⭐⭐⭐​

Attitude controller: Roll error 5°, Kp=5K_p = 5, Kd=0.5K_d = 0.5. Roll rate 2°/s. PD chiqishi?

Yechim

eĻ•=5°e_\phi = 5°, ϕ˙=2°/s\dot{\phi} = 2°/s (error rate = āˆ’Ļ•Ė™-\dot{\phi} if trying to reduce)

u=Kpeāˆ’Kdϕ˙=5Ɨ5āˆ’0.5Ɨ2=25āˆ’1=24u = K_p e - K_d \dot{\phi} = 5 \times 5 - 0.5 \times 2 = 25 - 1 = 24

(Birlik: moment yoki rate command)


Masala 12 ⭐⭐⭐​

Mixer: T = 22N, τϕ\tau_\phi = 0.5 Nm, τθ\tau_\theta = 0, Ļ„Ļˆ\tau_\psi = 0.1 Nm. Motor thrustlari?

Yechim
import numpy as np

# Parameters
L = 0.2 # arm length
kT = 1.5e-7
kQ = 1e-8

# Simplified mixer (X configuration)
# T1 + T2 + T3 + T4 = T
# L(-T1 + T2 + T3 - T4) = tau_phi
# L(T1 + T2 - T3 - T4) = tau_theta
# (T1 - T2 + T3 - T4) * kQ/kT = tau_psi

T = 22
tau_phi = 0.5
tau_theta = 0
tau_psi = 0.1

# Solve (simplified, ignoring drag moment)
T1 = T/4 - tau_phi/(4*L) + tau_theta/(4*L) + tau_psi*kT/(4*kQ)
T2 = T/4 + tau_phi/(4*L) + tau_theta/(4*L) - tau_psi*kT/(4*kQ)
T3 = T/4 + tau_phi/(4*L) - tau_theta/(4*L) + tau_psi*kT/(4*kQ)
T4 = T/4 - tau_phi/(4*L) - tau_theta/(4*L) - tau_psi*kT/(4*kQ)

print(f"T1 = {T1:.2f} N") # ~4.9
print(f"T2 = {T2:.2f} N") # ~6.1
print(f"T3 = {T3:.2f} N") # ~6.1
print(f"T4 = {T4:.2f} N") # ~4.9

Masala 13 ⭐⭐⭐​

Complementary filter: α=0.98\alpha = 0.98. Gyro = 45°, Accel = 44.5°. Filtered angle?

Yechim

Īøfilt=α×θgyro+(1āˆ’Ī±)Ć—Īøaccel\theta_{filt} = \alpha \times \theta_{gyro} + (1-\alpha) \times \theta_{accel}

=0.98Ɨ45+0.02Ɨ44.5=44.1+0.89=44.99°= 0.98 \times 45 + 0.02 \times 44.5 = 44.1 + 0.89 = 44.99°

Gyro dominant — high frequency movements.


Masala 14 ⭐⭐⭐​

Thrust-to-weight ratio (TWR) = 2. Maksimal vertikal tezlanish?

Yechim

TWR=Tmaxmg=2TWR = \frac{T_{max}}{mg} = 2

Tmax=2mgT_{max} = 2mg

amax=Tmaxāˆ’mgm=2mgāˆ’mgm=g=10a_{max} = \frac{T_{max} - mg}{m} = \frac{2mg - mg}{m} = g = 10 m/s²

Pastga ham: adown=0āˆ’mgm=āˆ’ga_{down} = \frac{0 - mg}{m} = -g (erkin tushish)


Masala 15 ⭐⭐⭐​

Position hold: GPS pozitsiya error = 2m (sharq). Kerakli roll burchak? (Kp=0.5K_p = 0.5 1/m)

Yechim

Ļ•cmd=KpƗey=0.5Ɨ2=1\phi_{cmd} = K_p \times e_y = 0.5 \times 2 = 1 rad?

Yo'q, bu juda katta. Real systemda:

Ļ•cmd=KpƗey=0.1Ɨ2=0.2\phi_{cmd} = K_p \times e_y = 0.1 \times 2 = 0.2 rad = 11.5°

(Saturatsiya bilan ~15° max)


Masala 16 ⭐⭐⭐​

Motor inertia: Imotor=5Ɨ10āˆ’6I_{motor} = 5 \times 10^{-6} kgĀ·m². 0 dan 10000 RPM ga 50ms da. Kerakli moment?

Yechim

ωf=10000Ɨ2Ļ€60=1047\omega_f = 10000 \times \frac{2\pi}{60} = 1047 rad/s

α=ωfāˆ’0t=10470.05=20940\alpha = \frac{\omega_f - 0}{t} = \frac{1047}{0.05} = 20940 rad/s²

Ļ„=Iα=5Ɨ10āˆ’6Ɨ20940=0.105\tau = I \alpha = 5 \times 10^{-6} \times 20940 = 0.105 Nm


Masala 17 ⭐⭐⭐​

Yaw control: 4 ta motor, ikki juft CW/CCW. Yaw tezligi 30°/s kerak. Izz=0.05I_{zz} = 0.05 kg·m². Moment?

Yechim

Agar barqaror yaw rate kerak (tezlanishsiz), Ļ„=0\tau = 0 (ideally).

Lekin 0 dan 30°/s ga 0.5s da:

ĻˆĖ™=30Ć—Ļ€/180=0.524\dot{\psi} = 30 \times \pi/180 = 0.524 rad/s

ψ¨=0.524/0.5=1.05\ddot{\psi} = 0.524 / 0.5 = 1.05 rad/s²

Ļ„Ļˆ=IzzĆ—ĻˆĀØ=0.05Ɨ1.05=0.052\tau_\psi = I_{zz} \times \ddot{\psi} = 0.05 \times 1.05 = 0.052 Nm


Masala 18 ⭐⭐⭐​

ESC protocol: PWM 1000-2000μs. 50% throttle = ?

Yechim

PWM range: 1000μs (0%) - 2000μs (100%)

50%: 1000+0.5Ɨ(2000āˆ’1000)=15001000 + 0.5 \times (2000 - 1000) = 1500 μs

Dshot/OneShot — raqamli, PWM emas.


Murakkab Masalalar (19-25)​

Masala 19 ⭐⭐⭐⭐​

Altitude controller: Setpoint 10m, actual 8m, vertical speed -0.5m/s. PID output? (Kp=5,Ki=1,Kd=3K_p=5, K_i=1, K_d=3, dt=0.01, integral=2)

Yechim
# Error
e = 10 - 8 = 2 # m

# P
P = 5 * 2 = 10

# I (assuming integral already has some value)
I = 1 * (2 + 2*0.01) = 2.02 # approximately

# D (derivative of error = -velocity)
D = 3 * (-(-0.5)) = 3 * 0.5 = 1.5

# Total
u = P + I + D = 10 + 2 + 1.5 = 13.5

# This is thrust adjustment (N or %)

Thrust += 13.5 (gravity compensation ustiga)


Masala 20 ⭐⭐⭐⭐​

Quadcopter simulyatsiya: 1 sekund hovering keyin roll 10°. Trajectory?

Yechim
import numpy as np

def simulate_quadcopter(duration=5, dt=0.01):
m = 2 # kg
g = 10

# State: [x, y, z, vx, vy, vz, phi, theta, psi]
state = np.zeros(9)
state[2] = 10 # Start at 10m

t = 0
trajectory = []

while t < duration:
x, y, z, vx, vy, vz, phi, theta, psi = state

# Control
if t < 1:
T = m * g # Hover
phi_cmd = 0
else:
T = m * g / np.cos(np.radians(10)) # Compensate
phi_cmd = np.radians(10)

# Simple dynamics
phi = phi_cmd # Instant attitude (simplified)

ax = T * np.sin(phi) / m
ay = 0
az = T * np.cos(phi) / m - g

# Update
vx += ax * dt
vy += ay * dt
vz += az * dt
x += vx * dt
y += vy * dt
z += vz * dt

state = np.array([x, y, z, vx, vy, vz, phi, theta, psi])
trajectory.append([t, x, y, z])

t += dt

return np.array(trajectory)

traj = simulate_quadcopter()
print(f"Final position: x={traj[-1,1]:.2f}m, z={traj[-1,3]:.2f}m")

Masala 21 ⭐⭐⭐⭐​

Sensor fusion: Kalman filter for altitude (barometer + accelerometer).

Yechim
class AltitudeKalman:
def __init__(self):
# State: [altitude, vertical_velocity]
self.x = np.array([0.0, 0.0])

# Covariance
self.P = np.eye(2) * 100

# Process noise
self.Q = np.array([[0.01, 0], [0, 0.1]])

# Measurement noise
self.R_baro = 0.5 # m²
self.R_accel = 0.1 # (m/s²)²

def predict(self, accel, dt):
# State transition
F = np.array([[1, dt], [0, 1]])
B = np.array([0.5*dt**2, dt])

self.x = F @ self.x + B * accel
self.P = F @ self.P @ F.T + self.Q

def update_baro(self, z_baro):
H = np.array([[1, 0]])
y = z_baro - H @ self.x
S = H @ self.P @ H.T + self.R_baro
K = self.P @ H.T / S

self.x = self.x + K.flatten() * y
self.P = (np.eye(2) - np.outer(K, H)) @ self.P

def get_state(self):
return self.x[0], self.x[1]

# Usage
kf = AltitudeKalman()
kf.predict(accel=0.5, dt=0.01)
kf.update_baro(z_baro=10.2)
alt, vel = kf.get_state()

Masala 22 ⭐⭐⭐⭐​

Waypoint navigation: 3 ta waypoint, ETA hisoblash.

Yechim
import numpy as np

def navigate_waypoints(waypoints, max_speed=5, current_pos=np.array([0,0,0])):
total_distance = 0
pos = current_pos.copy()

for wp in waypoints:
wp = np.array(wp)
distance = np.linalg.norm(wp - pos)
total_distance += distance
pos = wp
print(f"To {wp}: {distance:.1f}m")

eta = total_distance / max_speed
print(f"\nTotal: {total_distance:.1f}m, ETA: {eta:.1f}s")
return eta

waypoints = [
[10, 0, 5],
[10, 10, 10],
[0, 10, 5]
]

navigate_waypoints(waypoints)

Masala 23 ⭐⭐⭐⭐​

Battery estimation: Current draw vs remaining capacity.

Yechim
class BatteryEstimator:
def __init__(self, capacity_mah=5000, voltage=11.1):
self.capacity = capacity_mah
self.remaining = capacity_mah
self.voltage = voltage

def update(self, current_a, dt_s):
# mAh consumed
consumed = current_a * 1000 * (dt_s / 3600)
self.remaining -= consumed

# Voltage drop model (simplified)
self.voltage = 12.6 - (1 - self.remaining/self.capacity) * 3.6

return self.remaining, self.voltage

def time_remaining(self, current_a):
return (self.remaining / 1000) / current_a * 3600 # seconds

def percent(self):
return (self.remaining / self.capacity) * 100

# Simulation
bat = BatteryEstimator(5000, 12.6)
current = 15 # Amps

for t in range(0, 1200, 60): # 20 minutes
remaining, voltage = bat.update(current, 60)
print(f"t={t//60}min: {bat.percent():.1f}%, {voltage:.2f}V, "
f"remaining: {bat.time_remaining(current)/60:.1f}min")

Masala 24 ⭐⭐⭐⭐​

Geofence: Doira ichida yoki tashqarisini aniqlash.

Yechim
import numpy as np

class Geofence:
def __init__(self, center, radius, max_altitude=100):
self.center = np.array(center)
self.radius = radius
self.max_alt = max_altitude

def check(self, position):
pos = np.array(position)

# Horizontal distance
h_dist = np.linalg.norm(pos[:2] - self.center[:2])

violations = []

if h_dist > self.radius:
violations.append(f"RADIUS: {h_dist:.1f}m > {self.radius}m")

if pos[2] > self.max_alt:
violations.append(f"ALTITUDE: {pos[2]:.1f}m > {self.max_alt}m")

if pos[2] < 0:
violations.append(f"BELOW GROUND: {pos[2]:.1f}m")

return len(violations) == 0, violations

def clamp(self, position):
"""Return safe position"""
pos = np.array(position)

# Clamp horizontal
h_vec = pos[:2] - self.center[:2]
h_dist = np.linalg.norm(h_vec)
if h_dist > self.radius:
h_vec = h_vec / h_dist * self.radius
pos[:2] = self.center[:2] + h_vec

# Clamp vertical
pos[2] = np.clip(pos[2], 0, self.max_alt)

return pos

# Test
fence = Geofence([0, 0, 0], radius=50, max_altitude=100)

test_positions = [
[30, 40, 50], # Inside
[60, 0, 50], # Outside radius
[0, 0, 120], # Too high
]

for pos in test_positions:
ok, violations = fence.check(pos)
print(f"{pos}: {'OK' if ok else violations}")

Masala 25 ⭐⭐⭐⭐​

Auto-land: Vertikal tezlikni cheklash bilan qo'nish.

Yechim
def auto_land_controller(altitude, velocity, target_velocity=-0.5):
"""
Safe landing controller

target_velocity: desired descent rate (negative = down)
"""
Kp = 5
Kd = 2

# Near ground - slow down
if altitude < 2:
target_velocity = -0.2
if altitude < 0.5:
target_velocity = -0.1

# Velocity error
vel_error = target_velocity - velocity

# Control (simplified)
# Negative = reduce thrust, positive = increase
thrust_adjust = Kp * vel_error

# Safety limits
thrust_adjust = np.clip(thrust_adjust, -5, 5)

return thrust_adjust, target_velocity

# Simulation
altitude = 10
velocity = 0
g = 10
m = 2
dt = 0.01

print("Auto-landing simulation:")
for i in range(2000):
adj, target = auto_land_controller(altitude, velocity)

# Base hover thrust + adjustment
thrust = m * g + adj

# Dynamics
accel = thrust/m - g
velocity += accel * dt
altitude += velocity * dt

if i % 100 == 0:
print(f"t={i*dt:.2f}s: alt={altitude:.2f}m, vel={velocity:.2f}m/s")

if altitude <= 0:
print(f"LANDED at t={i*dt:.2f}s, impact vel={velocity:.2f}m/s")
break

āœ… Tekshirish Ro'yxati​

  • 1-10: Asosiy hovering va thrust
  • 11-18: Kontrol va sensorlar
  • 19-25: Murakkab flight control

Keyingi Qadam​

šŸ”¬ Amaliyot — Dron simulyatsiyasi!