luismesas / pydobot

Python library for Dobot Magician
MIT License
110 stars 59 forks source link

How do i connect 2 or more robots to one PC? #50

Open joffyy opened 1 year ago

joffyy commented 1 year ago

I use pycharm and i can get along with 1 robot. It moves, but once i connect another dobot it doesnt work. They wont move and give errors sometimes. I've tried somethings I came up with, but Im still a nooby with python ;p.

Thanks in advance!

`from serial.tools import list_ports

from pydobot import Dobot

port = list_ports.comports()[0].device

port1 = list_ports.comports()[1].device

device2 = Dobot(port=port1)

device = Dobot(port=port)

pose = device.get_pose()

print(pose)

position = pose.position

device.move_to(position.x + 20, position.y, position.z, position.r) device.move_to(position.x, position.y, position.z, position.r ) # we wait until this movement is done before continuing

device.move_to(position.x + 20, position.y, position.z, position.r) device.move_to(position.x, position.y, position.z, position.r ) # we wait until this movement is done before continuing

device.move_to(position.x + 20, position.y, position.z, position.r) device.move_to(position.x, position.y, position.z, position.r ) # we wait until this movement is done before continuing

print(list_ports.comports())

device.close()`