7. Turn off power on the arm, disconnect USB cable, mount accelerometers back onto the arm 

Author: maxosprojects (March 18 2016)
Additional Authors: <put your name here>

Version: 1.2.2

License: MIT
"""
import math

from dobot import DobotDriver
from dobot import DobotKinematics

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()
# driver.Open(timeout=0.3)
kinematics = DobotKinematics()

# Offsets must be found using this tool for your Dobot once
# (rear arm, frontarm)
offsets = (1024, 1024)


def toEndEffectorHeight(rear, front):
    ret = kinematics.coordinatesFromAngles(0, rear, front)
    return ret[2]


while True:
Esempio n. 2
0
Number of steps is determined by the frequency and the execution window (20ms = 0.02s).

So, if you send only one command "50Hz" then dobot makes exacly one step and stops.

number_of_steps = 50Hz * 20ms = 50 * 0.02 = 1

For 600Hz:
number_of_steps = 600Hz * 20ms = 600 * 0.02 = 12

'''

from dobot import DobotDriver
import time

# driver = DobotDriver('COM4')
driver = DobotDriver('COM4')
driver.Open()
successes = 0

i = 0
while True:
    ret = driver.isReady()
    if ret[0] and ret[1]:
        successes += 1
        print(successes)
    if successes > 10:
        print("Dobot ready!")
        break
    if i > 100:
        raise Exception('Comm problem')
Esempio n. 3
0
from dobot import DobotDriver

driver = DobotDriver('COM4')
driver.Open()

successes = 0
i = 0

while True:
    ret = driver.isReady()
    if ret[0] and ret[1]:
        successes += 1
        print(successes)
    if successes > 10:
        print("Dobot ready!")
        break
    if i > 100:
        raise Exception('Comm problem')
driver.Close()
Esempio n. 4
0
#! /usr/bin/env python
'''
Allows to visually calibrate motor reduction gear backlash.

The backlash is hardcoded in SDK. Use only if you know what you're doing.
'''

from dobot import DobotDriver
from getch import getch
import time

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()
successes = 0
i = 0
while True:
    ret = driver.isReady()
    if ret[0] and ret[1]:
        successes += 1
    if successes > 10:
        print("Dobot ready!")
        break
    if i > 100:
        raise Exception('Comm problem')


def execute(code1, code2, code3, direction1, direction2, direction3):
    code1 = driver.stepsToCmdVal(code1)
    code2 = driver.stepsToCmdVal(code2)
    code3 = driver.stepsToCmdVal(code3)
Esempio n. 5
0
#! /usr/bin/env python
'''
An example running a calibration procedure using a limit switch/photointerrupter connected to a any
of the unused pins on Arduino, enabling/disabling pullup, specifying the switch type (normal LOW or
normal HIGH), forward joint rotation direction (towards the switch), forward and backward speeds.

Refer to DobotDriver.CalibrateJoint() for details.

This example works well with a photointerrupter shown on open-dobot/docs/images/interrupter*.jpg
It is cheap and easily mounted and yet sturdy and reliably. Requires minimum effort to get accurate
calibration for Joint1 (base), which originally has no sensors.
You can get an interrupter here:
https://www.sparkfun.com/products/9299
https://www.sparkfun.com/products/9322

'''

from dobot import DobotDriver

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()

# Rotate base CW at 400 steps/s until limit switch is hit. Then retract CCW at 50 steps/s
# until switch is released and stop.
# Switch is expected to be connected (soldered) to pin D8 and pulled up (HIGH) externally (with a
# resistor, e.g. 4.7k, to 5V supply) or be an active device (like a photointerrupter). Pullup is not enabled on that pin.

driver.CalibrateJoint(1, driver.freqToCmdVal(1000), driver.freqToCmdVal(50), 1,
                      5, 1, 0)
Esempio n. 6
0
Number of steps is determined by the frequency and the execution window (20ms = 0.02s).

So, if you send only one command "50Hz" then dobot makes exacly one step and stops.

number_of_steps = 50Hz * 20ms = 50 * 0.02 = 1

For 600Hz:
number_of_steps = 600Hz * 20ms = 600 * 0.02 = 12

'''

from dobot import DobotDriver
import time

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/ttyUSB0')
driver.Open()
successes = 0
i = 0
while True:
	ret = driver.isReady()
	if ret[0] and ret[1]:
		successes += 1
	if successes > 10:
		print("Dobot ready!")
		break
	if i > 100:
		raise Exception('Comm problem')

gripper = 480
toolRotation = 0
Number of steps is determined by the frequency and the execution window (20ms = 0.02s).

So, if you send only one command "50Hz" then dobot makes exacly one step and stops.

number_of_steps = 50Hz * 20ms = 50 * 0.02 = 1

For 600Hz:
number_of_steps = 600Hz * 20ms = 600 * 0.02 = 12

'''

from dobot import DobotDriver
import time

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()
successes = 0
i = 0
while True:
	ret = driver.isReady()
	if ret[0] and ret[1]:
		successes += 1
	if successes > 10:
		print("Dobot ready!")
		break
	if i > 100:
		raise Exception('Comm problem')

gripper = 480
toolRotation = 0
#! /usr/bin/env python
'''
Allows to visually calibrate motor reduction gear backlash.

The backlash is hardcoded in SDK. Use only if you know what you're doing.
'''

from dobot import DobotDriver
from getch import getch
import time

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()
successes = 0
i = 0
while True:
	ret = driver.isReady()
	if ret[0] and ret[1]:
		successes += 1
	if successes > 10:
		print("Dobot ready!")
		break
	if i > 100:
		raise Exception('Comm problem')

def execute(code1, code2, code3, direction1, direction2, direction3):
	code1 = driver.stepsToCmdVal(code1)
	code2 = driver.stepsToCmdVal(code2)
	code3 = driver.stepsToCmdVal(code3)
	ret = (0, 0)
#! /usr/bin/env python
'''
An example running a calibration procedure using a limit switch/photointerrupter connected to a any
of the unused pins on Arduino, enabling/disabling pullup, specifying the switch type (normal LOW or
normal HIGH), forward joint rotation direction (towards the switch), forward and backward speeds.

Refer to DobotDriver.CalibrateJoint() for details.

This example works well with a photointerrupter shown on open-dobot/docs/images/interrupter*.jpg
It is cheap and easily mounted and yet sturdy and reliably. Requires minimum effort to get accurate
calibration for Joint1 (base), which originally has no sensors.
You can get an interrupter here:
https://www.sparkfun.com/products/9299
https://www.sparkfun.com/products/9322

'''

from dobot import DobotDriver

# driver = DobotDriver('COM4')
driver = DobotDriver('/dev/tty.usbmodem1421')
driver.Open()

# Rotate base CW at 400 steps/s until limit switch is hit. Then retract CCW at 50 steps/s
# until switch is released and stop.
# Switch is expected to be connected (soldered) to pin D8 and pulled up (HIGH) externally (with a
# resistor, e.g. 4.7k, to 5V supply) or be an active device (like a photointerrupter). Pullup is not enabled on that pin.

driver.CalibrateJoint(1, driver.freqToCmdVal(1000), driver.freqToCmdVal(50), 1, 5, 1, 0)