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 <cob_cartesian_controller/trajectory_profile_generator/trajectory_profile_generator_builder.h> 00019 #include <cob_cartesian_controller/trajectory_profile_generator/trajectory_profile_generator_ramp.h> 00020 #include <cob_cartesian_controller/trajectory_profile_generator/trajectory_profile_generator_sinoid.h> 00021 #include <cob_cartesian_controller/Profile.h> 00022 00023 /* BEGIN TrajectoryProfileBuilder *****************************************************************************************/ 00024 TrajectoryProfileBase* TrajectoryProfileBuilder::createProfile(const cob_cartesian_controller::CartesianActionStruct& params) 00025 { 00026 cob_cartesian_controller::Profile msg; 00027 00028 const int RAMP = static_cast<const int>(msg.RAMP); 00029 const int SINOID = static_cast<const int>(msg.SINOID); 00030 00031 TrajectoryProfileBase* ib = NULL; 00032 switch (params.profile.profile_type) 00033 { 00034 case RAMP: 00035 ib = new TrajectoryProfileRamp(params); 00036 break; 00037 case SINOID: 00038 ib = new TrajectoryProfileSinoid(params); 00039 break; 00040 default: 00041 ROS_ERROR("Unknown Profile"); 00042 break; 00043 } 00044 00045 return ib; 00046 } 00047 /* END TrajectoryProfileBuilder *******************************************************************************************/