Skip to main content

An extended cross-platform high-level API for the Dobot Magician robotic arm based on pydobotplus.

Project description

pydobotplus

An extended Python library for controlling the Dobot Magician.

Installation

Install the driver from Silicon Labs.

Run:

pip install pydobotplus

Example

from serial.tools import list_ports
from pydobotplus 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
  • .get_pose() Returns the current pose of the Dobot, as a Pose named 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 Position object, 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 Alarm enums
  • .clear_alarms() Clears all current alarms.

  • 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=PORT_GP4) Enables or disables the IR sensor on the specified port.

    • enable: bool enables/disables the sensor
    • port: int port number
  • .get_ir(port=PORT_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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydobotpp-0.1.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydobotpp-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file pydobotpp-0.1.2.tar.gz.

File metadata

  • Download URL: pydobotpp-0.1.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for pydobotpp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6d65deb152e576c09e4267a6b8cca8f142e6b91e85e0de170b898075adb23dfb
MD5 a008cc8d937415d8cc54c0c81aa27009
BLAKE2b-256 071f747982f7c233b6af6fb575377a21505f771e7f8bd1d9292b8cd23d4dd644

See more details on using hashes here.

File details

Details for the file pydobotpp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pydobotpp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for pydobotpp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 522f6b0f0201bd91cc78b21d240a44227157ebd725e19aad43fadb4c3b26c731
MD5 b3a8d5ecb8607937a626964dd3a6af23
BLAKE2b-256 0ad8406f344fc15a0375d526c5c2302467638f9af26c85c2c4e70df1b58b3cd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page