def example_api_creation():

    DEVICE_IP = "192.168.1.10"
    DEVICE_PORT = 10000

    transport = UDPTransport()
    transport.connect(DEVICE_IP, DEVICE_PORT)
    router = RouterClient(transport,
                          lambda kException: print("Error during connection"))

    # Create session
    session_info = Session_pb2.CreateSessionInfo()
    session_info.username = '******'
    session_info.password = '******'
    session_info.session_inactivity_timeout = 600000  # 10 minutes
    session_info.connection_inactivity_timeout = 2000  # 2 second

    print("Creating session for communication")
    session_manager = SessionManager(router)
    session_manager.CreateSession(session_info)

    # Create needed services
    device_config_service = DeviceConfigClient(router)
    base_client_service = BaseClient(router)

    print(device_config_service.GetDeviceType())
    print(base_client_service.GetAvailableWifi())

    session_manager.CloseSession()
Exemple #2
0
    print("Create sequence on device and execute it")
    base_client_service = BaseClient(router)
    handle_sequence = base_client_service.CreateSequence(sequence)
    base_client_service.PlaySequence(handle_sequence)

    print("Waiting 30 seconds to finish movement...")
    time.sleep(30)


if __name__ == "__main__":

    DEVICE_IP = "192.168.1.10"
    DEVICE_PORT = 10000

    transport = UDPTransport()
    transport.connect(DEVICE_IP, DEVICE_PORT)
    router = RouterClient(transport,
                          lambda kException: print("Error during connection"))

    session_info = Session_pb2.CreateSessionInfo()
    session_info.username = '******'
    session_info.password = '******'
    session_info.session_inactivity_timeout = 600000  # 10 minutes
    session_info.connection_inactivity_timeout = 2000  # 2 seconds

    session_manager = SessionManager(router)
    session_manager.CreateSession(session_info)

    # Example core
    create_sequence(router)
    DEVICE_IP = "192.168.1.10"
    DEVICE_PORT = 10000

    transport = UDPTransport()
    transport.connect(DEVICE_IP, DEVICE_PORT)
    router = RouterClient(transport,
                          lambda kException: print("Error during connection"))

    print("Creating Session for communication")
    session_info = Session_pb2.CreateSessionInfo()
    session_info.username = '******'
    session_info.password = '******'
    session_info.session_inactivity_timeout = 60000  # (milliseconds)
    session_info.connection_inactivity_timeout = 2000  # (milliseconds)
    print("Session created")

    session_manager_service = SessionManager(router)
    session_manager_service.CreateSession(session_info)

    print("Waiting 7.5 seconds before trying to take control of the robot...")
    time.sleep(7.5)

    base_client_service = BaseClient(router)

    angular_movement(base_client_service)

    cartesian_movement(base_client_service)

    session_manager_service.CloseSession()