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 #ifndef COB_TWIST_CONTROLLER_CALLBACK_DATA_MEDIATOR_H 00019 #define COB_TWIST_CONTROLLER_CALLBACK_DATA_MEDIATOR_H 00020 00021 #include <vector> 00022 #include <stdint.h> 00023 #include <boost/thread/mutex.hpp> 00024 00025 #include "cob_twist_controller/cob_twist_controller_data_types.h" 00026 #include "cob_twist_controller/constraints/constraint_params.h" 00027 #include "cob_control_msgs/ObstacleDistances.h" 00028 00030 class CallbackDataMediator 00031 { 00032 private: 00033 typedef ObstacleDistancesInfo_t::const_iterator ObstacleDistancesIter_t; 00034 ObstacleDistancesInfo_t obstacle_distances_; 00035 boost::mutex distances_to_obstacles_lock_; 00036 00037 public: 00038 CallbackDataMediator() {} 00039 00043 uint32_t obstacleDistancesCnt(); 00044 00050 bool fill(ConstraintParamsCA& params_ca); 00051 00057 bool fill(ConstraintParamsJLA& params_jla); 00058 00063 void distancesToObstaclesCallback(const cob_control_msgs::ObstacleDistances::ConstPtr& msg); 00064 }; 00065 00066 #endif // COB_TWIST_CONTROLLER_CALLBACK_DATA_MEDIATOR_H