Go to the documentation of this file.00001
00002 import matplotlib.pyplot as pp
00003 import numpy as np, math
00004
00005 import roslib; roslib.load_manifest('sandbox_advait_darpa_m3')
00006
00007 import hrl_software_simulation_darpa_m3.gen_sim_arms as gsa
00008 import hrl_common_code_darpa_m3.data_structure_conversion.skin_contact_to_resultant_force as scrf
00009 import hrl_lib.matplotlib_util as mpu
00010
00011
00012 if __name__ == '__main__':
00013 print 'Hello World'
00014
00015 import hrl_common_code_darpa_m3.robot_config.three_link_planar_capsule as d_robot
00016
00017 kinematics = gsa.RobotSimulatorKDL(d_robot)
00018
00019 q = np.radians([30., -20., 50.])
00020
00021 o, _ = kinematics.FK(q, 2)
00022 o_next, _ = kinematics.FK(q, 3)
00023
00024 v = o_next - o
00025
00026
00027
00028
00029 fc_mat = np.matrix([[2.,0.,0.], [1., 1., 0.]]).T
00030 xc_mat = o + np.column_stack([0.2 * v, 0.4*v])
00031
00032 mpu.figure()
00033 kinematics.plot_arm(q, 'b', 0.7, False)
00034 pp.axis('equal')
00035
00036 pp.quiver(xc_mat[0,:].A1, xc_mat[1,:].A1, fc_mat[0,:].A1,
00037 fc_mat[1,:].A1, units='xy', width=0.005)
00038
00039 f_res, loc = scrf.simulate_ft_sensor_on_link_base(fc_mat, xc_mat,
00040 o, o_next)
00041 print 'f_res:', f_res.A1
00042 print 'xc_mat:', xc_mat.T.A
00043 print 'loc:', loc.A1
00044
00045 pp.quiver(loc[0,:].A1, loc[1,:].A1, f_res[0,:].A1,
00046 f_res[1,:].A1, units='xy', width=0.003, color='r')
00047
00048 pp.show()
00049
00050
00051
00052
00053