예제 #1
0
파일: robot.py 프로젝트: al4224t/wastebot
 def __init__(self,
              config,
              xaxis=DEFAULT_XYZ_AXIS,
              yaxis=DEFAULT_XYZ_AXIS,
              zaxis=DEFAULT_XYZ_AXIS,
              paxis=DEFAULT_P_AXIS,
              saxis=DEFAULT_S_AXIS):
     '''Initialize parts of robot'''
     self.cmdMng = CommandManager.from_config(config)
     self.x = Axis(self.cmdMng.X, xaxis['mm_per_step'], xaxis['min'],
                   xaxis['max'])
     self.y = Axis(self.cmdMng.Y, yaxis['mm_per_step'], yaxis['min'],
                   yaxis['max'])
     self.z = Axis(self.cmdMng.Z, zaxis['mm_per_step'], zaxis['min'],
                   zaxis['max'])
     self.xy = MultiAxis(self.x, self.y)
     self.xyz = MultiAxis(self.x, self.y, self.z)
     self.p = Pipette(
         Axis(self.cmdMng.P, paxis['ul_per_step'], paxis['min'],
              paxis['max']), paxis['min'], paxis['max'])
     self.s = Shaker(self.cmdMng.S, saxis['deg_per_step'], saxis['min'],
                     saxis['max'])
     '''Initialize arena'''
     self.arena = self.arena_from_configfile()
     self.tools = self.extract_dict_from_dict(self.arena, 'tools')
     self.wellplates = self.extract_rack_from_dict(self.arena, 'wellplates')
     if 'tipracks' in self.arena:
         self.tipracks = self.extract_rack_from_dict(self.arena, 'tipracks')
     '''Tracking parameters'''
     self.liquid_height = 0
     '''Home robot axes'''
     self.home()
예제 #2
0
    def __init__(self, config, xaxis=DEFAULT_XYZ_AXIS, yaxis=DEFAULT_XYZ_AXIS, zaxis=DEFAULT_XYZ_AXIS, p=DEFAULT_P_PARAMS):
        '''Initialize parts of robot'''
        self.cmdMng = CommandManager.from_config(config)
        self.x = Axis(self.cmdMng.X, xaxis['mm_per_step'], xaxis['min'], xaxis['max'])
        self.y = Axis(self.cmdMng.Y, yaxis['mm_per_step'], yaxis['min'], yaxis['max'])
        self.z = Axis(self.cmdMng.Z, zaxis['mm_per_step'], zaxis['min'], zaxis['max'])
        self.xy = MultiAxis(self.x, self.y)
        self.xyz = MultiAxis(self.x, self.y, self.z)
        #self.p = Pipette(p['ul_per_incr'], p['min'], p['max'])
		self.p = Pipette.from_config(config)
예제 #3
0
    def load_arduino(self):
        # for communication to arduino
        self.cmdMng = CommandManager.from_configfile(ARDUINO_CONFIG)

        # cooling fan
        self.Fan = self.cmdMng.Fan
        # each axis with Arduino communication, movement rate, min position, max position define
        self.X = Axis(self.cmdMng.X, 0.00937, 0, 510)
        self.Y = Axis(self.cmdMng.Y, 0.00937, 0, 270)
        self.Z = Axis(self.cmdMng.Z, 0.00253, 0, 100)
        self.CX = Axis(self.cmdMng.CX, 0.00937, 0, 510)
        self.CY = Axis(self.cmdMng.CY, 0.00937, 0, 270)

        # create multiaxes for concurrent movement
        self.XY = MultiAxis(self.X, self.Y)
        self.CXY = MultiAxis(self.CX, self.CY)
        self.XY_CXY = MultiAxis(self.X, self.Y, self.CX, self.CY)
        self.BOT = MultiAxis(self.X, self.Y, self.Z, self.CX, self.CY)

        self.BOT.home()
예제 #4
0
from commanduino import CommandManager

import logging
logging.basicConfig(level=logging.INFO)

# in your two board please load the arduino example OF:
# - CommandServo
# - CommandLinearAccelStepper
cmdMng = CommandManager.from_configfile('./two_boards.json')

s1 = cmdMng.devices['servo1']
s2 = cmdMng.devices['servo2']
m1 = cmdMng.devices['stepper1']

from commandruino.devices.axis import Axis

a = Axis(m1, 0.1)
예제 #5
0
import time
import logging
from commanduino import CommandManager

logging.basicConfig(level=logging.INFO)

cmdMng = CommandManager.from_configfile(
    './examples/commanddevices/commandlinearaccelstepper/demo.json')

stepper = cmdMng.stepper

stepper.set_current_position(0)

stepper.enable_acceleration()
stepper.set_acceleration(1000)
stepper.set_max_speed(10000)

print('Moving to 20000 with acceleration 1000')
stepper.move_to(20000, wait=True)

print('Moving back to 0 with acceleration 5000...')
print('Should turn in the opposite direction no?')
stepper.set_acceleration(5000)
stepper.move_to(0, wait=True)

print('Disabling acceleration')
stepper.disable_acceleration()
stepper.set_max_speed(10000)

print('Moving to 20000 with default speed 1000')
stepper.move_to(20000, wait=False)
예제 #6
0
파일: demo.py 프로젝트: zserg8/commanduino
import time
import logging
logging.basicConfig(level=logging.INFO)

from commanduino import CommandManager

cmdMng = CommandManager.from_configfile(
    './examples/commanddevices/commanddigitalwrite/demo.json')

for i in range(10):
    cmdMng.D1.high()
    time.sleep(1)
    cmdMng.D1.low()
    time.sleep(1)
예제 #7
0
from centripeta import Dispenser, Analyzer
from centripeta.utils import Logger
from pycont.controller import MultiPumpController
from commanduino import CommandManager
import pandas as pd
import logging
import time
import cv2

#Instantiate the command manager
mgr = CommandManager.from_configfile('platform_config_ports.json')
pumps = MultiPumpController.from_configfile('pycont_config.json')
a = Analyzer(mgr)
d = Dispenser(manager=mgr, pump_controller=pumps)

camera = cv2.VideoCapture(0)

for i in range(8):
    return_value, image = camera.read()
    cv2.imwrite('sample' + str(i) + '.png', image)
    img = cv2.imread('sample' + str(i) + '.png')
    cv2.namedWindow('sample' + str(i) + '.png')
    cv2.imshow('sample' + str(i) + '.png', img)
    cv2.waitKey(0)
    a.turn_wheel(n_turns=1)
del (camera)
cv2.destroyAllWindows()
예제 #8
0
import time
import os
import logging
logging.basicConfig(level=logging.INFO)

from commanduino import CommandManager

script_dir = os.path.dirname(__file__)
abs_path = os.path.join(script_dir, 'demo.json')

cmdMng = CommandManager.from_configfile(abs_path)

stepper = cmdMng.stepper

print('Setting current position to 0')
stepper.set_current_position(0)

stepper.enable_acceleration()
stepper.set_acceleration(1000)
stepper.set_running_speed(5000)
stepper.set_max_speed(10000)

print('Moving to 20000 with acceleration 1000')
stepper.move_to(20000, wait=True)
print('Moving back to 0 with acceleration 5000')
stepper.set_acceleration(5000)
stepper.move_to(0, wait=True)

#
print('Disabling acceleration')
stepper.disable_acceleration()
예제 #9
0
파일: demo.py 프로젝트: zserg8/commanduino
import time
import logging
from commanduino import CommandManager

logging.basicConfig(level=logging.INFO)

cmdMng = CommandManager.from_configfile(
    './examples/commanddevices/commandservo/demo.json')

for i in range(2):
    cmdMng.servo1.set_angle(60)
    cmdMng.servo2.set_angle(60)
    print(cmdMng.servo1.get_angle())
    print(cmdMng.servo2.get_angle())
    time.sleep(1)
    cmdMng.servo1.set_angle(120)
    cmdMng.servo2.set_angle(120)
    print(cmdMng.servo1.get_angle())
    print(cmdMng.servo2.get_angle())
    time.sleep(1)
 def __init__(self, config):
     self.mgr = CommandManager.from_configfile(config)
     self.config = json_utils.read(config)
     # self.devices = self.config[DEVICES].keys()
     self.devices = self.mgr.devices.keys()
예제 #11
0
파일: demo.py 프로젝트: zserg8/commanduino
import time
import logging
from commanduino import CommandManager

logging.basicConfig(level=logging.INFO)

cmdMng = CommandManager.from_configfile('./examples/commanddevices/commandanalogread/demo.json')


for i in range(10):
    print(cmdMng.A1.get_level())
    time.sleep(1)
예제 #12
0
 def __init__(self, config, name):
     self.mgr = CommandManager.from_config(config)
     self.config = config
     self._name = name
예제 #13
0
 def __init__(self, config: str):
     self.mgr = CommandManager.from_configfile(config)
     self.config = json_utils.read(config)
예제 #14
0
from commanduino import CommandManager

import logging
logging.basicConfig(level=logging.INFO)

# in your two board please load the arduino example OF:
# - CommandServo
# - CommandLinearAccelStepper
cmdMng = CommandManager.from_configfile('./examples/commandmanager/two_boards/two_boards.json')

s1 = cmdMng.devices['servo1']
s2 = cmdMng.devices['servo2']
m1 = cmdMng.devices['stepper1']

from commanduino.devices.axis import Axis

a = Axis(m1, 0.1)
예제 #15
0
import time
import os
import logging
from commanduino import CommandManager

logging.basicConfig(level=logging.INFO)

script_dir = os.path.dirname(__file__)
cm_config = os.path.join(script_dir, 'demo.json')
cmdMng = CommandManager.from_configfile(cm_config)

stepper = cmdMng.stepper

stepper.set_current_position(0)

stepper.enable_acceleration()
stepper.set_acceleration(1000)
stepper.set_max_speed(10000)

print('Moving to 20000 with acceleration 1000')
stepper.move_to(-2000, wait=True)

print('Moving back to 0 with acceleration 5000...')
print('Should turn in the opposite direction no?')
stepper.set_acceleration(5000)
stepper.move_to(-1000, wait=True)


print('Disabling acceleration')
stepper.disable_acceleration()
stepper.set_max_speed(10000)
예제 #16
0
from commanduino import CommandManager

import logging
logging.basicConfig(level=logging.INFO)

cmdMng = CommandManager.from_configfile('./basics.json')

quit = False
while not quit:
    msg = input()
    if msg == "QUIT":
        isRunning = False
        quit = True
    elif msg == "REQUEST":
        print(cmdMng.devices['servo1'].get_angle())
    else:
        cmdMng.serialcommandhandlers[0].write(msg)
예제 #17
0
import time
import logging
logging.basicConfig(level=logging.INFO)

from commanduino import CommandManager

cmdMng = CommandManager.from_configfile('./demo.json')

for i in range(10):
    F = cmdMng.sht15.get_fahrenheit()
    C = cmdMng.sht15.get_celsius()
    H = cmdMng.sht15.get_humidity()
    print '###'
    print 'Temperature = {} F  /  {} C'.format(F, C)
    print 'Humidity = {}%'.format(H)
    time.sleep(1)
예제 #18
0
from commanduino import CommandManager

import logging
logging.basicConfig(level=logging.INFO)

#cmdMng = CommandManager.from_configfile('./examples/commandmanager/basics/basics_serial.json')
cmdMng = CommandManager.from_configfile(
    './examples/commandmanager/basics/basics_tcpip.json')

p1, p2, p3 = True, True, True
while True:
    msg = input()
    if msg == "QUIT":
        break
    elif msg == "P1":
        # Devices can be accessed through devices dictionary
        cmdMng.devices['pin1'].set_level(int(p1))
        # Invert next state for this pin
        p1 = not p1
    elif msg == "P2":
        # Or directly as a CommandManager attribute
        cmdMng.pin2.set_level(int(p2))
        p2 = not p2
    elif msg == "P3":
        if p3 is True:
            cmdMng.pin3.high()
        else:
            cmdMng.pin3.low()
        p3 = not p3