Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 import rospy
00019 from dynamic_reconfigure.client import Client
00020 from cob_twist_controller.cfg.TwistControllerConfig import *
00021 
00022 '''
00023 Available keys for the dynamic_reconfigure update call
00024 '''
00025 NUM_FILT = 'numerical_filtering'
00026 DAMP_METHOD = 'damping_method'
00027 DAMP_FACT = 'damping_factor'
00028 LAMBDA_MAX = 'lambda_max'
00029 W_THRESH = 'w_threshold'
00030 SLOPE_DAMPING='slope_damping'
00031 BETA = 'beta'
00032 EPS_DAMP = 'eps_damping'
00033 EPS_TRUNC = 'eps_truncation'
00034 
00035 SOLVER = 'solver'
00036 PRIO = 'priority'
00037 K_H = 'k_H'
00038 
00039 CONSTR_JLA = 'constraint_jla'
00040 PRIO_JLA = 'priority_jla'
00041 K_H_JLA = 'k_H_jla'
00042 ACTIV_THRESH_JLA = 'activation_threshold_jla'
00043 ACTIV_BUF_JLA = 'activation_buffer_jla'
00044 CRIT_THRESH_JLA = 'critical_threshold_jla'
00045 DAMP_JLA = 'damping_jla'
00046 
00047 CONSTR_CA = 'constraint_ca'
00048 PRIO_CA = 'priority_ca'
00049 K_H_CA = 'k_H_ca'
00050 ACTIV_THRESH_CA = 'activation_threshold_ca'
00051 ACTIV_BUF_CA = 'activation_buffer_ca'
00052 CRIT_THRESH_CA = 'critical_threshold_ca'
00053 DAMP_CA = 'damping_ca'
00054 
00055 SIGMA_UJS = 'sigma_ujs'
00056 SIGMA_SPEED_UJS = 'sigma_speed_ujs'
00057 DELTA_POS_UJS = 'delta_pos_ujs'
00058 SIGMA_SPEED_UJS = 'delta_speed_ujs'
00059 
00060 KEEP_DIR = 'keep_direction'
00061 ENF_POS_LIM = 'enforce_pos_limits'
00062 ENF_VEL_LIM = 'enforce_vel_limits'
00063 ENF_ACC_LIM = 'enforce_acc_limits'
00064 TOL = 'limits_tolerance'
00065 MAX_VEL_LIN_BASE = 'max_vel_lin_base'
00066 MAX_VEL_ROT_BASE = 'max_vel_rot_base'
00067 
00068 KIN_EXT = 'kinematic_extension'
00069 EXT_RATIO = 'extension_ratio'
00070 
00071 '''
00072 Class inherits from dynamic_reconfigure.client.Client and implements some wrapper methods
00073 '''
00074 class TwistControllerReconfigureClient(Client):
00075 
00076     def __init__(self, timeout = None):
00077         super(TwistControllerReconfigureClient, self).__init__('twist_controller', timeout)
00078         self._current_config = {}
00079         self._update_config = {}
00080 
00081     def init(self):
00082         self._current_config = self.get_configuration()
00083         self._update_config.clear()
00084 
00085     def set_config_param(self, cfg_key, cfg_value):
00086         if cfg_key in self._current_config:
00087             self._update_config[cfg_key] = cfg_value
00088         else:
00089             rospy.logerr('Cannot update config with key {0}! Not available in current config.'.format(cfg_key))
00090 
00091     def update(self):
00092         self.update_configuration(self._update_config)
00093         self._update_config.clear()