المظهر#

قلم#

pen.move#

يتم استخدام طريقة pen.move(action) لضبط موضع قلم الواقع الافتراضي.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

action

ضبط موضع قلم الواقع الافتراضي على UP أو DOWN.

المرتجعات: لا يوجد.

  • UP - لن يرسم القلم خطاً في الملعب.

  • DOWN - سيرسم القلم خطًا ملونًا على الملعب.

def main():
    # Position the VR Pen down.
    pen.move(DOWN)
    # Move forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_color#

يتم استخدام طريقة pen.set_pen_color(color) لتعيين لون قلم الواقع الافتراضي.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

color

لون قلم الواقع الافتراضي: BLACK، RED، GREEN، أو BLUE.

المرتجعات: لا يوجد.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the VR Pen color to blue.
    pen.set_pen_color(BLUE)
    # Drive forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_width#

يتم استخدام طريقة pen.set_pen_width(width) لضبط عرض قلم الواقع الافتراضي.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

width

عرض قلم الواقع الافتراضي: EXTRA_THIN، THIN، MEDIUM، WIDE، أو EXTRA-WIDE.

المرتجعات: لا يوجد.

عرض قلم الواقع الافتراضي هو THIN.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the VR Pen's width to medium.
    pen.set_pen_width(MEDIUM)
    # Drive forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_color_rgb#

يتم استخدام طريقة pen.set_pen_color_rgb(red, green, blue, opacity) لتعيين قيمة RGB للون قلم الواقع الافتراضي.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

red

شدة اللون الأحمر في قيمة RGB، والتي تتراوح من 0 إلى 255.

green

شدة اللون الأخضر في قيمة RGB، والتي تتراوح من 0 إلى 255.

blue

شدة اللون الأزرق في قيمة RGB، والتي تتراوح من 0 إلى 255.

opacity

تتراوح شفافية لون قلم الواقع الافتراضي من 0 إلى 100 بالمائة.

المرتجعات: لا يوجد.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the color to orange at full opacity.
    pen.set_pen_color_rgb(225, 112, 52, 100)
    # Drive forward for 400 MM to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.fill#

تقوم الدالة pen.fill(red, green, blue, opacity) بتعبئة شكل أي شيء يوجد عليه قلم الواقع الافتراضي، على سبيل المثال:

​يجلس الروبوت الواقع الافتراضي على سطح به مربعات شبكية صغيرة، ويظهر خط شبكي واحد باللون الأزرق خلف الروبوت.

​زاوية من ملعب الواقع الافتراضي، تظهر مربع الشبكة الزاوية مملوءًا باللون الأزرق، مع وجود روبوت الواقع الافتراضي في المربع المجاور له.

​روبوت واقع افتراضي موضوع فوق أرضية زرقاء صلبة.

خطوط الشبكة

مربع الشبكة

في الملاعب التي لا تحتوي على شبكة، فإنها تملأ أرضية الملعب بأكملها.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

red

شدة اللون الأحمر في قيمة RGB، والتي تتراوح من 0 إلى 255.

green

شدة اللون الأخضر في قيمة RGB، والتي تتراوح من 0 إلى 255.

blue

شدة اللون الأزرق في قيمة RGB، والتي تتراوح من 0 إلى 255.

opacity

تتراوح شفافية لون قلم الواقع الافتراضي من 0 إلى 100 بالمائة.

المرتجعات: لا يوجد.

def main():
    # Fill the playground's floor with blue at full opacity.
    pen.fill(43, 162, 202, 100)

مطبعة#

brain.print#

يتم استخدام طريقة brain.print(value, precision = 0) لطباعة الكلمات والأرقام والقيم المبلغ عنها إلى وحدة التحكم في الطباعة.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

value

أي كلمات أو أرقام أو بيانات من أجهزة الاستشعار تُبلغ عن قيمة. يجب وضع الكلمات بين علامتي اقتباس: ”.

precision

اختياري. عدد المنازل العشرية المُبلغ عنها من قيمة مُستشعر أو مُتغير، من precision = 0-precision = 9دقة الطباعة الافتراضية هي 0.

المرتجعات: لا يوجد.

def main():
    # Print the Drivetrain's current heading in degrees with 2 decimal points.
    brain.print("Drivetrain's heading:",
        drivetrain.heading(DEGREES), precision = 2)

brain.clear#

يتم استخدام طريقة brain.clear() لمسح جميع الصفوف في وحدة التحكم بالطباعة وإعادة تعيين المؤشر إلى السطر الأول.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

المرتجعات: لا يوجد.

def main():
    # Print "Project has started."
    brain.print("Project has started.")
    # Wait 3 seconds.
    wait(3, SECONDS)
    # Clear the print console.
    brain.clear()

brain.new_line#

يتم استخدام طريقة brain.new_line() لتعيين المؤشر إلى سطر جديد في وحدة التحكم بالطباعة.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

المرتجعات: لا يوجد.

def main():
    # Print "Project has started."
    brain.print("Project has started.")
    # Move the cursor to a new line.
    brain.new_line()

brain.set_print_color#

يتم استخدام طريقة brain.set_print_color(color) لتعيين لون النص المطبوع إلى وحدة التحكم في الطباعة.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

color

لون النص المراد طباعته: BLACK، RED، GREEN، أو BLUEاللون الافتراضي هو BLACK.

المرتجعات: لا يوجد.

def main():
    # Set the print text color to red.
    brain.set_print_color(RED)
    # Print a message.
    brain.print("This is red!")

متغير المراقبة#

يتم استخدام طريقة monitor_variable(“variable”, …) لإضافة متغيرات إلى وحدة التحكم في المراقبة بحيث يمكن رؤية قيمة المتغيرات ومراقبتها.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

variable

أي متغير عام تم تعيينه مسبقاً.

المرتجعات: لا يوجد.

# Create global variable.
disk_count = 1

def main():
    # Add disk_count to the Monitor Console.
    monitor_variable("disk_count")

مستشعر_المراقبة#

يتم استخدام طريقة monitor_sensor(“sensor”, …) لإضافة أجهزة استشعار إلى وحدة التحكم في المراقبة بحيث يمكن مراقبة قيم المستشعر.

هذه طريقة غير انتظارية وتسمح بتنفيذ أي طرق لاحقة دون تأخير.

حدود

وصف

sensor

أي مُعرّف مستشعر مدعوم.

المرتجعات: لا يوجد.

معرفات المستشعرات المدعومة:

  • brain.timer.time

  • drivetrain.is_done

  • drivetrain.is_moving

  • drivetrain.heading

  • drivetrain.rotation

  • drivetrain.velocity_rpm

  • drivetrain.velocity_percent

  • arm_motor.is_done

  • arm_motor.is_spinning

  • arm_motor.position_degrees

  • arm_motor.position_turns

  • arm_motor.velocity_rpm

  • arm_motor.velocity_percent

  • arm_motor_group.is_done

  • arm_motor_group.is_spinning

  • arm_motor_group.position_degrees

  • arm_motor_group.position_turns

  • arm_motor_group.velocity_rpm

  • arm_motor_group.velocity_percent

  • intake_motor.is_done

  • intake_motor.is_spinning

  • intake_motor.position_degrees

  • intake_motor.position_turns

  • intake_motor.velocity_rpm

  • intake_motor.velocity_percent

  • intake_motor_group.is_done

  • intake_motor_group.is_spinning

  • intake_motor_group.position_degrees

  • intake_motor_group.position_turns

  • intake_motor_group.velocity_rpm

  • intake_motor_group.velocity_percent

  • catapult_motor.is_done

  • catapult_motor.is_spinning

  • catapult_motor.position_degrees

  • catapult_motor.position_turns

  • catapult_motor.velocity_rpm

  • catapult_motor.velocity_percent

  • catapult_tension_motor.is_done

  • catapult_tension_motor.is_spinning

  • catapult_tension_motor.position_degrees

  • catapult_tension_motor.position_turns

  • catapult_tension_motor.velocity_rpm

  • catapult_tension_motor.velocity_percent

  • intake_bumper.pressing

  • bumper.pressing

  • front_distance.is_object_detected

  • front_distance.object_distance_mm

  • front_distance.object_distance_inches

  • front_optical.is_near_object

  • front_optical.color

  • front_optical.brightness

  • front_optical.hue

  • color.is_near_object

  • color.color

  • color.brightness

  • color.hue

def main():
    # Add the VR Robot's positional coordinates to the monitor console.
    monitor_sensor("location.position")