ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Communicate with ros through XML-RPC

asked 2019-05-22 22:23:00 -0500

amrani gravatar image

Hi guys, I am working on a project where i need to communicate to ROS( i plan motion for robot arm using moveit) from NVIDIA (i get command from the robot hand got to pose using XML-RPC python server) to issues some command to the hannd. i would like to know the way to run a server and pass XMLRPC resquest to the hand i am pretty new in ROS

edit retag flag offensive close merge delete

Comments

Could you clarify what you mean by "from NVIDIA"?

Geoff gravatar image Geoff  ( 2019-05-23 18:14:03 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-05-23 18:26:52 -0500

Geoff gravatar image

The simplest approach is to write a new node using rospy that uses XMLRPC to talk to your XMLRPC server that is providing the pose for the hand to go to. This node would:

  1. Set up a MoveIt 'move_group' for talking to the robot arm.
  2. Talk to the XMLRPC server to receive the target pose.
  3. Copy that pose into the MoveIt structure to the geometry_msgs.msg.Pose data type.
  4. Send that pose to MoveIt using the move_group.

If you are getting the target pose from an XMLRPC client rather than a server, then your node will need to set up an XMLRPC server, and in response to receiving a target pose from an XMLRPC client it would perform the above steps 3 and 4.

If you are completely new to ROS, then I recommend going through the basic ROS tutorials for rospy first so you understand the concepts, and then going through the MoveIt Python tutorial as well so you know how to use the MoveIt API.

edit flag offensive delete link more

Comments

@Geoff, thank you for the reply, The hand houses an embedded computer that runs Ubuntu Linux 16.04 (this is what i mean by NVIDIA) but without ROS installed on it. So if i clearly understood : i already created the XML-RPC server on the hand, and now i need to create XMLRPC client on ROS ? - this XMLRPC client need to communicate with the server to receive the target pose from the hand . -copy and send the pose to move-group - i get the pose from the server which means i will use the first method you mentioned Yes i am pretty new in ROS, if there's an example close to what i am trying to do will be helpful as well

amrani gravatar image amrani  ( 2019-05-23 20:29:09 -0500 )edit

This is the XMLRPC serveur on the hand

class RequestHandler(SimpleXMLRPCRequestHandler):
    rpc_paths = ('/RPC2')

    def do_OPTIONS(self):
        self.send_response(200)
        self.end_headers()

. . .

def listToPose(l):
  assert type(l) is list
  return {'x' : l[0], 'y' : l[1], 'z' : l[2], 'rx' : l[3], 'ry' : l[4], 'rz' : l[5]}

def get_object_defs():
        print("Object definitions requested")
        return "M3 Screw%Banana%Ratstail%Apple%Newby%No_underscore%Complex screw, 110#3%Not so nice long string%And one last one"


def get_object_pose(object):
        pose = [0.563, -0.114, 0.22, 2.20, 2.223,0]
        return listToPose(pose)
print("Starting XML-RPC server on port 8101")
server = SimpleXMLRPCServer(("", 8101),requestHandler=RequestHandler)
server.register_introspection_functions()

. .

server.register_function(get_object_pose)
server.serve_forever()
amrani gravatar image amrani  ( 2019-05-23 20:56:52 -0500 )edit

A link to complete code that we can run is better than separate chunks from a file. Use a Gist if you have to.

Geoff gravatar image Geoff  ( 2019-05-26 18:14:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-05-22 22:23:00 -0500

Seen: 929 times

Last updated: May 23 '19