# pydobotplus
An extended Python library for controlling the Dobot Magician.
## Installation
Install the driver from [Silicon Labs](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers).
```sh
pip install pydobotplus
```
## Example
```python
from serial.tools import list_ports
from pydobotplus import Dobot, CustomPosition
port = list_ports.comports()[0].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)
Raw data
{
"_id": null,
"home_page": "https://github.com/sammydick22/pydobotplus",
"name": "pydobotplus",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "dobot, magician, robotics, m1",
"author": "sammydick22",
"author_email": "sjeother@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b1/b7/712bf3d956a81676507d91564a5495fc8176fc586d33777dde71d182c99f/pydobotplus-0.1.1.tar.gz",
"platform": null,
"description": "# pydobotplus\n\nAn extended Python library for controlling the Dobot Magician.\n\n## Installation\n\nInstall the driver from [Silicon Labs](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers).\n\n```sh\npip install pydobotplus\n```\n\n## Example\n\n```python\nfrom serial.tools import list_ports\nfrom pydobotplus import Dobot, CustomPosition\n\nport = list_ports.comports()[0].device\ndevice = Dobot(port=port)\n\n# Create a custom position\npos1 = CustomPosition(x=200, y=50, z=50)\n\n# Move using direct coordinates\ndevice.move_to(x=200, y=50, z=50)\n\n# Move using custom position\ndevice.move_to(position=pos1)\n\n# Control the conveyor belt\ndevice.conveyor_belt(speed=0.5, direction=1)\ndevice.conveyor_belt_distance(speed_mm_per_sec=50, distance_mm=200, direction=1)\n\ndevice.close()\n```\n\n## Methods\n\n* **Dobot(port, verbose=False)** Creates an instance of Dobot connected to the given serial port.\n * **port**: _string_ with name of serial port to connect\n * **verbose**: _bool_ will print to console all serial communications\n\n* **.get_pose()** Returns the current pose of the Dobot, as a `Pose` named tuple (position and joints).\n * **position**: _Position_ with (x, y, z, r) coordinates\n * **joints**: _Joints_ with (j1, j2, j3, j4) angles\n\n* **.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.\n * **x**: _float_ x cartesian coordinate to move\n * **y**: _float_ y cartesian coordinate to move\n * **z**: _float_ z cartesian coordinate to move\n * **r**: _float_ r effector rotation\n * **wait**: _bool_ waits until the command has been executed before returning to the process - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING\n * **mode**: _MODE_PTP_ movement mode (default is `MODE_PTP.MOVJ_XYZ`) - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING\n * **position**: _Position_ object with (x, y, z, r) coordinates\n\n* **.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.\n * **x**: _float_ relative x coordinate\n * **y**: _float_ relative y coordinate\n * **z**: _float_ relative z coordinate\n * **r**: _float_ relative r rotation\n * **wait**: _bool_ waits until the command has been executed before returning to the process\n\n* **.speed(velocity, acceleration)** Changes the velocity and acceleration at which the Dobot moves to future coordinates.\n * **velocity**: _float_ desired translation velocity\n * **acceleration**: _float_ desired translation acceleration\n\n* **.suck(enable)** Enables or disables suction.\n * **enable**: _bool_ enables/disables suction\n\n* **.grip(enable)** Enables or disables the gripper.\n * **enable**: _bool_ enables/disables gripper\n\n* **.get_alarms()** Returns a set of current alarms.\n * **returns**: _set_ of `Alarm` enums\n\n* **.clear_alarms()** Clears all current alarms.\n\n* **CustomPosition(x=None, y=None, z=None, r=None)** Initializes a custom position object.\n * **x**: _float_ x coordinate\n * **y**: _float_ y coordinate\n * **z**: _float_ z coordinate\n * **r**: _float_ effector rotation - NOT USED ON MAGICIAN\n\n* **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\n\n* **DobotException** Custom exception class for handling Dobot-related errors.\n\n* **.set_color_sensor(enable=True, version=1)** Enables or disables the color sensor.\n * **enable**: _bool_ enables/disables the sensor\n * **version**: _int_ sensor version\n\n* **.get_color()** Returns the RGB values detected by the color sensor.\n * **returns**: _list_ with RGB values\n\n* **.set_ir(enable=True, port=PORT_GP4)** Enables or disables the IR sensor on the specified port.\n * **enable**: _bool_ enables/disables the sensor\n * **port**: _int_ port number\n\n* **.get_ir(port=PORT_GP4)** Returns the state of the IR sensor on the specified port.\n * **port**: _int_ port number\n * **returns**: _bool_ state of the sensor\n\n* **.conveyor_belt(speed, direction=1, interface=0)** Sets the speed and direction of the conveyor belt.\n * **speed**: _float_ speed of the conveyor belt (range: 0.0 to 1.0)\n * **direction**: _int_ direction of the conveyor belt (1 for forward, -1 for backward)\n * **interface**: _int_ motor interface (default is 0)\n\n* **.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.\n * **speed_mm_per_sec**: _float_ speed in millimeters per second (must be <= 100)\n * **distance_mm**: _float_ distance in millimeters\n * **direction**: _int_ direction of the conveyor belt (1 for forward, -1 for backward)\n * **interface**: _int_ motor interface (default is 0)\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for Dobot Magician upgraded",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/sammydick22/pydobotplus"
},
"split_keywords": [
"dobot",
" magician",
" robotics",
" m1"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0f202e0cefc5d3ed82febb1d08e33c5aa2565eef73a752a457fe1c10183ec70b",
"md5": "f7a4335a4a9b79fdc18cc1880f74667d",
"sha256": "ec94ac3f1cb4387215ce52148549a240ad4ed3b1f812b0beb004b99b580618d2"
},
"downloads": -1,
"filename": "pydobotplus-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f7a4335a4a9b79fdc18cc1880f74667d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10200,
"upload_time": "2024-07-10T03:23:21",
"upload_time_iso_8601": "2024-07-10T03:23:21.540297Z",
"url": "https://files.pythonhosted.org/packages/0f/20/2e0cefc5d3ed82febb1d08e33c5aa2565eef73a752a457fe1c10183ec70b/pydobotplus-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1b7712bf3d956a81676507d91564a5495fc8176fc586d33777dde71d182c99f",
"md5": "6f8dc0a38819c8c611cbaefc2ea2a07a",
"sha256": "7e9b9b461690348933f86bcbe78c353b00f5e7bf2129a83b27b88e6b1a2300cf"
},
"downloads": -1,
"filename": "pydobotplus-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "6f8dc0a38819c8c611cbaefc2ea2a07a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11179,
"upload_time": "2024-07-10T03:23:22",
"upload_time_iso_8601": "2024-07-10T03:23:22.549733Z",
"url": "https://files.pythonhosted.org/packages/b1/b7/712bf3d956a81676507d91564a5495fc8176fc586d33777dde71d182c99f/pydobotplus-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-10 03:23:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sammydick22",
"github_project": "pydobotplus",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"lcname": "pydobotplus"
}