00001 /* 00002 * File: sf_hand_finder.hpp 00003 * Author: Vahid Aminzadeh <vahid@shadowrobot.com> 00004 * Copyright 2015 Shadow Robot Company Ltd. 00005 * 00006 * This program is free software: you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the Free 00008 * Software Foundation, either version 2 of the License, or (at your option) 00009 * any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00014 * more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * @brief see README.md 00020 */ 00021 00022 #pragma once 00023 #include "ros/ros.h" 00024 #include <map> 00025 #include <string> 00026 #include <vector> 00027 namespace shadow_robot 00028 { 00029 00030 struct HandConfig 00031 { 00032 std::map<std::string, std::string> mapping_; 00033 std::map<std::string, std::string> joint_prefix_; 00034 }; 00035 00036 struct HandControllerTuning 00037 { 00038 std::map<std::string, std::string> friction_compensation_; 00039 std::map<std::string, std::vector<std::string> > host_control_; 00040 std::map<std::string, std::string> motor_control_; 00041 }; 00042 00043 class SrHandFinder 00044 { 00045 public: 00046 std::map<std::string, std::vector<std::string> > get_joints(); 00047 std::map<std::string, std::string> get_calibration_path(); 00048 HandControllerTuning get_hand_controller_tuning(); 00049 private: 00050 static const size_t number_of_joints_; 00051 static const char* joint_names_[]; 00052 ros::NodeHandle node_handle_; 00053 HandConfig hand_config_; 00054 HandControllerTuning hand_controller_tuning_; 00055 std::map<std::string, std::vector<std::string> > joints_; 00056 std::map<std::string, std::string> calibration_path_; 00057 void generate_joints_with_prefix(); 00058 void generate_calibration_path(); 00059 void generate_hand_controller_tuning_path(); 00060 00061 00062 00063 public: 00064 SrHandFinder(); 00065 virtual ~SrHandFinder(){} 00066 }; 00067 00068 } /* namespace shadow_robot */