18 #ifndef COB_TWIST_CONTROLLER_COB_TWIST_CONTROLLER_DATA_TYPES_H 19 #define COB_TWIST_CONTROLLER_COB_TWIST_CONTROLLER_DATA_TYPES_H 27 #include <kdl/jntarray.hpp> 28 #include <kdl/chainjnttojacsolver.hpp> 29 #include <cob_twist_controller/TwistControllerConfig.h> 32 #define MIN_CRIT false 33 #define DEFAULT_CYCLE 0.02 34 #define ZERO_THRESHOLD 1.0e-9 35 #define DIV0_SAFE 1.0e-6 39 NO_DAMPING = cob_twist_controller::TwistController_NO_DAMPING,
40 CONSTANT = cob_twist_controller::TwistController_CONSTANT,
43 SIGMOID = cob_twist_controller::TwistController_SIGMOID,
50 BASE_ACTIVE = cob_twist_controller::TwistController_BASE_ACTIVE,
51 COB_TORSO = cob_twist_controller::TwistController_COB_TORSO,
52 LOOKAT = cob_twist_controller::TwistController_LOOKAT
58 WLN = cob_twist_controller::TwistController_WLN,
59 GPM = cob_twist_controller::TwistController_GPM,
67 CA_OFF = cob_twist_controller::TwistController_CA_OFF,
68 CA_ON = cob_twist_controller::TwistController_CA,
73 JLA_OFF = cob_twist_controller::TwistController_JLA_OFF,
74 JLA_ON = cob_twist_controller::TwistController_JLA,
75 JLA_MID_ON = cob_twist_controller::TwistController_JLA_MID,
123 lin_x(0.0), lin_y(0.0), lin_z(0.0), rot_x(0.0), rot_y(0.0), rot_z(0.0) {}
165 keep_direction(true),
166 enforce_input_limits(true),
167 enforce_pos_limits(true),
168 enforce_vel_limits(true),
169 enforce_acc_limits(false),
170 limits_tolerance(5.0),
173 max_vel_lin_base(0.5),
174 max_vel_rot_base(0.5)
213 controller_interface(
""),
214 integrator_smoothing(0.2),
216 numerical_filtering(false),
218 damping_factor(0.01),
224 eps_truncation(0.001),
231 constraint_ca(
CA_ON),
243 constraint_params.insert(std::pair<ConstraintTypes, ConstraintParams>(
CA, cp_ca));
252 constraint_params.insert(std::pair<ConstraintTypes, ConstraintParams>(
JLA, cp_jla));
294 void from_config(cob_twist_controller::TwistControllerConfig config)
296 numerical_filtering = config.numerical_filtering;
298 damping_factor = config.damping_factor;
299 lambda_max = config.lambda_max;
300 w_threshold = config.w_threshold;
301 slope_damping = config.slope_damping;
303 eps_damping = config.eps_damping;
304 eps_truncation = config.eps_truncation;
307 priority_main = config.priority;
314 cp_jla.
priority = config.priority_jla;
315 cp_jla.
k_H = config.k_H_jla;
316 cp_jla.
damping = config.damping_jla;
317 const double activation_jla_in_percent = config.activation_threshold_jla;
318 const double activation_buffer_jla_in_percent = config.activation_buffer_jla;
319 const double critical_jla_in_percent = config.critical_threshold_jla;
323 constraint_params[
JLA] = cp_jla;
326 cp_ca.
priority = config.priority_ca;
327 cp_ca.
k_H = config.k_H_ca;
328 cp_ca.
damping = config.damping_ca;
329 const double activaton_buffer_ca_in_percent = config.activation_buffer_ca;
333 constraint_params[
CA] = cp_ca;
335 ujs_solver_params.
sigma = config.sigma;
336 ujs_solver_params.
sigma_speed = config.sigma_speed;
337 ujs_solver_params.
delta_pos = config.delta_pos;
338 ujs_solver_params.
delta_speed = config.delta_speed;
352 extension_ratio = config.extension_ratio;
355 void to_config(cob_twist_controller::TwistControllerConfig& config)
357 config.numerical_filtering = numerical_filtering;
358 config.damping_method = damping_method;
359 config.damping_factor = damping_factor;
360 config.lambda_max = lambda_max;
361 config.w_threshold = w_threshold;
362 config.slope_damping = slope_damping;
364 config.eps_damping = eps_damping;
365 config.eps_truncation = eps_truncation;
367 config.solver = solver;
368 config.priority = priority_main;
371 config.constraint_jla = config.constraint_jla;
372 config.constraint_ca = constraint_ca;
374 config.priority_jla = constraint_params[
JLA].priority;
375 config.k_H_jla = constraint_params[
JLA].k_H;
376 config.damping_jla = constraint_params[
JLA].damping;
377 config.activation_threshold_jla = constraint_params[
JLA].thresholds.activation * 100.0;
378 config.critical_threshold_jla = constraint_params[
JLA].thresholds.critical * 100.0;
379 config.activation_buffer_jla = (constraint_params[
JLA].thresholds.activation_with_buffer/constraint_params[
JLA].thresholds.activation - 1.0)*100.0;
381 config.priority_ca = constraint_params[
CA].priority;
382 config.k_H_ca = constraint_params[
CA].k_H;
383 config.damping_ca = constraint_params[
CA].damping;
384 config.activation_threshold_ca = constraint_params[
CA].thresholds.activation;
385 config.critical_threshold_ca = constraint_params[
CA].thresholds.critical;
386 config.activation_buffer_ca = (constraint_params[
CA].thresholds.activation_with_buffer/constraint_params[
CA].thresholds.activation - 1.0)*100.0;
388 config.sigma = ujs_solver_params.
sigma;
389 config.sigma_speed = ujs_solver_params.
sigma_speed;
390 config.delta_pos = ujs_solver_params.
delta_pos;
391 config.delta_speed = ujs_solver_params.
delta_speed;
404 config.kinematic_extension = kinematic_extension;
405 config.extension_ratio = extension_ratio;
420 : current_(
NORMAL), previous_(
NORMAL), transition_(false)
425 this->transition_ = this->current_ != next_state;
426 this->previous_ = this->current_;
427 this->current_ = next_state;
432 return this->current_;
437 return this->previous_;
442 return this->transition_;
455 #endif // COB_TWIST_CONTROLLER_COB_TWIST_CONTROLLER_DATA_TYPES_H EN_ConstraintStates previous_
std::map< ConstraintTypes, ConstraintParams > constraint_params
std::vector< double > limits_min
EN_ConstraintStates getCurrent() const
bool enforce_input_limits
Eigen::Matrix< double, 6, 1 > Vector6d_t
ActiveCartesianDimension()
KinematicExtensionTypes kinematic_extension
ConstraintTypesJLA constraint_jla
KDL::JntArray current_q_dot_
ConstraintTypesCA constraint_ca
LookatAxisTypes lookat_axis_type
std::vector< std::string > collision_check_links
LookatOffset lookat_offset
std::string lookat_pointing_frame
std::vector< std::string > frame_names
Eigen::Vector3d nearest_point_obstacle_vector
std::string chain_tip_link
DampingMethodTypes damping_method
std::vector< double > limits_acc
std::map< std::string, std::vector< ObstacleDistanceData > > ObstacleDistancesInfo_t
std::string chain_base_link
void setState(EN_ConstraintStates next_state)
void to_config(cob_twist_controller::TwistControllerConfig &config)
double integrator_smoothing
bool isTransition() const
ConstraintThresholds thresholds
EN_ConstraintStates current_
void from_config(cob_twist_controller::TwistControllerConfig config)
Eigen::Vector3d frame_vector
std::vector< double > limits_max
UJSSolverParams ujs_solver_params
KDL::JntArray last_q_dot_
Eigen::Matrix< double, 6, Eigen::Dynamic > Matrix6Xd_t
std::vector< std::string > joints
std::string controller_interface
double activation_with_buffer
EN_ConstraintStates getPrevious() const
LimiterParams limiter_params
std::vector< double > limits_vel
Eigen::Vector3d nearest_point_frame_vector