Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 import roslib; roslib.load_manifest('tabletop_pushing')
00035 import rospy
00036 from geometry_msgs.msg import PoseStamped
00037 from geometry_msgs.msg import Pose
00038 from geometry_msgs.msg import TwistStamped
00039 import tf
00040 import tf.transformations as tf_trans
00041 import sys
00042 from hrl_pr2_arms.pr2_controller_switcher import ControllerSwitcher
00043
00044 class TestNode:
00045 def talk(self):
00046
00047 isStamped = True;
00048 if (isStamped):
00049 rospy.loginfo('created the controller')
00050 ctrl_swtch = ControllerSwitcher()
00051
00052 ctrl_swtch.carefree_switch('r', '%s_cart', '$(find hrl_pr2_arms)/params/j_transpose_params_low.yaml')
00053
00054
00055
00056
00057
00058 rospy.sleep(1.0)
00059
00060 rospy.loginfo('initializing the test node')
00061 pub = rospy.Publisher('r_cart/command_pose', PoseStamped)
00062
00063 rospy.loginfo('Finally Publishing')
00064 pose = PoseStamped()
00065 pose.header.frame_id = '/torso_lift_link'
00066 pose.header.stamp = rospy.Time(0)
00067 pose.pose.position.x = 0.1
00068 pose.pose.position.y = -0.2
00069 pose.pose.position.z = -0.2
00070 pose.pose.orientation.x = 0.5
00071 pose.pose.orientation.y = 0.5
00072 pose.pose.orientation.z = 0.5
00073 pose.pose.orientation.w = 0.5
00074 while not rospy.is_shutdown():
00075 pose.pose.position.x = pose.pose.position.x + 0.025
00076 rospy.loginfo('Publishing following message: %s'%pose)
00077 pub.publish(pose)
00078 rospy.sleep(0.5)
00079
00080 else:
00081
00082
00083
00084 rospy.loginfo('created the controller')
00085 ctrl_swtch = ControllerSwitcher()
00086 ctrl_swtch.carefree_switch('r', '%s_cart', '$(find tabletop_pushing)/params/rmc_cartPose_params.yaml')
00087 rospy.sleep(1.0)
00088
00089 rospy.loginfo('initializing the test node')
00090 pub = rospy.Publisher('r_cart/command', Pose)
00091
00092 rospy.loginfo('Finally Publishing')
00093 pose = Pose()
00094 pose.position.x = 0.3
00095 pose.position.y = -0.2
00096 pose.position.z = -0.20
00097 pose.orientation.x = 0.7071
00098 pose.orientation.y = 0
00099 pose.orientation.z = 0
00100 pose.orientation.w = 0.7071
00101 while not rospy.is_shutdown():
00102 pose.position.x = pose.position.x + 0.05
00103 rospy.loginfo('Publishing following message: %s'%pose)
00104 pub.publish(pose)
00105 rospy.sleep(0.5)
00106
00107
00108
00109
00110
00111 if __name__ == '__main__':
00112 try:
00113 rospy.init_node('test_node', log_level=rospy.DEBUG)
00114 node = TestNode()
00115 node.talk()
00116 except rospy.ROSInterruptException: pass