Go to the documentation of this file.00001
00002 import roslib; roslib.load_manifest('pr2_doors_epc')
00003 import rospy
00004 import hrl_lib.transforms as tr
00005 import force_torque.FTClient as ftc
00006 import math, numpy as np
00007
00008 from rviz_marker_test import *
00009 from hrl_msgs.msg import FloatArray
00010
00011 if __name__ == '__main__':
00012 ft_client = ftc.FTClient('force_torque_ft2')
00013 ft_client.bias()
00014 marker_pub = rospy.Publisher('/test_marker', Marker)
00015 ati_pub = rospy.Publisher('/ati_ft', FloatArray)
00016
00017 p_st = np.matrix([0.,0.,0.]).T
00018 force_frame_id = 'r_wrist_roll_link'
00019 while not rospy.is_shutdown():
00020 ft = ft_client.read(fresh = True)
00021 rmat = tr.Rx(math.radians(180.)) * tr.Ry(math.radians(-90.)) * tr.Rz(math.radians(30.))
00022 force = rmat * ft[0:3,:]
00023 print 'Force:', force.A1
00024
00025
00026 force_scale = 0.1
00027 p_end = p_st + force * force_scale
00028 marker = get_marker_arrow(p_st, p_end, force_frame_id)
00029 marker_pub.publish(marker)
00030
00031 farr = FloatArray()
00032 farr.header.stamp = rospy.rostime.get_rostime()
00033 farr.header.frame_id = force_frame_id
00034 farr.data = (-force).A1.tolist()
00035 ati_pub.publish(farr)
00036
00037
00038