pydobotplusplus
An (even more) extended Python library for controlling the Dobot Magician.
Installation
Install the driver from Silicon Labs.
Run:
pip install pydobotpp
Example
from serial.tools import list_ports
from pydobotpp import Dobot, CustomPosition
available_ports = list_ports.comports()
print(f'available ports: {[x.device for x in available_ports]}')
port = available_ports[2].device
device = Dobot(port=port)
# Create a custom position
pos1 = CustomPosition(x=200, y=50, z=50)
# Move using direct coordinates
device.move_to(x=200, y=50, z=50)
# Move using custom position
device.move_to(position=pos1)
# Control the conveyor belt
device.conveyor_belt(speed=0.5, direction=1)
device.conveyor_belt_distance(speed_mm_per_sec=50, distance_mm=200, direction=1)
device.close()
Methods
-
Dobot(port, verbose=False) Creates an instance of Dobot connected to the given serial port.
- port: string with name of serial port to connect
- verbose: bool will print to console all serial communications
-
.wait_for_cmd(cmd_id) Waits for the dobot's command queue to finish the cmd_id command.
- cmd_id: The return id of action commands (.home(), .suck(enable), .grip(enable), etc...)
-
.home() Sends a homing command to the robot, to reset the angle position of the robot's base motor.
-
.get_pose() Returns the current pose of the Dobot, as a
Posenamed tuple (position and joints).- position: Position with (x, y, z, r) coordinates
- joints: Joints with (j1, j2, j3, j4) angles
-
.move_to(x=None, y=None, z=None, r=0, wait=True, mode=None, position=None) Queues a translation for the Dobot to the given coordinates or a
Positionobject, keeps any unspecified parameters the same.- 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 the command has been executed before returning to the process - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING
- mode: MODE_PTP movement mode (default is
MODE_PTP.MOVJ_XYZ) - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING - position: Position object with (x, y, z, r) coordinates
-
.move_rel(x=0, y=0, z=0, r=0, wait=True) Moves the Dobot relative to its current position, keeps any unspecified parameters the same.
- x: float relative x coordinate
- y: float relative y coordinate
- z: float relative z coordinate
- r: float relative r rotation
- wait: bool waits until the command has been executed before returning to the process
-
.speed(velocity, acceleration) Changes the velocity and acceleration at which the Dobot moves to future coordinates.
- velocity: float desired translation velocity
- acceleration: float desired translation acceleration
-
.suck(enable) Enables or disables suction.
- enable: bool enables/disables suction
-
.grip(enable) Enables or disables the gripper.
- enable: bool enables/disables gripper
-
.get_alarms() Returns a set of current alarms.
- returns: set of
Alarmenums
- returns: set of
-
.clear_alarms() Clears all current alarms.
-
.wait(ms) Sends a wait command to the robot
- ms: The time to wait in milliseconds.
-
.get_device_serial_number() Returns the robot's serial number
-
.set_device_name(name: str) Sets the device's name (as one can do using DobotStudio)
-
.get_device_name(name: str) Get the device's name (as reported in DobotStudio)
-
CustomPosition(x=None, y=None, z=None, r=None) Initializes a custom position object.
- x: float x coordinate
- y: float y coordinate
- z: float z coordinate
- r: float effector rotation - NOT USED ON MAGICIAN
-
MODE_PTP Enum class for various PTP modes such as
JUMP_XYZ,MOVJ_XYZ,MOVL_XYZ, etc. - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING -
DobotException Custom exception class for handling Dobot-related errors.
-
.set_color_sensor(enable=True, version=1) Enables or disables the color sensor.
- enable: bool enables/disables the sensor
- version: int sensor version
-
.get_color() Returns the RGB values detected by the color sensor.
- returns: list with RGB values
-
.set_ir(enable=True, port=GPIOPort.GP4) Enables or disables the IR sensor on the specified port.
- enable: bool enables/disables the sensor
- port: int port number
-
.get_ir(port=GPIOPort.GP4) Returns the state of the IR sensor on the specified port.
- port: int port number
- returns: bool state of the sensor
-
.conveyor_belt(speed, direction=1, interface=0) Sets the speed and direction of the conveyor belt.
- speed: float speed of the conveyor belt (range: 0.0 to 1.0)
- direction: int direction of the conveyor belt (1 for forward, -1 for backward)
- interface: int motor interface (default is 0)
-
.conveyor_belt_distance(speed_mm_per_sec, distance_mm, direction=1, interface=0) Moves the conveyor belt at a specified speed for a specified distance.
- speed_mm_per_sec: float speed in millimeters per second (must be <= 100)
- distance_mm: float distance in millimeters
- direction: int direction of the conveyor belt (1 for forward, -1 for backward)
- interface: int motor interface (default is 0)
Metadata
Release files for pydobotpp 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydobotpp-0.1.6.tar.gz | 11.3 kB | Without provenance | Details for pydobotpp-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydobotpp-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for pydobotpp-0.1.6-py3-none-any.whl |
Total release size: 22.2 kB
Release files / pydobotpp-0.1.6.tar.gz
| Download URL | pydobotpp-0.1.6.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09f92cf1876ed9f71aa44294ceaa0af9ecb7038225797ef57ff4c68ec68e53af
|
|
BLAKE2b-256 checksum How to use checksums |
3fac4806fcf3757e5816f70ffdac7b4b7bb2b294f60bacb48378b7d15bbfb368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / pydobotpp-0.1.6-py3-none-any.whl
| Download URL | pydobotpp-0.1.6-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d484c1d88b1ed74d00cae4bba6339e7178a0bb4b85f076f8e451c71a25333377
|
|
BLAKE2b-256 checksum How to use checksums |
3ba4ea8c6d7bdee8f3d639f43f0864ae83c8f00ae9e8370873b479dc2927cf96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Security for pydobotpp 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.