Python library for Dobot Magician
Based on Communication Protocol V1.1.4 (latest version here)
Installation
Install driver from https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers.
pip install pydobot
Example
from serial.tools import list_ports
import pydobot
available_ports = list_ports.comports()
print(f'available ports: {[x.device for x in available_ports]}')
port = available_ports[0].device
device = pydobot.Dobot(port=port, verbose=True)
(x, y, z, r, j1, j2, j3, j4) = device.pose()
print(f'x:{x} y:{y} z:{z} j1:{j1} j2:{j2} j3:{j3} j4:{j4}')
device.move_to(x + 20, y, z, r, wait=False)
device.move_to(x, y, z, r, wait=True) # we wait until this movement is done before continuing
device.close()
Methods
-
Dobot(port, verbose=False) Creates an instance of dobot connected to given serial port.
- port: string with name of serial port to connect
- verbose: bool will print to console all serial comms
-
.pose() Returns the current pose of dobot, as a tuple (x, y, z, r, j1, j2, j3, j4)
- x: float current x cartesian coordinate
- y: float current y cartesian coordinate
- z: float current z cartesian coordinate
- r: float current effector rotation
- j1: float current joint 1 angle
- j2: float current joint 2 angle
- j3: float current joint 3 angle
- j4: float current joint 4 angle
-
.move_to(x, y, z, r, wait=False) queues a translation in dobot to given coordinates
- x: float x cartesian coordinate to move
- y: float y cartesian coordinate to move
- z: float z cartesian coordinate to move
- r: float r effector rotation
- wait: bool waits until command has been executed to return to process
-
.speed(velocity, acceleration) changes velocity and acceleration at which the dobot moves to future coordinates
- velocity: float desired translation velocity
- acceleration: float desired translation acceleration
-
.suck(enable)
- enable: bool enables/disables suction
-
.grip(enable)
- enable: bool enables/disables gripper
-
.wait(ms) adds a waiting period to the internal queue of messages
- ms: int number of milliseconds to wait
Release files for pydobot 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydobot-1.3.2.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydobot-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.1 kB
Release files / pydobot-1.3.2.tar.gz
| Download URL | pydobot-1.3.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd9bf88701b9edb4a9f0e3ee34e144d4ee3837b5931f78a461c3e9be6d7073f6
|
|
BLAKE2b-256 checksum How to use checksums |
378bc4e042466c1d9d73117b6f555f6088ba8627850ef9fa18a9861d963ddfcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.13
|
Release files / pydobot-1.3.2-py3-none-any.whl
| Download URL | pydobot-1.3.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1649f41ca0fc49c0d1f1dcf624ceb8264bbc1522c2366438547917bd353ea25a
|
|
BLAKE2b-256 checksum How to use checksums |
26d8cf69b982978e92529c8d7c5f077e94bebe213ea56bb6be2c11d89f94e365
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.13
|