def __init__(self): """ """ self.lib = EtherCAT_Hand_Lib() self.joint_name = "FFJ3" if rospy.has_param("~joint_name"): self.joint_name = rospy.get_param("~joint_name") self.min = 0.0 if rospy.has_param("~min"): self.min = rospy.get_param("~min") self.max = 1.55 if rospy.has_param("~max"): self.max = rospy.get_param("~max") self.nb_repetition = 2 if rospy.has_param("~nb_repetition"): self.nb_repetition = rospy.get_param("~nb_repetition") print " nb repetition: ", self.nb_repetition self.sign = -1 if rospy.has_param("~sign"): self.sign = rospy.get_param("~sign") rospy.loginfo("sign: " + str(self.sign)) self.publisher = rospy.Publisher( "/sr_friction_compensation/" + self.joint_name, Float64) self.rate = rospy.Rate(100) self.forces = [] self.positions = []
def __init__(self, context): super(SrGuiManipulation, self).__init__(context) self.setObjectName('SrGuiManipulation') # Set by call to process_collision_map() self.collision_support_surface_name = None self.raw_objects = None self.found_objects = {} self.unknown_object_counter = 1 #starts at 1 as it's only used for display self.service_tabletop_collision_map = None self.service_db_get_model_description = None self.service_object_detector = None self_dir = os.path.dirname(os.path.realpath(__file__)) self.config_dir = os.path.join(self_dir, '../config') self.ui_dir = os.path.join(self_dir, '../../ui') # UI setup self._widget = QWidget() ui_file = os.path.join(self.ui_dir, 'SrGuiManipulation.ui') loadUi(ui_file, self._widget) self._widget.setObjectName('SrGuiManipulationUi') context.add_widget(self._widget) self.object_chooser = ObjectChooser(self._widget, self, "Objects Detected") self._widget.chooser_layout.addWidget(self.object_chooser) self.object_chooser.draw() # Bind button clicks self._widget.btn_detect_objects.pressed.connect(self.detect_objects) self._widget.btn_collision_map.pressed.connect( self.process_collision_map) self._widget.btn_collision_map.setEnabled(False) self._widget.btn_start_grab_position.pressed.connect( self.start_grab_position) # self._widget.btn_zero_position.pressed.connect(self.zero_position) self._widget.btn_zero_position.pressed.connect(self.redo_place) self.robot_lib_eth = EtherCAT_Hand_Lib() # Guillaume: Currently removed because requires ethercat to be active to run, ethercat does exist in sim # if not self.robot_lib_eth.activate_joint_states(): # logerr("The EtherCAT Hand node doesn't seem to be running") # self.robot_lib_can = ShadowHand_ROS() # if not self.robot_lib_can.has_arm(): # logerr("The CAN Arm node doesn't seem to be running") self.init_services() self.init_joint_pubs()