set_relationship.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 import uuid
00005 import unique_id
00006 import world_canvas_msgs.srv
00007 
00008 from rospy_message_converter import message_converter
00009 
00010 
00011 if __name__ == '__main__':
00012     rospy.init_node('set_relationship')
00013     
00014     id      = rospy.get_param('~id')
00015     related = rospy.get_param('~relationship')
00016     action  = rospy.get_param('~action')
00017 
00018     rospy.loginfo("Waiting for set_relationship service...")
00019     rospy.wait_for_service('set_relationship')
00020 
00021     rospy.loginfo("%s relationship %s for annotation %s", "Add" if action == 1 else "Remove", related, id)
00022     set_rel_srv = rospy.ServiceProxy('set_relationship', world_canvas_msgs.srv.SetRelationship)
00023     response = set_rel_srv(unique_id.toMsg(uuid.UUID('urn:uuid:' + id)),
00024                            unique_id.toMsg(uuid.UUID('urn:uuid:' + related)), action)
00025 
00026     if response.result == True:
00027         rospy.loginfo("Relationship %s successfully %s. %s", related, "added" if action == 1 else "removed", response.message)
00028     else:
00029         rospy.logerr("%s relationship %s failed; %s", "Add" if action == 1 else "Remove", related, response.message)


world_canvas_server
Author(s): Jorge Santos Simón
autogenerated on Thu Jun 6 2019 21:25:07