Esempio n. 1
0
from DobotSDK import Dobot
import time

# The top Z to go to.
up = 180
# The bottom Z to go to.
down = 120
# Maximum speed in mm/s
speed = 700
# Acceleration in mm/s^2
acceleration = 400

# dobot = Dobot('/dev/tty.usbmodem1421', debug=True, fake=True)
# dobot = Dobot('COM4', debug=True)
dobot = Dobot('/dev/tty.usbmodem1421', debug=True)

# Enable calibration routine if you have a limit switch/photointerrupter installed on the arm.
# See example-switch.py for details.
# Take the tool to a safe haight.
# dobot.MoveWithSpeed(260.0, 0.0, up, speed, acceleration)
# time.sleep(2)
# dobot.CalibrateJoint(1, dobot.freqToCmdVal(2000), dobot.freqToCmdVal(50), 1, 5, 1, 0)

dobot.Gripper(480)
# Take an object on the right and put to the left
dobot.MoveWithSpeed(260.0, 0.0, up, speed, acceleration, 0)
dobot.MoveWithSpeed(260.0, -70.0, up, speed, acceleration)
dobot.MoveWithSpeed(260.0, -70.0, down, speed, acceleration)
dobot.Gripper(208)
dobot.Wait(0.2)
Esempio n. 2
0
import DobotCoordinates
from DobotSDK import Dobot
dobot = Dobot('COM5', debug=False)
dobot.CalibrateJoint(1, dobot.freqToCmdVal(500), dobot.freqToCmdVal(50), 1, 5,
                     1, 0)
dobot.InitializeAccelerometers()

upP, acceleration, speed = 100, 400, 400


class Methods():
    def touchTest(self, device, station):
        print "Touch test started..."
        [x1, x2, x4], [y1, y2,
                       y4] = DobotCoordinates.getZeroPoint(device, station)
        height, width, down, up = self.getPhoneProperties(device)
        numberOfSquareX = 16
        numberOfSquareY = 9
        shiftY = y2 - y1
        shiftX = x4 - x1
        xRange = (x2 - x1) / numberOfSquareX
        yRange = (y4 - y1) / numberOfSquareY
        xBuffer = (xRange / 2.0)
        yBuffer = (yRange / 2.0)
        for stepX in range(0, numberOfSquareX):
            x = x1 + xRange * stepX + xBuffer
            for stepY in range(0, numberOfSquareY):
                y = y1 + yRange * stepY + yBuffer + stepX * (shiftY /
                                                             numberOfSquareX)
                x = x + shiftX / numberOfSquareY
                dobot.MoveWithSpeed(x, y, up, speed, acceleration)