DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
MarkEGuida

FIRST QUESTION:
Ok, so I have a simple XMLRPC server running on my PC and I can communicate with it from  URSim.  The issue I'm having now is controlling the data types coming back to the robot.  I'm using the same basic URP scripting that UR has in their support section.

BEFORE START:
     pallet_server := rpc_factory("xml_rpc", "http://192.168.0.55:8000/RPC2")

ROBOT PROGRAM:
     get_next_pose := pallet_server.p_next_box(5)

On the server, this opens up a CSV file and strips out the 5th entry in the Box# column (using DictReader() class to read the CSV).  When I run the simple Python client below, I enter 5 and it's works fine.
import xmlrpc.client
import csv

s = xmlrpc.client.ServerProxy('http://192.168.0.55:8000/RPC2')

index = input("Box Number: ")
print(s.p_next_box(index))

When I run the UR program I get the following error:
zoom

The "current_box" variable is nested inside an IF statement (not showing all my code, obviously):
def get_next_box_location(index):
    with open('PalletDefinitionSheet.csv') as csvfile:
        reader = csv.DictReader(csvfile)
            for row in reader:
                if row['Box#']==index:
                    current_box=row['X']
                    print(current_box)
    return (current_box)
server.register_function(get_next_box_location, 'p_next_box')
Like I said before, this code works fine when I run the plain Python client request, but I get the error when I run it in my URP.  If I put the assignment of "current_box" before the IF, I always get that value returned.  Any ideas as to why this is happening?


SECOND QUESTION:
If I monkey my code around so I get SOMETHING back that's usable, I get a data type mismatch.  Polyscope tells me that I am sending string when it expects pose or list of joint positions.  In the Python shell I see the output as:
[0.25,0.52,0.08,0,0,d2r(0)]
However, it arrives in Polyscope as:
"[0.25,0.52,0.08,0,0,d2r(0)]"
Any idea how to handle this?