insert_kinect_urdf.py
Go to the documentation of this file.
00001 import os, sys
00002 
00003 stext = '<joint name="double_stereo_frame_joint" type="fixed">'
00004 
00005 rtext = '<joint name="openni_rgb_frame_joint" type="fixed">\n\
00006     <origin rpy="0.0074253744 0.0418016634 -0.0065419807" xyz="0.0440562178 -0.0135760086 0.1129906398"/>\n\
00007     <parent link="head_plate_frame"/>\n\
00008     <child link="openni_rgb_frame"/>\n\
00009   </joint>\n\
00010   <link name="openni_rgb_frame">\n\
00011     <inertial>\n\
00012       <mass value="0.01"/>\n\
00013       <origin xyz="0 0 0"/>\n\
00014       <inertia ixx="0.001" ixy="0.0" ixz="0.0" iyy="0.001" iyz="0.0" izz="0.001"/>\n\
00015     </inertial>\n\
00016     <visual>\n\
00017       <origin rpy="0 0 0" xyz="0 0 0"/>\n\
00018       <geometry>\n\
00019         <box size="0.01 0.01 0.01"/>\n\
00020       </geometry>\n\
00021     </visual>\n\
00022   </link>\n\
00023   <joint name="openni_rgb_optical_frame_joint" type="fixed">\n\
00024     <origin rpy="-1.5707963268 -0.0000000000 -1.5707963268" xyz="0.0000000000 0.0000000000 0.0000000000"/>\n\
00025     <parent link="openni_rgb_frame"/>\n\
00026     <child link="openni_rgb_optical_frame"/>\n\
00027   </joint>\n\
00028   <link name="openni_rgb_optical_frame"/>\n\
00029   <joint name="double_stereo_frame_joint" type="fixed">'
00030 
00031 def serchReplace(path):
00032     input = open(path)
00033     print "urdf:", path
00034     out = path+'.tmp'
00035     output = open(out, 'w')
00036     for s in input.xreadlines():
00037         output.write(s.replace(stext, rtext))
00038     input.close()
00039     output.close()
00040     os.rename(out, path)
00041 
00042 def usage():
00043      print "\nUsage: python ", sys.argv[0], "<robot_uncalibrated_x.x.x.xml> \n"
00044 
00045 if __name__ == "__main__":
00046     if sys.argv.__len__() == 1:
00047         usage()
00048         sys.exit(2)
00049     path = sys.argv[1]
00050     serchReplace(path)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


pcl_cloud_tools
Author(s): Nico Blodow, Zoltan-Csaba Marton, Dejan Pangercic
autogenerated on Sun Oct 6 2013 11:58:07