Communicate with ros through XML-RPC
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
Asked by amrani on 2019-05-22 22:23:00 UTC
Answers
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:
- Set up a MoveIt 'move_group' for talking to the robot arm.
- Talk to the XMLRPC server to receive the target pose.
- Copy that pose into the MoveIt structure to the
geometry_msgs.msg.Pose
data type. - 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.
Asked by Geoff on 2019-05-23 18:26:52 UTC
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
Asked by amrani on 2019-05-23 20:29:09 UTC
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()
Asked by amrani on 2019-05-23 20:56:52 UTC
Comments
Could you clarify what you mean by "from NVIDIA"?
Asked by Geoff on 2019-05-23 18:14:03 UTC