Go to the documentation of this file.00001 import roslib
00002 roslib.load_manifest("phantom_omni")
00003 import rospy
00004 import tf
00005 import tf.transformations as tr
00006 import hrl_lib.tf_utils as tfu
00007
00008 from geometry_msgs.msg import PoseStamped
00009 from geometry_msgs.msg import Pose
00010 from geometry_msgs.msg import Wrench
00011
00012 import math
00013 import numpy as np
00014
00015 rospy.init_node("omni_potential_well")
00016 wpub = rospy.Publisher('omni1_force_feedback', Wrench)
00017
00018 def pose_cb(ps):
00019 m_f, frame = tfu.posestamped_as_matrix(ps)
00020 m_o1 = tfu.transform('/omni1', frame, listener) * m_f
00021 ee_point = np.matrix(tr.translation_from_matrix(m_o1)).T
00022 center = np.matrix([-.10, 0, .30]).T
00023 dif = 30*(center - ee_point)
00024
00025 force_o1 = dif
00026
00027 force_s = tfu.transform('/omni1_sensable', '/omni1', listener) * np.row_stack((force_o1, np.matrix([1.])))
00028 print np.linalg.norm(center - ee_point)
00029
00030 wr = Wrench()
00031 wr.force.x = force_s[0]
00032 wr.force.y = force_s[1]
00033 wr.force.z = force_s[2]
00034 wpub.publish(wr)
00035
00036 rospy.Subscriber('/omni1_pose', PoseStamped, pose_cb)
00037 r = rospy.Rate(1)
00038
00039 listener = tf.TransformListener()
00040 listener.waitForTransform("/omni1", "/omni1_sensable", rospy.Time(), rospy.Duration(4.0))
00041 listener.waitForTransform("/omni1", "/omni1_link6", rospy.Time(), rospy.Duration(4.0))
00042 print 'running.'
00043
00044
00045 well_center = None
00046 while not rospy.is_shutdown():
00047 r.sleep()
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
phantom_omni
Author(s): Hai Nguyen, Marc Killpack, Chi-Hung King, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:51:14