get_robot_position.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 ###############################################################################
00003 # \file
00004 #
00005 # $Id:$
00006 #
00007 # Copyright (C) Brno University of Technology
00008 #
00009 # This file is part of software developed by dcgm-robotics@FIT group.
00010 # 
00011 # Author: Zdenek Materna (imaterna@fit.vutbr.cz)
00012 # Supervised by: Michal Spanel (spanel@fit.vutbr.cz)
00013 # Date: dd/mm/2012
00014 #
00015 # This file is free software: you can redistribute it and/or modify
00016 # it under the terms of the GNU Lesser General Public License as published by
00017 # the Free Software Foundation, either version 3 of the License, or
00018 # (at your option) any later version.
00019 # 
00020 # This file is distributed in the hope that it will be useful,
00021 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 # GNU Lesser General Public License for more details.
00024 # 
00025 # You should have received a copy of the GNU Lesser General Public License
00026 # along with this file.  If not, see <http://www.gnu.org/licenses/>.
00027 #
00028 import roslib; roslib.load_manifest('srs_user_tests')
00029 import rospy
00030 from std_srvs.srv import Empty
00031 from gazebo_msgs.srv import GetModelState
00032 
00033 def main():
00034     
00035     rospy.init_node('get_robot_position')
00036     
00037     g_get_state = rospy.ServiceProxy("/gazebo/get_model_state", GetModelState)
00038     
00039     rospy.wait_for_service("/gazebo/get_model_state")
00040     
00041     try:
00042             
00043       state = g_get_state(model_name="robot")
00044             
00045     except Exception, e:
00046         
00047       rospy.logerr('Error on calling service: %s',str(e))
00048       return
00049   
00050     print state.pose
00051   
00052 
00053 if __name__ == '__main__':
00054   try:
00055     main()
00056   except rospy.ROSInterruptException: pass


srs_user_tests
Author(s): SRS team
autogenerated on Sun Jan 5 2014 12:14:05