أجهزة الاستشعار#
مقدمة#
تتضمن طائرة VEX AIR بدون طيار مستشعرًا بالقصور الذاتي لقياس الحركة الدورانية ورصد التغيرات في الحركة، بالإضافة إلى مستشعر مدى لقياس المسافات. كما يمكن لطائرة VEX AIR بدون طيار تتبع مستوى شحن بطاريتها. وتتيح هذه المستشعرات للطائرة تتبع اتجاهها ومسارها وتسارعها ومسافتها عن الأجسام.
فيما يلي قائمة بجميع الطرق المتاحة:
القصور الذاتي - تتبع الحركة الدورانية للطائرة بدون طيار.
get_rotation– تُرجع مقدار دوران الطائرة بدون طيار منذ بدايتها.get_heading– تُرجع الاتجاه الحالي (من 0 إلى 359.99 درجة).get_yaw– تُرجع زاوية الانحراف (–180 إلى 180 درجة).get_roll– تُرجع زاوية الدوران (–180 إلى 180 درجة).get_pitch– تُرجع زاوية الميل (–180 إلى 180 درجة).reset_rotation– يعيد ضبط قيمة الدوران إلى 0.reset_heading– يضبط العنوان الحالي على 0.set_heading– يضبط العنوان على قيمة محددة.get_acceleration– تُرجع التسارع في اتجاه محدد.get_turn_rate– تُرجع معدل الدوران بالدرجات في الثانية.
المدى — اكتشاف المسافات من خلال مستشعرات المدى الخاصة بالطائرة بدون طيار.
get_distance— تُرجع المسافة بين مستشعر المدى المحدد وأقرب كائن تم اكتشافه.
البطارية - أعد عرض نسبة شحن بطارية الطائرة بدون طيار.
get_battery_level– يعيد مستوى بطارية الطائرة بدون طيار كنسبة مئوية.
القصور الذاتي#
get_rotation#
تُعيد get_rotation عدد الدرجات التي دارت بها الطائرة المسيّرة منذ بدء تشغيلها. تجمع هذه الدالة جميع الدورات وتعيد المجموع الكلي بالدرجات: قيمة موجبة للدوران مع عقارب الساعة، وقيمة سالبة للدوران عكس عقارب الساعة.
Usage:
drone.inertial.get_rotation()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the rotation after turning
drone.take_off(climb_to=500)
drone.turn_for(LEFT, 450, 50)
print(drone.inertial.get_rotation(), end="")
drone.land()
get_heading#
get_heading تُرجع زاوية اتجاه الطائرة بدون طيار كعدد عشري في النطاق من 0 إلى 359.99 درجة.
Usage:
drone.inertial.get_heading()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the drone's heading after turning
drone.take_off(climb_to=500)
drone.set_turn_velocity(100)
drone.turn(RIGHT)
wait(5, SECONDS)
controller.screen.print("Heading: ")
controller.screen.print(drone.inertial.get_heading())
drone.land()
get_yaw#
get_yaw تُرجع زاوية انحراف الطائرة بدون طيار في النطاق من -180.0 إلى 180.0 درجة كقيمة عشرية.
تستخدم الصورة أدناه سهماً لإظهار اتجاه الدوران الموجب للانحراف.

Usage:
drone.inertial.get_yaw
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the yaw angle as you rotate the drone by hand
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
controller.screen.print("Yaw: ")
controller.screen.print(drone.inertial.get_yaw())
wait(0.2, SECONDS)
get_roll#
get_roll تُرجع زاوية دوران الطائرة بدون طيار في النطاق من -180.0 إلى 180.0 درجة كقيمة عشرية.
تستخدم الصورة أدناه سهماً لإظهار اتجاه الدوران الموجب للتدحرج.

Usage:
drone.inertial.get_roll()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the roll angle as you rotate the drone by hand
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
controller.screen.print("Roll: ")
controller.screen.print(drone.inertial.get_roll())
wait(0.2, SECONDS)
get_pitch#
get_pitch تُرجع زاوية ميل الطائرة بدون طيار في النطاق من -180.0 إلى 180.0 درجة كعدد عشري.
تستخدم الصورة أدناه سهماً لإظهار اتجاه الدوران الإيجابي للكرة.

Usage:
drone.inertial.get_pitch()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the pitch angle as you rotate the drone by hand
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
controller.screen.print("Pitch: ")
controller.screen.print(drone.inertial.get_pitch())
wait(0.2, SECONDS)
reset_rotation#
reset_rotation يعيد ضبط قيمة دوران الطائرة بدون طيار إلى 0 درجة.
Usage:
drone.inertial.reset_rotation()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the new rotation after resetting
drone.take_off(climb_to=500)
drone.turn(RIGHT)
while not drone.inertial.get_rotation() > 360:
wait(5, MSEC)
drone.hover()
drone.inertial.reset_rotation()
wait(1, SECONDS)
print(drone.inertial.get_rotation(), end="")
drone.land()
reset_heading#
reset_heading يعيد ضبط اتجاه الطائرة بدون طيار إلى 0 درجة.
طريقة الاستخدام:
drone.inertial.reset_heading()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Turn to a heading, reset the heading, and turn to the same heading.
drone.take_off(climb_to=500)
drone.turn_to(heading=180, velocity=50)
wait(3,SECONDS)
drone.inertial.reset_heading()
drone.turn_to(heading=180, velocity=50)
wait(3,SECONDS)
drone.land()
set_heading#
set_heading يحدد اتجاه الطائرة بدون طيار إلى قيمة محددة بالدرجات.
طريقة الاستخدام:
drone.inertial.set_heading(heading)
حدود |
وصف |
|---|---|
|
القيمة التي سيتم استخدامها للاتجاه الجديد في النطاق من 0 إلى 359.99 درجة. |
# Turn to a heading, set the heading, and turn to the same heading.
drone.take_off(climb_to=500)
drone.turn_to(heading=180, velocity=50)
wait(3,SECONDS)
drone.inertial.set_heading(90)
drone.turn_to(heading=180, velocity=50)
wait(3,SECONDS)
drone.land()
get_acceleration#
تُعيد get_acceleration تسارع الطائرة بدون طيار في اتجاه مُحدد. تمثل القيمة المُعادة معدل تغير السرعة، مُقاسًا بوحدة g (حيث 1g ≈ 9.81 م/ث²)، كقيمة عشرية تتراوح بين -4.00 و 4.00.
تستخدم الصورة أدناه الأسهم لإظهار اتجاه التسارع الموجب للأمام ولليمين، والتسارع السالب للأسفل.

طريقة الاستخدام:
drone.inertial.get_acceleration(type)
حدود |
وصف |
|---|---|
|
اتجاه التسارع المطلوب الإبلاغ عنه:
|
# Display the acceleration as the drone takes off
drone.take_off(500, wait=False)
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
controller.screen.print(drone.inertial.get_acceleration(DOWNWARD))
wait(5, MSEC)
get_turn_rate#
تُعيد get_turn_rate معدل دوران الطائرة المسيّرة حول المحور المُحدد. تُعيد هذه الدالة قيمة بالدرجات في الثانية \(dps\) كعدد عشري يتراوح بين -1000.00 و 1000.00 dps.
تستخدم الصورة أدناه الأسهم لإظهار اتجاه الدوران الإيجابي للميلان والانحراف والانعطاف.

Usage:
drone.inertial.get_turn_rate(axis)
حدود |
وصف |
|---|---|
|
أي اتجاه يجب الإبلاغ عنه:
|
# Display the drone turn rate as it is rotated by hand.
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(7, 1)
controller.screen.print(drone.inertial.get_turn_rate(ROLL))
يتراوح#
get_distance#
get_distance تُرجع المسافة بين مستشعر المدى المحدد وأقرب جسم تم اكتشافه.
Usage:
drone.range.get_distance(range, units)
حدود |
وصف |
|---|---|
|
مستشعر المدى المطلوب استخدامه: |
|
اختياري. وحدة المسافة:
|
# Fly forward until close to an object
drone.take_off(climb_to=500)
drone.move_at(direction=0, velocity=50)
while not drone.range.get_distance(FORWARD_RANGE, MM) < 750:
wait(0.1, SECONDS)
drone.land()
بطارية#
get_battery_level#
تُعيد get_battery_level مستوى شحن بطارية الطائرة بدون طيار كنسبة مئوية. تُعيد هذه الدالة رقمًا يتراوح بين 0 و100.
Usage:
drone.get_battery_level()
حدود |
وصف |
|---|---|
لا تحتوي هذه الطريقة على أي معلمات. |
# Display the drone's battery level
if drone.get_battery_level() < 25:
controller.screen.print("Charge the drone Battery!")
else:
controller.screen.print("Ready to fly!")