コード例 #1
0
def drive_back(dalek_settings, time_to_drive):
    '''
       used when testing so you dont have to keep getting up.
    '''
    debug.print_to_all_devices("Start drive back")
    drive.backward(50)
    time.sleep(time_to_drive)
    debug.print_to_all_devices("end drive back")
コード例 #2
0
ファイル: controller.py プロジェクト: Dalekbot/dalekbot
 def dpad_down_button_pressed():
     if ps3_ControllerMode == 2:  # 2 Mission Select Mode
         challenge_select(1)
     elif ps3_ControllerMode == 1:
         debug.print_to_all_devices('Backwards', "BW")
         drive.backward(dalek_settings.speed)
     else:
         head_controller.eye_move_down()
コード例 #3
0
def drive_forwards_to_distance(distance=distance_to_wall):
    # counter =0
    print("drive_forwards_to_distance()")
    while DalekSensors.front_distance != distance:
        # get the speed to drive at
        speed = CalculateSpeedToDrive(DalekSensors.front_distance, distance)
        if DalekSensors.front_distance <= distance:
            drive.backward(speed)
            print("drive_backwards()")
        else:
            drive.paddleForward(speed, speed)
    drive.stop()
コード例 #4
0
ファイル: autodrive.py プロジェクト: Dalekbot/dalekbot
def driveBackwardsToDistance(distance):

    DalekPrint("driveBackwards()")
    dalekData = spi.readDevice1Data()

    while dalekData['rearPing'] != distance:
        dalekSpeed = CalculateSpeedToDrive(dalekData['rearPing'], distance)

        if dalekData['rearPing'] <= distance:
            drive.forward(dalekSpeed)
        else:
            drive.backward(dalekSpeed)
        dalekData = spi.readDevice1Data()
コード例 #5
0
def drive_backwards_to_distance(distance=distance_to_wall):

    print("driveBackwards()")

    while DalekSensors.rear_distance != distance:
        dalekSpeed = CalculateSpeedToDrive(
            DalekSensors.rear_distance, distance)

        if DalekSensors.rear_distance <= distance:
            drive.forward(dalekSpeed)
        else:

            drive.backward(dalekSpeed)
    drive.stop()
コード例 #6
0
# GPIO.setup(pinMotorBRSpeed, GPIO.OUT)
# GPIO.setup(pinMotorBRForwards, GPIO.OUT)
# GPIO.setup(pinMotorBRBackwards, GPIO.OUT)

# pwmMotorBRSpeed = GPIO.PWM(pinMotorBRSpeed, Frequency)
# pwmMotorBRSpeed.start(Stop)

#######################
### main
#######################

while True:
    # toggle the Back right motor
    # GPIO.output(pin_motor_relay, GPIO.HIGH)
    # time.sleep(1)
    # print("on")
    # GPIO.output(pin_motor_relay, GPIO.LOW)
    # time.sleep(1)
    # print("off")
    # pwmMotorBRSpeed.ChangeDutyCycle(Speed)
    # GPIO.output(pinMotorBRForwards, GPIO.HIGH)
    # GPIO.output(pinMotorBRBackwards, GPIO.LOW)
    drive.forward(30)
    time.sleep(2)
    drive.backward(30)
    time.sleep(2)
    drive.spinLeft(50)
    time.sleep(2)
    drive.spinRight(50)
    time.sleep(2)