Is there any example for sending simple messages via the Tool Communication Interface?
I tried to communicate from a UR10e with my laptop via a RS485-USB-Adapter with a slightly changed mydaemonswing example.
in That example i just added this to the get_message method :
return "Hello Mr. " + str(name) + “, welcome to PolyScope!”
return “No name set”
ser = serial.Serial(port='/dev/ttyTool',baudrate=115200) ser.isOpen() ser.write("hi") ser.close()
The pyserial library is in the same daemon folder as the hello_world.py file. The library-version is 3.4. I expect to get
a “hi”-message everytime i use the program node but my laptop is not receiving any message.
How far am i from the proper approach of using this Interface?
Did you enable the Tool Communication Interface in PolyScope?
By default, the TCI is disabled, and the pins are acting as analog inputs.
/dev/ttyTool resource is activated by enabling the TCI in PolyScope, or by the according URScript command.
I did enable the TCI manually in Polyscope. Is my approach of using the Interface fundamentally correct?
Or could it be a problem with the pyserial version?
Thank you for the fast reply.
Fundamentally, the approach is correct.
Could indeed be related to the implementation of pyserial.
I discovered the problem. It was my mistake.
The part of the serial communication was after the the return statement of the method so it wasn’t really executed.
Now it is working.
I am also trying to do this to see if I can get some sort of serial communication with my laptop.
I downloaded the 3.4 pyserial by running the command
python -m pip install pyserial
In addition, I used the mydeamon.urcap sample and just changed the .py file to:
I connected RS485 wire of wrist 3 to a USB converter and into my pc in order to see If I can simply read a message. I was planning on running PuTTY to establish a connection for reading.
However, I cannot even run the program because in the Installation Node it states My Deamon Swing Failed. I can’t seem to figure out the problem.
You’ll have to copy the pyserial library into the same path as the python daemon.
Do that inside the Eclipse IDE and recompile the plugin.
How can I copy the pyserial library?
Where is the pyserial library?
I just install the pyserial using “pip install pyserial” command.
And I can run the python daemon file in the shell with no error.
I tested this with ‘/dev/ttyUSB0’.
And I just change the access permissions of the ‘/dev/ttyUSB0’…
$ sudo chmod 777 /dev/ttyUSB0
and… the daemon runs successfully.
Not entirely sure where python’s libraries are stored, but would I need to take this folder:
And copy it into this directory:
(EDIT: I tried it and it seems to work much thanks!!)
It seems like the location on the pyserial library is in
And it is the serial folder.
Also, you stated that the deamon runs successfully when using '/dev/ttyUSB0. Out of curiosity, were you running ths ont he UR simulator? Because I cannot seem to find /dev/ttyUSB0
I am running the ursim on my laptop. And I connected the usb to serial device to the laptop. /dev/ttyUSB0 is the usb to serial device.
Ahhh I see, so you connected a USB to your laptop which leads to a serial device. Which I assume creates that “/dev/ttyUSB0” port.
What I was doing was using a physical UR robot and connected its Tool Communication Interface to my laptop using a RS485 to USB converter so I had to use “/dev/ttyTool” since it is the built in port on the robot.
(NOTE: first you have to enable this since it is default is disabled)
Installation > General > Tool > Enable