test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib
00003 roslib.load_manifest('srs_decision_making')
00004 from simple_script_server import *
00005 sss = simple_script_server()
00006 import tf
00007 from geometry_msgs.msg import *
00008 import time
00009 
00010 from srs_knowledge.srv import *
00011 
00012 
00013 rospy.init_node('test')
00014 
00015 getWorkspace = rospy.ServiceProxy('get_workspace_on_map', GetWorkspaceOnMap)
00016 all_workspaces_on_map = getWorkspace(os.environ['ROBOT_ENV'], True)
00017 
00018 target_object_name ='Table0'
00019 #rospy.INFO ('target object is:', target_object_name)
00020         
00021 #get the index of the target workspace e.g. table0    
00022 index_of_the_target_workspace = all_workspaces_on_map.objects.index(target_object_name)
00023 #get the pose of the workspace from knowledge service
00024 target_object_pose = all_workspaces_on_map.objectsInfo[index_of_the_target_workspace].pose
00025 #get the houseHoldID of the workspace 
00026 object_id = all_workspaces_on_map.houseHoldId[index_of_the_target_workspace]
00027 
00028 rospy.loginfo ("target name: %s", target_object_name)      
00029 rospy.loginfo ("target pose: %s", target_object_pose)
00030 rospy.loginfo ("target id: %s", object_id)
00031 
00032 
00033 """
00034 
00035 = 'base_link';
00036 =self.listenr
00037 
00038 tf.TransformListener.transformPose('/map', zero_pose_, robot_pose_global_)
00039 
00040 robot_position_2D = Pose2D()
00041 
00042 robot_position_2D = position.x
00043 x_last_ = robot_pose_global_.pose.position.x;
00044 y_last_ = robot_pose_global_.pose.position.y;
00045 theta_last_ = tf::getYaw(robot_pose_global_.pose.orientation);
00046 
00047 
00048 geometry_msgs::PoseStamped robot_pose_global_;
00049 
00050 geometry_msgs::PoseStamped goal_pose_global_;
00051 geometry_msgs::PoseStamped zero_pose_;
00052 
00053 zero_pose_.pose.position.x = 0.0;
00054 zero_pose_.pose.position.y = 0.0;
00055 zero_pose_.pose.position.z = 0.0;
00056 zero_pose_.pose.orientation = tf::createQuaternionMsgFromYaw(0.0);
00057 zero_pose_.header.frame_id = robot_frame_;
00058 
00059 try{
00060 tf_listener_.transformPose('/map', zero_pose_, robot_pose_global_);
00061 }
00062 catch(tf::TransformException& ex){
00063 ROS_WARN("Failed to find robot pose in global frame %s", 'map';
00064 return zero_pose_;
00065 }
00066 """


srs_decision_making
Author(s): Renxi Qiu
autogenerated on Sun Jan 5 2014 12:08:52