$search
00001 #! /usr/bin/python 00002 00003 #*********************************************************** 00004 #* Software License Agreement (BSD License) 00005 #* 00006 #* Copyright (c) 2009, Willow Garage, Inc. 00007 #* All rights reserved. 00008 #* 00009 #* Redistribution and use in source and binary forms, with or without 00010 #* modification, are permitted provided that the following conditions 00011 #* are met: 00012 #* 00013 #* * Redistributions of source code must retain the above copyright 00014 #* notice, this list of conditions and the following disclaimer. 00015 #* * Redistributions in binary form must reproduce the above 00016 #* copyright notice, this list of conditions and the following 00017 #* disclaimer in the documentation and/or other materials provided 00018 #* with the distribution. 00019 #* * Neither the name of the Willow Garage nor the names of its 00020 #* contributors may be used to endorse or promote products derived 00021 #* from this software without specific prior written permission. 00022 #* 00023 #* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 #* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 #* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 #* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 #* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 #* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 #* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 #* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 #* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 #* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 #* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 #* POSSIBILITY OF SUCH DAMAGE. 00035 #*********************************************************** 00036 00037 # Author: Blaise Gassend 00038 00039 # Publish information needed to interpret fingertep pressure sensor data: 00040 # - Frame id 00041 # - 00042 00043 import roslib 00044 roslib.load_manifest('fingertip_pressure') 00045 import rospy 00046 00047 from fingertip_pressure.msg import PressureInfo 00048 from fingertip_pressure.fingertip_geometry import * 00049 00050 00051 class pressureInformationPublisher: 00052 def __init__(self, dest, frame0, frame1): 00053 self.info = [] 00054 self.info.append(pressureInformation(frame0, 1)) 00055 self.info.append(pressureInformation(frame1, -1)) 00056 self.publisher = rospy.Publisher(dest, PressureInfo, latch=True) 00057 00058 def publish(self): 00059 self.publisher.publish(self.info) 00060 00061 00062 if __name__ == '__main__': 00063 00064 #@todo it would be nice to read an xml configuration file to get these parameters. 00065 rospy.init_node('pressure_sensor_info') 00066 00067 pip1=pressureInformationPublisher('pressure/r_gripper_motor_info', 00068 'r_gripper_l_finger_tip_link', 'r_gripper_r_finger_tip_link') 00069 pip2=pressureInformationPublisher('pressure/l_gripper_motor_info', 00070 'l_gripper_l_finger_tip_link', 'l_gripper_r_finger_tip_link') 00071 00072 pip1.publish() 00073 pip2.publish() 00074 00075 while not rospy.is_shutdown(): 00076 rospy.spin() 00077