compute_joint_springs.py
Go to the documentation of this file.
00001 #
00002 #
00003 # Copyright (c) 2010, Georgia Tech Research Corporation
00004 # All rights reserved.
00005 # 
00006 # Redistribution and use in source and binary forms, with or without
00007 # modification, are permitted provided that the following conditions are met:
00008 #     * Redistributions of source code must retain the above copyright
00009 #       notice, this list of conditions and the following disclaimer.
00010 #     * Redistributions in binary form must reproduce the above copyright
00011 #       notice, this list of conditions and the following disclaimer in the
00012 #       documentation and/or other materials provided with the distribution.
00013 #     * Neither the name of the Georgia Tech Research Corporation nor the
00014 #       names of its contributors may be used to endorse or promote products
00015 #       derived from this software without specific prior written permission.
00016 # 
00017 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
00018 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
00021 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00025 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00026 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 #
00028 
00029 # \author Advait Jain (Healthcare Robotics Lab, Georgia Tech.)
00030 
00031 import m3.toolbox as m3t
00032 import mekabot.hrl_robot as hr
00033 import time
00034 import math, numpy as np
00035 import hrl_lib.util as ut, hrl_lib.transforms as tr
00036 
00037 def record_initial(firenze):
00038     equilibrium_pos_list = []
00039     for i in range(50):
00040         equilibrium_pos_list.append(firenze.end_effector_pos('right_arm'))
00041 
00042     eq_pos = np.column_stack(equilibrium_pos_list).mean(1)
00043     ut.save_pickle(eq_pos,'eq_pos_'+ut.formatted_time()+'.pkl')
00044     firenze.bias_wrist_ft('right_arm')
00045 
00046 
00047 
00048 def record_joint_displacements():
00049     print 'hit ENTER to start the recording process'
00050     k=m3t.get_keystroke()
00051 
00052     pos_list = []
00053     force_list = []
00054 
00055     while k == '\r':
00056         print 'hit ENTER to record configuration, something else to exit'
00057         k=m3t.get_keystroke()
00058         firenze.proxy.step()
00059         pos_list.append(firenze.end_effector_pos('right_arm'))
00060         force_list.append(firenze.get_wrist_force('right_arm', base_frame=True))
00061 
00062     ut.save_pickle({'pos_list':pos_list,'force_list':force_list},'stiffness_'+ut.formatted_time()+'.pkl')
00063     firenze.stop()
00064 
00065 
00066 
00067 if __name__ == '__main__':
00068 
00069     settings_r = hr.MekaArmSettings(stiffness_list=[0.1939,0.6713,0.997,0.7272,0.75])
00070     firenze = hr.M3HrlRobot(connect = True, right_arm_settings = settings_r)
00071 
00072     print 'hit a key to power up the arms.'
00073     k = m3t.get_keystroke()
00074     firenze.power_on()
00075 
00076     print 'hit a key to test IK'
00077     k = m3t.get_keystroke()
00078 
00079     rot = tr.Ry(math.radians(-90))
00080     p = np.matrix([0.3,-0.40,-0.2]).T
00081 
00082     firenze.motors_on()
00083     #firenze.go_cartesian('right_arm', p, rot)
00084 
00085     # jep from springloaded door, trial 15
00086     jep = [-0.30365041761032346, 0.3490658503988659, 0.59866827092412689, 1.7924513637028943, 0.4580617747379146, -0.13602429148726047, -0.48610218950666179] 
00087     firenze.go_jointangles('right_arm', jep)
00088 
00089 
00090     print 'hit  a key to record equilibrium position'
00091     k = m3t.get_keystroke()
00092     record_initial(firenze)
00093 
00094     record_joint_displacements()
00095 
00096     print 'hit  a key to end everything'
00097     k = m3t.get_keystroke()
00098     firenze.stop()
00099 
00100 


2010_icra_epc_pull
Author(s): Advait Jain, Charles C. Kemp (Healthcare Robotics Lab, Georgia Tech)
autogenerated on Wed Nov 27 2013 12:14:43