00001 /* 00002 * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 #include <eigen_conversions/eigen_kdl.h> 00019 #include "cob_twist_controller/kinematic_extensions/kinematic_extension_builder.h" 00020 00021 00022 /* BEGIN KinematicExtensionBuilder *****************************************************************************************/ 00026 KinematicExtensionBase* KinematicExtensionBuilder::createKinematicExtension(const TwistControllerParams& params) 00027 { 00028 KinematicExtensionBase* keb = NULL; 00029 00030 switch (params.kinematic_extension) 00031 { 00032 case NO_EXTENSION: 00033 keb = new KinematicExtensionNone(params); 00034 break; 00035 case BASE_COMPENSATION: 00036 // nothing to do here for BASE_COMPENSATION - only affects twist subscription callback 00037 keb = new KinematicExtensionNone(params); 00038 break; 00039 case BASE_ACTIVE: 00040 keb = new KinematicExtensionBaseActive(params); 00041 break; 00042 case COB_TORSO: 00043 keb = new KinematicExtensionTorso(params); 00044 break; 00045 case LOOKAT: 00046 keb = new KinematicExtensionLookat(params); 00047 break; 00048 default: 00049 ROS_ERROR("KinematicExtension %d not defined! Using default: 'NO_EXTENSION'!", params.kinematic_extension); 00050 keb = new KinematicExtensionNone(params); 00051 break; 00052 } 00053 00054 return keb; 00055 } 00056 /* END KinematicExtensionBuilder *******************************************************************************************/ 00057 00058 00059 /* BEGIN KinematicExtensionNone ********************************************************************************************/ 00060 00061 bool KinematicExtensionNone::initExtension() 00062 { 00063 return true; 00064 } 00065 00069 KDL::Jacobian KinematicExtensionNone::adjustJacobian(const KDL::Jacobian& jac_chain) 00070 { 00071 return jac_chain; 00072 } 00073 00077 JointStates KinematicExtensionNone::adjustJointStates(const JointStates& joint_states) 00078 { 00079 return joint_states; 00080 } 00081 00085 LimiterParams KinematicExtensionNone::adjustLimiterParams(const LimiterParams& limiter_params) 00086 { 00087 return limiter_params; 00088 } 00089 00093 void KinematicExtensionNone::processResultExtension(const KDL::JntArray& q_dot_ik) 00094 { 00095 return; 00096 } 00097 /* END KinematicExtensionNone **********************************************************************************************/