Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env python3
from evasdk import Eva
import json
# This example shows usage of the Eva object, used for controlling Eva,
# reading Eva's current state and responding to different events triggered
# by Eva's operation.
host_ip = input("Please enter a Eva IP: ")
token = input("Please enter a valid Eva token: ")
eva = Eva(host_ip, token)
# Send Eva to a waypoint
with eva.lock():
eva.control_wait_for_ready()
eva.control_go_to([0, 0, 0, 0, 0, 0])
# Print Eva's toolpaths
toolpaths = eva.toolpaths_list()
outToolpaths = []
for toolpathItem in toolpaths:
toolpath = eva.toolpaths_retrieve(toolpathItem['id'])
outToolpaths.append(toolpath)
print(json.dumps(outToolpaths))
# Create a basic toolpath and execute it
toolpath = {
print("in home position")
def read_from_camera() -> XYPosition:
"""
Your camera code here! in this simple example we assume the machine vision
camera outputs an x and y position of the object detected in the frame at a
known z offset.
"""
return (1.6, 1.1)
if __name__ == "__main__":
# initialize EvaCamera with a working Eva and the camera positional information
eva = Eva("", "")
camera_position = (1.2, 2.3, 3.4)
camera_to_item_distance = 2.2
ec = EvaCamera(eva, camera_position, camera_to_item_distance)
# read from the camera to get an item's position
item_position = read_from_camera()
# move eva to the item position and do some action
ec.move_to_camera_item(item_position)
ec.in_position_action()
# move eva home
ec.move_home()