How to use the evasdk.EvaHTTPClient function in evasdk

To help you get started, we’ve selected a few evasdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github automata-tech / eva_python_sdk / examples / http_ws_example.py View on Github external
import evasdk
import json
import asyncio
import time

# This example shows usage of the eva_ws and eva_http modules, used for direct control
# using the network interfaces. eva_http also contains some helper functions not
# contained in the public API, such as lock_wait_for.

host_ip = input("Please enter a Eva IP: ")
token = input("Please enter a valid Eva token: ")

print('ip: [{}], token: [{}]\n'.format(host_ip, token))

http_client = evasdk.EvaHTTPClient(host_ip, token)

# The session token will be valid for 30 minutes, you'll need to renew the session
# if you want the websocket connection to continue after that point.
session_token = http_client.auth_create_session()

users = http_client.users_get()
print('Eva at {} users: {}\n'.format(host_ip, users))

joint_angles = http_client.data_servo_positions()
print('Eva current joint angles: {}'.format(joint_angles))


async def eva_ws_example(host_ip, session_token):
    websocket = await evasdk.ws_connect(host_ip, session_token)

    msg_count = 0