Esempio n. 1
0
def Turn_on():

    myBox = ControlBox('COM3', 9600)
    myBox.connect()

    dvals = myBox.digitalIn('i', [1, 2, 3])
    myBox.digitalOutList([1, 2, 3], dvals)
Esempio n. 2
0
    def __init__(self, portName, baud, alphaIds):
        ControlBox.__init__(self, portName, baud)

        # if alphaIds is a single interger, change it to a list
        if isinstance(alphaIds, int):
            alphaIds = self.change_int_to_list(alphaIds)

        self.alphaIds = alphaIds
        self.alphaLims = np.tile([[-90], [0], [90]], len(alphaIds))
        self.musecLims = np.tile([[600], [1500], [2400]], len(alphaIds))
        self.alphaOrient = [-1, 1, 1, -1, 1, -1]
        self.alphaHome = [0, 0, 0, 0, 0, 0]
        self.alphaSleep = [0, 0, 0, 0, 0, 0]

        #interpolation of angles to positions
        self.ticks = [0] * len(self.alphaIds)

        for i in range(len(alphaIds)):
            # creates an object
            self.ticks[i] = interp1d(self.alphaLims[:, i],
                                     self.musecLims[:, i],
                                     fill_value="extrapolate")
Esempio n. 3
0
    def __init__(self, portName, baud):
        ControlBox.__init__(self, portName, baud)
        self.alphaIds = [1, 2, 3, 4, 5]
        self.alphaLims = np.array([
            -90, -90, -90, -90, -90, 0.00, 0, 0, 0, 0, 0, 3.0 / 4.0, 90, 90,
            90, 90, 80, 1.125
        ])
        self.alphaLims.shape = (3, 6)

        self.musecLims = np.tile([[1000], [1500], [2000]], len(self.alphaIds))
        self.alphaOrient = [-1, -1, 1, 1, -1]

        #interpolation of angles to positions (alphaLims to musec)
        self.ticks = [0] * len(self.alphaIds)

        for i in range(len(self.alphaIds)):
            # creates an object
            self.ticks[i] = interp1d(self.alphaLims[:, i],
                                     self.musecLims[:, i],
                                     fill_value="extrapolate")

        self.alphaHome = [0, 0, 0, 0, 0]
        self.alphaSleep = [0, 0, 0, 0, 0]
Esempio n. 4
0
from controlBox import ControlBox
from time import sleep

myBox = ControlBox('COM3', 9600)
myBox.connect()

timer = 0

while timer != 100:
    dvals = myBox.digitalIn('i', [1, 2, 3])
    print(dvals)
    myBox.digitalOutList([1, 2, 3], dvals)
    sleep(1)
    timer += 1

print('Done')
myBox.digitalOutList([1, 2, 3], [0, 0, 0])
myBox.shutDown()
Esempio n. 5
0
## scripts to test the ControlBox calibrating static method
from controlBox import ControlBox

test = ControlBox('COM3', 9600)
test.connect()
test.setServos(1, 1500, 25)
#test.disable()
test.shutDown()

print ControlBox.debugger()

Esempio n. 6
0
from controlBox import ControlBox
from time import sleep

myBox = ControlBox('COM3', 9600)
myBox.connect()

myBox.digitalOut(1, 1)
for i in range(6):
    myBox.digitalOut(1, 1)
    sleep(1)
    myBox.digitalOut(1, 0)
    sleep(1)
Esempio n. 7
0
from controlBox import ControlBox
from time import sleep

myBox = ControlBox('COM3', 9600)
myBox.connect()

aVals = myBox.analogIn('a', [4, 5, 6])
print aVals
Esempio n. 8
0
def Turn_off():
    myBox = ControlBox('COM3', 9600)
    myBox.connect()

    myBox.digitalOutList([1, 2, 3], [0, 0, 0])
Esempio n. 9
0
from controlBox import ControlBox
from robotArm import RobotArm

myBox = ControlBox('COM3', 9600)
myBox.connect()
#myBox.setServos([1,2,6],[1000,600,1000], 17)
myBox.digitalIn('f', [1, 2])
myBox.digitalOut(1, 0)

myBox.shutDown()

myArm = RobotArm('COM3', 9600, [1, 2, 6])
myArm.connect()
myArm.setServos([3, 4], [900, 900], 25)
myArm.setServos([3, 4], [1500, 1500], 25)
myArm.setServos([3, 4], [2000, 2000], 25)
#myArm.setServos(1,2000, 25)

print(myArm.alphaIds)
myArm.setArm([0, 0, 0], 25)
myArm.setArm([85, 85, 85], 25)
myArm.setArm([0, 0, 0], 25)
myArm.setArm([-85, -85, -85], 25)
myArm.gotoHome()
myArm.shutDown()
'''
    write a reset static function to make the motors work
    It should send a bunch of ";" to the serial port and shut it down
    That way you 
'''
Esempio n. 10
0
from controlBox import ControlBox
from time import sleep


myBox = ControlBox('COM3', 9600)
myBox.debugger()
myBox.connect()

timing = 0
while timing != 15:
#for i in range(6):
    myBox.digitalOut(1, 1)
    myBox.digitalOut(2, 0)
    sleep(1)
    myBox.digitalOut(1,0)
    myBox.digitalOut(2,1)
    myBox.digitalOut(2,0)
    sleep(1)
    timing += 1

else:
    myBox.shutDown()
    print 'time_over'
Esempio n. 11
0
from controlBox import ControlBox
from robotArmClass import RobotArm

myBox = ControlBox('COM3', 9600)
myBox.connect()
myBox.setServos([1, 2, 6], [1600, 1000, 2000], 17)
myBox.digitalIn('f', [1, 2])
myBox.digitalOut(1, 0)

myBox.shutDown()

myArm = RobotArm('COM3', 9600, [1, 2, 6])
myArm.connect()
#myArm.setServos([1,2,6],[2000,1200,1200], 255)
#myArm.setServos(myArm.alphaIds,[1600,600,2000], 25)

print myArm.alphaIds
myArm.setArm((5, 85, -90), 255)
myArm.gotoHome()
myArm.shutDown()