Esempio n. 1
0
    def __init__(self):
        self.brain = Brain()

        self.left_motor = \
            Motor(
                self.LEFT_MOTOR_PORT,   # index
                self.LEFT_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.right_motor = \
            Motor(
                self.RIGHT_MOTOR_PORT,   # index
                self.RIGHT_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.drivetrain = \
            Drivetrain(
                self.left_motor,   # left_motor
                self.right_motor,   # right_motor
                self.WHEEL_TRAVEL,   # wheel_travel
                self.TRACK_WIDTH,   # track_width
                self.DISTANCE_UNIT,   # distanceUnit
                self.GEAR_RATIO   # gear_ratio
            )

        self.arm_motor = \
            Motor(
                self.ARM_MOTOR_PORT,   # index
                self.ARM_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )

        self.claw_motor = \
            Motor(
                self.CLAW_MOTOR_PORT,   # index
                self.CLAW_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.claw_motor.set_timeout(
            self.CLAW_MOTOR_TIMEOUT_SECS,  # time
            TimeUnits.SEC  # timeUnit
        )

        self.touch_led = Touchled(self.TOUCH_LED_PORT)

        self.color_sensor = \
            Colorsensor(
                self.COLOR_SENSOR_PORT,   # index
                False,   # is_grayscale
                700   # proximity
            )

        self.gyro_sensor = \
            Gyro(
                self.GYRO_SENSOR_PORT,   # index
                True   # calibrate
            )

        self.distance_sensor = Sonar(self.DISTANCE_SENSOR_PORT)

        self.bumper_switch = Bumper(self.BUMPER_SWITCH_PORT)

        self.controller = Controller()
        self.controller.set_deadband(self.CONTROLLER_DEADBAND)
Esempio n. 2
0
    def __init__(self):
        self.brain = Brain()

        self.left_motor = \
            Motor(
                self.LEFT_MOTOR_PORT,   # index
                self.LEFT_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.right_motor = \
            Motor(
                self.RIGHT_MOTOR_PORT,   # index
                self.RIGHT_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.drivetrain = \
            Drivetrain(
                self.left_motor,   # left_motor
                self.right_motor,   # right_motor
                self.WHEEL_TRAVEL,   # wheel_travel
                self.TRACK_WIDTH,   # track_width
                self.DISTANCE_UNIT,   # distanceUnit
                self.GEAR_RATIO   # gear_ratio
            )

        self.controller = Controller()
        self.controller.set_deadband(self.CONTROLLER_DEADBAND)
Esempio n. 3
0
    def __init__(self):
        self.brain = Brain()

        self.drivetrain = \
            Drivetrain(
                Motor(
                    self.LEFT_MOTOR_PORT,   # index
                    self.LEFT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # left_motor
                Motor(
                    self.RIGHT_MOTOR_PORT,   # index
                    self.RIGHT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # right_motor
                self.WHEEL_TRAVEL,   # wheel_travel
                self.TRACK_WIDTH,   # track_width
                self.DISTANCE_UNIT,   # distanceUnit
                self.GEAR_RATIO   # gear_ratio
            )

        self.touch_led = Touchled(self.TOUCH_LED_PORT)

        self.color_sensor = \
            Colorsensor(
                self.COLOR_SENSOR_PORT,   # index
                False,   # is_grayscale
                700   # proximity
            )

        self.gyro_sensor = \
            Gyro(
                self.GYRO_SENSOR_PORT,   # index
                True   # calibrate
            )

        self.distance_sensor = Sonar(self.DISTANCE_SENSOR_PORT)
    def __init__(self):
        self.brain = Brain()

        self.drivetrain = \
            Drivetrain(
                Motor(
                    self.LEFT_MOTOR_PORT,   # index
                    self.LEFT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # left_motor
                Motor(
                    self.RIGHT_MOTOR_PORT,   # index
                    self.RIGHT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # right_motor
                self.WHEEL_TRAVEL,   # wheel_travel
                self.TRACK_WIDTH,   # track_width
                self.DISTANCE_UNIT,   # distanceUnit
                self.GEAR_RATIO   # gear_ratio
            )

        self.touch_led = Touchled(self.TOUCH_LED_PORT)

        self.arm_motor = \
            Motor(
                self.ARM_MOTOR_PORT,   # index
                self.ARM_MOTOR_REVERSE_POLARITY   # reverse
            )

        self.claw_motor = \
            Motor(
                self.CLAW_MOTOR_PORT,   # index
                self.CLAW_MOTOR_REVERSE_POLARITY   # reverse
            )
Esempio n. 5
0
    def __init__(self):
        self.brain = Brain()

        self.claw_motor = \
            Motor(
                self.CLAW_MOTOR_PORT,   # index
                self.CLAW_MOTOR_REVERSE_POLARITY   # reverse
            )
    def __init__(self):
        self.brain = Brain()

        self.arm_motor = \
            Motor(
                self.ARM_MOTOR_PORT,   # index
                self.ARM_MOTOR_REVERSE_POLARITY   # reverse
            )
Esempio n. 7
0
    def __init__(self):
        self.brain = Brain()

        self.base_pivot_motor = \
            Motor(
                self.BASE_PIVOT_MOTOR_PORT,   # index
                self.BASE_PIVOT_REVERSE_POLARITY   # reverse polarity?
            )

        self.shoulder_motor = \
            Motor(
                self.SHOULDER_MOTOR_PORT,   # index
                self.SHOULDER_REVERSE_POLARITY   # reverse polarity?
            )

        self.elbow_motor = \
            Motor(
                self.ELBOW_MOTOR_PORT,   # index
                self.ELBOW_REVERSE_POLARITY   # reverse polarity?
            )

        self.claw_motor = \
            Motor(
                self.CLAW_MOTOR_PORT,   # index
                self.CLAW_MOTOR_REVERSE_POLARITY   # reverse polarity?
            )
        self.claw_motor.set_timeout(
            self.CLAW_MOTOR_TIMEOUT_SECS,  # time
            TimeUnits.SEC  # timeUnit
        )

        self.base_bumper_switch = Bumper(self.BASE_BUMPER_SWITCH_PORT)

        self.elbow_bumper_switch = Bumper(self.ELBOW_BUMPER_SWITCH_PORT)

        self.distance_sensor = Sonar(self.DISTANCE_SENSOR_PORT)

        self.color_sensor = \
            Colorsensor(
                self.COLOR_SENSOR_PORT,   # index
                False,   # is_grayscale
                700   # proximity
            )

        self.left_touch_led = Touchled(self.LEFT_TOUCH_LED_PORT)
        self.right_touch_led = Touchled(self.RIGHT_TOUCH_LED_PORT)

        self.controller = Controller()
        self.controller.set_deadband(self.CONTROLLER_DEADBAND)
    def __init__(self):
        self.brain = Brain()

        self.arm_motor = \
            Motor(
                self.ARM_MOTOR_PORT,   # index
                self.ARM_MOTOR_REVERSE_POLARITY   # reverse
            )

        self.claw_motor = \
            Motor(
                self.CLAW_MOTOR_PORT,   # index
                self.CLAW_MOTOR_REVERSE_POLARITY   # reverse
            )

        self.control_arm_or_claw = 0
    def __init__(self):
        self.brain = Brain()

        self.drivetrain = \
            Drivetrain(
                Motor(
                    self.LEFT_MOTOR_PORT,   # index
                    self.LEFT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # left_motor
                Motor(
                    self.RIGHT_MOTOR_PORT,   # index
                    self.RIGHT_MOTOR_REVERSE_POLARITY   # reverse
                ),   # right_motor
                self.WHEEL_TRAVEL,   # wheel_travel
                self.TRACK_WIDTH,   # track_width
                self.DISTANCE_UNIT,   # distanceUnit
                self.GEAR_RATIO   # gear_ratio
            )
    Bumper,
    Colorsensor,
    Controller,
    DirectionType,
    DistanceUnits,
    Gyro,
    Motor,
    Ports,
    Sonar,
    TimeUnits,
    Touchled,
    VelocityUnits
)


BRAIN = Brain()

# Drive Base configs
LEFT_MOTOR = Motor(Ports.PORT1,   # index
                   False   # reverse polarity?
                   )
RIGHT_MOTOR = Motor(Ports.PORT6,   # index
                    True   # reverse polarity?
                    )
DRIVETRAIN = Drivetrain(LEFT_MOTOR,   # left_motor
                        RIGHT_MOTOR,   # right_motor
                        200,   # wheel_travel
                        176,   # track_width
                        DistanceUnits.MM,   # distanceUnit
                        1   # gear_ratio
                        )
Esempio n. 11
0
"""
On Robot Mesh Studio: https://www.robotmesh.com/studio/60202f736a963405b8ebe1bb
"""

# IMPORT CÁC ĐỐI TƯỢNG TỪ THƯ VIỆN
# ================================

from vex import Brain, wait

# KHỞI TẠO CÁC BỘ PHẬN ROBOT
# ==========================

# khởi tạo brain
brain = Brain()

# CHƯƠNG TRÌNH CHÍNH
# ==================

# in 'Hello World!' tại dòng số 1 của màn hình
# rồi xóa sau vài giây
brain.screen.print_line(1, 'Hello World!')
wait(3)
brain.screen.clear_screen()
Esempio n. 12
0
 def __init__(self):
     self.brain = Brain()