Home Programming

Discussion

Left ArrowBack to discussions page
rafaelrojasrafaelrojas Posts: 7 Apprentice
I'm implementing a XMLRPC. The server is my computer with IP 192.168.1.5 and listening at port 5000. On the side of the UR3 robot, I have implement the XMLRPC in urcript language. During the program execution I got the error "Type error: a list cannot contain this data type: Variable String" when the XMLRPC is performed. The same error can be reproduced with the following simple code:
proxy = rpc_factory( "xmlrpc" , "http://192.168.1.5:5000" )
proxy.getss("/")<br>
I have confirmed that the UR3 controller sends the correct XMLRPC to my server which sends the following answer
&lt;methodResponse&gt;
&lt;params&gt;
&lt;param&gt;
&lt;value&gt;&lt;array&gt;&lt;data&gt;
&lt;value&gt;&lt;int&gt;1&lt;/int&gt;&lt;/value&gt;
&lt;value&gt;&lt;string&gt;hello&lt;/string&gt;&lt;/value&gt;
&lt;value&gt;&lt;array&gt;&lt;data&gt;
&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;
&lt;/param&gt;
&lt;/params&gt;
&lt;/methodResponse&gt;
The answers is correctly received by the robot's controller, I have confirmed it with Wireshark. Here is a screenshot of the error


Any idea about the reason of the problem? it is not possible to implement a callback for the XMLRPC ??


Best Answer

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,157 Handy
    Accepted Answer
    Unfortunately, not if you are returning a list, it cannot contain anything other than numbers or poses. We have a feature request in to UR to support strings and Boolean in lists but it has not been released at this time. 

    Are you using a commercial xmlrpc server?  We have our own that we use and just make sure that we aren't returning any types that are not accepted. 

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,157 Handy
    edited September 2017
    @rafaelrojas lists can only contain numbers or poses, not strings or lists. The error you are receiving is trying to tell you that you are returning the wrong type of value for the type of variable you have defined. Make the server return a list of numbers and you should not have any error. 

    Another thing to understand, variables are statically typed in URscript so once a variable is declared you cannot change the type of data being stored in a variable dynamically. For instance, if you declare variable "x" as 1 you cannot later change the value to "blue" without throwing a type error. 
  • rafaelrojasrafaelrojas Posts: 7 Apprentice
    Hello Matthew, thanks for your answer. Very useful, however, it is impossible to modify the server for sending only number. The example above is just an illustrative example of the real code and that XMLRPC server is part of a wider system. Generally, XMLRPC are made to handle different types, there is not a way to handle this with some pre-defined urscript function?
  • rafaelrojasrafaelrojas Posts: 7 Apprentice
    We are using a XMLRPC developed in my university. There is a way to import python or C functions into urscript language?
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,157 Handy
    You can write functions in URScript, syntax is similar to python but you have to use the URScript  syntax and language APi
  • manjunath13manjunath13 Posts: 12 Apprentice
    Hi @matthewd92, i would like to know if we can write functions to split and concatenate strings, if not how to do it in urcap, i feel its good to have tutorial for it.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,157 Handy
    @manjunath13 there’s no script functions for doing string manipulation on the robot. You would have to either write a URCap to do that and use Java for the string manipulation or do something with either XMLRPC on the robot or off the robot to do that. We have our own XMLRPC that we use for doing a lot of manipulation of values on the robot such as concatenation of strings and variables for use on the robot or averaging the value of variables in a list without looping through the list. 
  • manjunath13manjunath13 Posts: 12 Apprentice
    thank you @matthewd92 ,
    i would like to know how to create and run a xmlrpc server on universal robot 
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,157 Handy
    @manjunath13 we do not run our server on the robot but rather on a separate computer. To run on the robot you would need to create a program, probably python, that you could execute on the robot as a service or create a URCap  daemon that can be launched and run in the background. The easiest if you are dealing with robots in a plant would be to create a xmlrpc server on the network and then all of the robots could use that one server. 
Sign In or Register to comment.
Left ArrowBack to discussions page