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 TwistStamped
00038 from geometry_msgs.msg import Twist
00039 import tf
00040 import tf.transformations as tf_trans
00041 import sys
00042 from hrl_pr2_arms.pr2_controller_switcher import ControllerSwitcher
00043 from tabletop_pushing.srv import *
00044
00045 def initialPose(ctrl_switcher):
00046 ctrl_switcher.carefree_switch('r', '%s_cart', '$(find hrl_pr2_arms)/params/j_transpose_params_low.yaml')
00047
00048 rospy.sleep(1.0)
00049 rospy.loginfo('initializing the test node')
00050 pub = rospy.Publisher('r_cart/command_pose', PoseStamped)
00051
00052 rospy.loginfo('Finally Publishing')
00053 pose = PoseStamped()
00054 pose.header.frame_id = '/torso_lift_link'
00055 pose.header.stamp = rospy.Time(0)
00056 pose.pose.position.x = 0.3
00057 pose.pose.position.y = 0
00058 pose.pose.position.z = 0.2
00059 pose.pose.orientation.x = 0
00060 pose.pose.orientation.y = 0
00061 pose.pose.orientation.z = 0
00062 pose.pose.orientation.w = 1
00063 pub.publish(pose)
00064 rospy.sleep(4.0)
00065
00066
00067
00068 class TestNode:
00069 def move(self):
00070
00071 ctrl_switcher = ControllerSwitcher()
00072 initialPose(ctrl_switcher)
00073 rospy.loginfo('create the controller')
00074 ctrl_switcher.carefree_switch('r', '%s_cart', '$(find visual_servo)/params/rmc_cartTwist_params.yaml')
00075 rospy.sleep(0.5)
00076 pub = rospy.Publisher('r_cart/command', Twist)
00077 rospy.loginfo('created the publisher obj')
00078 pose = Twist()
00079 pose.linear.x = 0.00
00080 pose.linear.y = 0.00
00081 pose.linear.z = -.05
00082 pose.angular.x = 0.1
00083 pose.angular.y = 0.1
00084 pose.angular.z = 0.1
00085 while not rospy.is_shutdown():
00086 rospy.loginfo('Publishing following message: %s'%pose)
00087 pub.publish(pose)
00088 rospy.sleep(2.0)
00089
00090 if __name__ == '__main__':
00091 try:
00092 rospy.init_node('test_node', log_level=rospy.DEBUG)
00093 node = TestNode()
00094 node.move()
00095 except rospy.ROSInterruptException: pass