예제 #1
0
    pins[7].write(currentPower['left'])  #motor_up_left) # stop on 93

    pins[8].write(motor_claw)
    #'''

    # print datalist
    for i in range(30):
        print('\r\033[A\033[K', end='')

    print('Trim: [{0}, {1}]'.format(trimUp['left'], trimUp['right']))
    print(joystick1)
    print(joystick2)
    print(motor_a, motor_b)
    print(180 - motor_c, motor_d)
    print()
    print(currentPower['left'], currentPower['right'])
    print(motor_claw)
    #global emergencyPower
    if emergencyPower:
        print('-----------------------')
        print('-- MAX POWER ENABLED --')
        print('-----------------------')

    index = 0
    for i in old:
        print(index, i)
        index += 1


webSocketClient.start('motor', process, ip="192.168.1.2")
예제 #2
0
            [dealWithNumber(joysticks[i].get_button(x), 2) for x in range(6)])

    # clear screen
    for i in range(30):
        # \r is a special character that makes print
        # start at the beginning of the line, overwritting
        # what is already there
        #
        # \033 is the ascii escape character for special
        # terminal instructions
        # \033[A moves the cursor up a line
        # \033[K clears the line
        # refer to http://ascii-table.com/ansi-escape-sequences.php
        #
        # the point of these are to clear the terminal screen
        print('\r\033[A\033[K', end='')

    # print data
    print(allData)

    # don't know what this is. Ask Danny or Yilou, but I doubt they know either
    pygame.event.pump()

    return json.dumps(allData)  # returns values as json string


# start a web socket client
# type is "surface", handling function is getData
if __name__ == '__main__':
    webSocketClient.start('surface', getData)
예제 #3
0
    print('Trim: {0}'.format(trimUp['center']))
    # display joystick values
    print(joystick1)
    print(joystick2)
    # display power levels
    print(motor_a, motor_b)
    print(motor_up)
    print()

    #
    # for debugging
    # anything added to the old list will be printed here
    #
    # !!! IMPORTANT FOR DEBUGGING !!!
    # because of the screen clearing,
    # nothing printed before it will actually be visible
    # as it will be deleted by the screen clearing.
    # thus, any debug info to pring must be added to old
    # so that it is printed here after the screen clearing
    #
    index = 0
    for i in old:
        print(index, i)
        index += 1


# start the code
# ip should be of the surface pi
# type is 'miniROV'
webSocketClient.start('miniROV', process, ip="192.168.1.2")
예제 #4
0
        # the point of these are to clear the terminal screen
        print('\r\033[A\033[K', end='')

    # print datalist info
    print('Trim: [{0}, {1}]'.format(trimUp['left'], trimUp['right']))
    print(joystick1)

    print(motor_a, motor_b)
    print(180 - motor_c, motor_d)
    # motor_c is reversed so it is re-reversed here
    print()
    print(currentPower['left'], currentPower['right'])
    print(motor_claw)

    if emergencyPower:
        print('-----------------------')
        print('-- MAX POWER ENABLED --')
        print('-----------------------')

    # for debugging
    for index, i in enumerate(old):
        print(index, i)


# start a web socket client
# type is "motor", handling function is process
# ip is that of the server
if __name__ == '__main__':
    webSocketClient.start('motor', process, ip="192.168.1.2")
    webSocketClient.start('motor', camera_servo, ip="192.168.1.2")