I’m using the python SDK to control the uArm. I would like to control 2 or more uArms connected to the same computer. I don’t need the uArms to be coordinated in any way so they are called from separate python scripts.
To get an instance of uArm, I use the python command
u = SwiftAPI()
The SwiftAPI doesn’t seem to have a COM port parameter. How do I reference the different uArm connected to the same computer?
In case other find this useful, this is what I found to be the simplest python code initialize the Swift Pro by COM port. uCOM stores the COM port in string.
desc=‘Arduino Mega 2560 (’+uCOM+‘)’
u=SwiftAPI(filters = {‘description’: desc})
If the tasks don’t need to be synchronized in any way, just open another python console and connect the uArm via their assigned COM ports. These COM ports will not change if you consistently plug the same uArm into the same USB port.
You can do this again and again to control as many uArms as you like.
If you need some sort of communication between the uArm, I find the Pyro4 python package pretty simple for remote function calls between the python consoles.
As I can see on my Mac, the Product ID and Vendor ID of two uarms are same, which are 0042 & 2341, the only difference is their Location ID, which are 14500000 / 28 & 14500000 / 29. However, when I plugged out one uarm and plugged in again, its Location ID changed to 14500000 / 32 from 14500000 / 28. Could you explain in detail how to connect the uArm via their assigned COM ports in two python console? I’m a green hand and thanks in advance!!!
I use Windows OS, so I can’t give you any detailed procedure. It appears that Mac OS doesn’t identify its USB ports as COM ports.
I can explain how you can figure it out in concept. In my command above, the ‘filter’ does a search in the description field for USB devices that match the desc. There must be a difference or you can’t identify your uArms between each other.
u=SwiftAPI()
print(u.get_device_info())
With both uArms plugged in, SwiftAPI() should grab the first one (by whatever scheme it use to consider first). You probably only want to plug one uArm in at a time to a specific USB port (not the same USB port for both uArm). The device info should have some differences which you can use to find a specific uArm using the filter argument in the SwiftAPI() initialization.