cody_config_test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import numpy as np
00003 import math
00004 
00005 height = 0.0
00006 l1 = 0.185-0.085
00007 l2 = 0.085
00008 l3 = 0.09
00009 l4 = 0.278-0.09
00010 l4_offset = 0.00635
00011 l5 = 0.065
00012 l6 = 0.279-0.065
00013 lee = 0.1
00014 lee_block = 0.04
00015 
00016 upper_arm = 0.25
00017 
00018 lower_arm  = 0.25
00019 arm_thck = 0.07
00020 ee_length = 0.10
00021 
00022 ee_location = np.matrix([0., -l1-l2, height-l3-l4-l5-l6-lee_block]).T
00023 bod_shapes = ['cube', 'cube', 'cube', 'cube', 'cube', 'cube']#, 'cube']  #bod_shapes = ['cylinder', 'cylinder', 'cylinder']
00024 bod_dimensions = [[arm_thck, l2, arm_thck], [arm_thck, arm_thck, l3], 
00025                   [arm_thck, arm_thck, l4],  [arm_thck, arm_thck, l5], 
00026                   [arm_thck, arm_thck, l6],  [arm_thck, arm_thck, lee_block]]#,
00027                   #[arm_thck, arm_thck, lee]] 
00028 
00029 bod_com_position = [[0., -l1-l2/2.0, height], 
00030                     [0., -l1-l2, height-l3/2.0], 
00031                     [0., -l1-l2, height-l3-l4/2.0], 
00032                     [0., -l1-l2, height-l3-l4-l5/2.0],
00033                     [0., -l1-l2, height-l3-l4-l5-l6/2.0],
00034                     [0., -l1-l2, height-l3-l4-l5-l6-lee_block/2.0]]#,
00035                     #[0., -l1-l2, height-l3-l4-l5-l6-lee/2.0]]
00036                     
00037 bod_color = [[0.4, 0.4, 0.4, 1], [0.8, 0.8, 0.8, 1], [0.33, 0.3, 0.33, 1], 
00038              [0.4, 0.4, 0.4, 1], [0.8, 0.8, 0.8, 1], [0.33, 0.33, 0.33, 1]]#, 
00039              #[0.05, 0.05, 0.05, 1]]
00040 bod_num_links = 6 #7
00041 bod_mass = [2.0, 0.636, 2.3, 0.339, 1.18, 0.32]#, 0.32]
00042 
00043 # if we do stuff other than cubes, we'll need to be really careful with rotations,
00044 # it was a pain before - 17 May 2011, marc
00045 #bod_rotation = [[0, 0, -1, 0, 1, 0, 1, 0, 0], [0, 0, -1, 0, 1, 0, 1, 0, 0], [0, 0, -1, 0, 1, 0, 1, 0, 0]]
00046 bod_names = ['link1', 'link2', 'link3', 'link4', 'link5', 'link6', 'link7']
00047 bodies ={'shapes':bod_shapes, 'dim':bod_dimensions, 'num_links':bod_num_links,
00048          'com_pos':bod_com_position, 'mass':bod_mass, 'name':bod_names, 'color':bod_color}
00049          #'rotation':bod_rotation, 'color':bod_color, 'density':bod_density, }
00050 
00051 #When we want to make very general, we'll need this again - marc 17 May 2011
00052 #b_jt_type = ['revolute', 'revolute', 'revolute']
00053 #b_jt_vis_size = [[0.07, 0.07, 0.07], [0.07, 0.07, 0.07], [0.07, 0.07, 0.07]]
00054 #b_jt_vis_color = [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]]
00055 #b_jt_feedback = [0, 0, 0]
00056 
00057 b_jt_axis = [[0.,-1.0,0.],[-1.,0.,0.], [0., 0., -1.], [0.,-1.,0.], [0., 0., -1.], [0., 1., 0.]]#, [1., 0., 0.]]
00058 b_jt_anchor = [[0., -l1, height], [0., -l1-l2, height],
00059                [0., -l1-l2, height-l3],
00060                [0., -l1-l2, height-l3-l4],
00061                [0., -l1-l2, height-l3-l4-l5],
00062                [0., -l1-l2, height-l3-l4-l5-l6]]#,
00063                #[0., -l1-l2, height-l3-l4-l5-l6]]
00064 b_num_jts = 6 # 7
00065 b_jt_limits_max = np.radians([ 120., 122., 77.5, 144., 122.,  45.]).tolist()  #45.
00066 b_jt_limits_min = np.radians([ -47.61,  -20., -77.5,   -5.0, -80., -45.]).tolist()  #-45.
00067 b_jt_attach = [[0, -1], [1, 0], [2,1], [3,2], [4,3], [5,4]]#, [6,5]]
00068 b_jt_start = np.radians([0., 0., 0., 0., 0., 0.]).tolist() #0.
00069 
00070 b_jts = {'anchor':b_jt_anchor, 'axis':b_jt_axis, 'jt_lim_max':b_jt_limits_max,
00071          'jt_lim_min':b_jt_limits_min, 'jt_init':b_jt_start, 'jt_attach':b_jt_attach, 'num_jts':b_num_jts}
00072          #'bodies':b_jt_bodies, 'jt_type':b_jt_type, 
00073          #'vis_size':b_jt_vis_size, 'vis_color':b_jt_vis_color, 'feedback':b_jt_feedback
00074 
00075 if __name__ == '__main__':
00076     import roslib; roslib.load_manifest('darpa_m3')
00077     import rospy
00078 
00079     # uploading to the param server so that the ODE C++ software
00080     # simulation creates a robot with the dimensions etc. specified in
00081     # this file.
00082     rospy.init_node('arm_config_upload')
00083     rospy.set_param('m3/software_testbed/joints/axes', b_jts['axis'])
00084     rospy.set_param('m3/software_testbed/joints/anchor', b_jts['anchor'])
00085     rospy.set_param('m3/software_testbed/joints/max', b_jts['jt_lim_max'])
00086     rospy.set_param('m3/software_testbed/joints/min', b_jts['jt_lim_min'])
00087     rospy.set_param('m3/software_testbed/joints/attach', b_jts['jt_attach'])
00088     rospy.set_param('m3/software_testbed/joints/init_angle', b_jts['jt_init'])
00089     rospy.set_param('m3/software_testbed/joints/num_joints', b_jts['num_jts'])
00090     rospy.set_param('m3/software_testbed/linkage/dimensions', bodies['dim'])
00091     rospy.set_param('m3/software_testbed/linkage/colors', bodies['color'])
00092     rospy.set_param('m3/software_testbed/linkage/mass', bodies['mass'])
00093     rospy.set_param('m3/software_testbed/linkage/positions', bodies['com_pos'])
00094     rospy.set_param('m3/software_testbed/linkage/num_links', bodies['num_links'])
00095     rospy.set_param('m3/software_testbed/linkage/shapes', bodies['shapes'])
00096     rospy.set_param('m3/software_testbed/linkage/link_names', bodies['name'])
00097 
00098 
00099 


hrl_common_code_darpa_m3
Author(s): Advait Jain, Marc Killpack. Advisor: Prof. Charlie Kemp. Healthcare Robotics Lab, Georgia Tech
autogenerated on Wed Nov 27 2013 11:34:42