見た目#

ペン#

pen.move#

pen.move(action) メソッドは、VR ペンの位置を設定するために使用されます。

これは待機しない方法であり、後続のメソッドが遅延なく実行されることを可能にします。

パラメータ

説明

action

VRペンの設定位置は 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) メソッドは、VR ペンの色を設定するために使用されます。

これは待機しない方法であり、後続のメソッドが遅延なく実行されることを可能にします。

パラメータ

説明

color

The color of the VR Pen: BLACK, RED, GREEN, or 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) メソッドは、VR ペンの幅を設定するために使用されます。

これは待機しない方法であり、後続のメソッドが遅延なく実行されることを可能にします。

パラメータ

説明

width

VRペンの幅: EXTRA_THIN THIN MEDIUM WIDE、または EXTRA-WIDE。

返品: なし。

VRペンのデフォルトの幅は 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) メソッドは、VR ペンの色の RGB 値を設定するために使用されます。

これは待機しない方法であり、後続のメソッドが遅延なく実行されることを可能にします。

パラメータ

説明

red

RGB値における赤色の強度を表し、0から255までの範囲をとります。

green

RGB値における緑色の強度。0から255までの範囲で表されます。

blue

RGB値における青色の強度。0から255までの範囲で表されます。

opacity

VRペンの色の透明度を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) メソッドは、VRペンが置かれている形状を塗りつぶします。例:

​VRロボットは小さなグリッド状の枠が並んだ表面に設置されており、ロボットの背後には青色のグリッド線が1本表示されている。

​VRプレイグラウンドの一角。角のグリッド状のマス目が青色で塗りつぶされており、その隣のマス目にVRロボットが配置されている。

​青い床の上に置かれたVRロボット。

グリッド線

グリッドスクエア

格子状のレイアウトがない遊び場では、遊び場の床面全体を覆う。

これは待機しない方法であり、後続のメソッドが遅延なく実行されることを可能にします。

パラメータ

説明

red

RGB値における赤色の強度を表し、0から255までの範囲をとります。

green

RGB値における緑色の強度。0から255までの範囲で表されます。

blue

RGB値における青色の強度。0から255までの範囲で表されます。

opacity

VRペンの色の透明度を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

The color of the text to be printed: BLACK, RED, GREEN, or BLUE. By default, the color is 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")