loading
 
TCP/IP Modbus Connection
Anonymous  [12 posts]
3 years
Hello,
I am trying to connect a Universal Robot to Roborealm through the ethernet connector which uses the TCP/IP settings. But unfortunately I am not able to establish the connection itself.
Like the external device is detected whom I am trying to connect on my Device Manager, but the Robot Controller does not show a connectivity signal.
The ping command worked on CMD Prompt.
Any kind of help will be highly appreciated.
Thank You
Steven Gentner from United States  [1370 posts] 3 years
Romin,

I would briefly try to disable the windows firewall to ensure that this is not causing the problem.

I assume you have the right port number set?

Do you know what the robot controller needs to display a connection signal? Is it just a connection or a connection plus an initiation string?

STeven.
Anonymous  [12 posts] 3 years
Steven,
port number can be set any right? I tried 502 and few others..but the Message Log screen is blank.
I am sending COG_X
Address 255
Table : Holding Register
Slave ID : 10
Time out:  0 sec
Thread 5
But when I see the ipv4 : No network it says.
Thank You.
Steven Gentner from United States  [1370 posts] 3 years
Romin,

No, the port number is very important. You should check the documentation for the Universal Controller to see what port it accepts Modbus packets from. Note this is a lot of variation here ... so first be sure that it is talking about ModBus packets and not just a generic interface that you send commands through.

Do you have documentation for that robot?

STeven.
Anonymous  [12 posts] 3 years
Hi! Steven,
There is no particular port number given.
The Robot has its IP address 192.168.1.30 but actually we cannot use that as it will itself become a looped connection.
So, when I connect the ethernet cable to Universal Robot controller still the MESSAGE LOG  screen shows no activity.

Page 118 to page 123
you can look at Universal Robots zacobria hints and tips manual .pdf

Sorry I cannot attach it. It is 15.5MB file.
Thank You,
ROMIN
Steven Gentner from United States  [1370 posts] 3 years
Romin,

I've never used this particular robot before but I think you have the Modbus confused. The pages that you outlined in

http://www.zacobria.com/pdf/universal_robots_zacobria_hints_and_tips_manual_1_4_3.pdf

which I think is the document that you were thinking about (please include a url if you cannot post it) is NOT for programming extension. The robot has a modbus client in it that will communicate to these modules which are a modbus server. So from the robot's point of view these extensions just add to its functionality. From the documentation this is NOT the way to gain access into the robot. RR has a modbus client which might be able to communicate to this extension device but NOT the robot!

Instead, if you look at page 111 you will see

# Echo client program
import socket
HOST = "192.168.0.9" # The remote host
PORT = 30002 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send ("set_digital_out(2,True)" + "\n")
data = s.recv(1024)
s.close()
print ("Received", repr(data))

which is a very simple program in some language that shows how to communicate directly to the robot's command console. So in theory if you use

http://www.roborealm.com/help/Socket_Comm.php

and configure it for 192.168.1.30 (your robot) using port 30002 and enter

set_digital_out(2,True)<cr><lf>

in the Send Sequence and press Start that should connect to the robot and trigger the digital output #2 to become active. I assume there is some sort of LED that you can see if this is actually happening.

There appears to be a full scripting language behind that interface so you will have to read up on that in order to figure out what you want to do.

STeven.




Anonymous  [12 posts] 3 years
Steven,
I used the socket communication module of Roborealm and it does work on the screen but now the main problem I face is retrieval of COG_X from roborealm to Universal Robot so that I give other commands.
I will try the scripting thing.
I was just wondering that if TCP/IP system works then it becomes ultra easy for me to program.
Because the robot uses TCP/IP communication through repeater inserted.
Thank You very much Steven for replying.
Steven Gentner from United States  [1370 posts] 3 years
based on

http://www.zacobria.com/pdf/universal-robots-scriptmanual-en-v-1-8.pdf

page #4 you should just be able to specify

foo = [COG_X]

in the Send Sequence (instead of the previous digital thing) and in theory it will create a variable foo inside the robot's system that is equal to the COG_X in RR. Note that the [COG_X] is replaced with the COG_X value before this text is sent.

STeven.
Steven Gentner from United States  [1370 posts] 3 years
You'll probably need the newlines too

foo = [COG_X]<cr><lf>
Anonymous  [12 posts] 3 years
Steven,
I am sure that I am successfully able to send the values, but on the other part I am not at all able to retrieve.
I am using the scripting but the value received in the variable generated; they display is 0
Thank You
Steven Gentner from United States  [1370 posts] 3 years
Then try

foo = 1234

and see if that has a value. If it does, check that COG_X actually has something in it!

STeven.
Anonymous  [12 posts] 3 years
Steven,
After a lot of struggle finally I am nearing to the conclusion that I am not able to connect to the ip address through roborealm; i checked out the socket plugin too.
It says : Connecting to 192.168.1.30 and port 502
then the next line displays :Disconnected from ip and port
Because on the receiving end I am not able to get the data itself.
I use the following script commands:
socket_open("192.168.1.30",502,"sv")
var1=socket_read_ascii_float(2,"sv")

where "sv" is the name of the socket
var1 is the variable used to display the value it senses.
the output shows: [0,nan,nan] where nan stands for "not a number"

Thank You
Steven Gentner from United States  [1370 posts] 3 years
Are you sure the port is 502 and not 30002 as mentioned in the documentation?

The error means you are not getting a connection to the robot. The [0,nan,nan] is most likely due to the same reason i.e. if you are not connected the socket_read will just return zero.

Can you also post the robofile (saved RR config) that you are using? I'd like to see how you specified the syntax.

STeven.
Anonymous  [12 posts] 3 years
Steven,
that syntax which i had written was on the Controller of Universal Robot and not on RR
Still i will send you the file which I have been working on.
program.robo
Anonymous  [12 posts] 3 years
Refer tab 2
Steven Gentner from United States  [1370 posts] 3 years
Romin,

When you have problems it is best to try to reduce the problem down to the very basics and then test. Your robofile has 3 modules that use the network on port 502 which may be part of the issue. Try a MUCH simpler test and clear the pipeline and add JUST the Socket Comm module. Then

1. Configure the port correctly
2. Configure the host correctly, your robofile had localhost as the address of the robot ... unless you are running this application on the robot controller I doubt that is correct.
3. You had just [distance] in the text to send to the controller. This is incorrect. As I stated in an earlier message you have to assign the value to a variable in the robot. Just sending the value of distance isn't going to help the controller understand what to do with that value. At the very least this should look like

tst = [distance]

or better, yet, as I again stated in an earlier message you should just try typing in

tst = 1234

where you currently had [distance] just to see if a hardcoded value makes it into the controller.

Again, simple, simple, simple! Reduce the problem to the very basic and try to solve it that way. When you feel that things are working you can slowly add back in complexity. Also if what you are doing doesn't make sense, then you probably will not do it correctly and should instead backoff and understand the context to the problem. Then at least you can approach a problem with some knowledge.

For example, have you also tried using the script you have outside of RR to set a variable? Perhaps there is something that needs to be enabled in the robot to accept those types of connections. We always disable things like that in RR to avoid security issues so its possible they also have that kind of interface disabled ... again, we don't have the exact robot at hand so we can only guess at what might be going wrong.

Good luck!

STeven.
Anonymous  [12 posts] 3 years
Steven,
I noticed one odd thing that when I try to connect the socket communication then the first data value goes on message log screen, but then the system kind of stops or hangs. The software seems like it is overloaded and shows that disconnect dialogue.
Thank you
Anonymous  [12 posts] 3 years
Steven,
This happens in TCP/IP mode selected,
if UDP mode is selected the data flows flawlessly on message log screen of socket_communication
Thank You
Anonymous  [12 posts] 3 years
Steven,
I went across the ser2net tab in the options. Do you thing not declaring the hostname/ip address there might be a problem or concern for not able to connect to the Robot via roborealm through TCP/IP or socket communication?
Thank You
Anonymous  [12 posts] 3 years
Respected Steven,
I would want to know that does Roborealm have Server Socket communication?
Because that is what is required. I figured out that Robot needs to be a client always to receive the data.
If it is not there are there any chances of development of this Socket communication Model?

Thanking You,
Regards
ROMIN
Steven Gentner from United States  [1370 posts] 3 years
Romin,

It is possible but we would need access to the robot itself. Developing a module like that will not be possible without being able to test directly on the robot. Is this something you can provide? I.e. remote access over the internet to either the robot or a machine connected to the robot? We would not need the robot to be able to move but just have its internal communications running i.e. in a physically locked state. Our access would be somewhat random over a period of weeks normally for very short sessions.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index