00001 00011 #include "sr_hand/hand/virtual_shadowhand_library.h" 00012 #include <ros/ros.h> 00013 #include <map> 00014 00015 namespace shadowrobot 00016 { 00017 00018 VirtualShadowhandLibrary::VirtualShadowhandLibrary() : 00019 SRArticulatedRobot() 00020 { 00021 joints_map_mutex.lock(); 00022 00023 JointData tmpData; 00024 JointData tmpDataZero; 00025 JointControllerData tmpController; 00026 tmpDataZero.isJointZero = 1; 00027 tmpDataZero.max = 180.0; 00028 00029 joints_map["FFJ0"] = tmpDataZero; 00030 joints_map["FFJ1"] = tmpData; 00031 joints_map["FFJ2"] = tmpData; 00032 joints_map["FFJ3"] = tmpData; 00033 tmpData.min = -20.0; 00034 tmpData.max = 20.0; 00035 joints_map["FFJ4"] = tmpData; 00036 00037 joints_map["MFJ0"] = tmpDataZero; 00038 tmpData.min = 0.0; 00039 tmpData.max = 90.0; 00040 joints_map["MFJ1"] = tmpData; 00041 joints_map["MFJ2"] = tmpData; 00042 joints_map["MFJ3"] = tmpData; 00043 tmpData.min = -20.0; 00044 tmpData.max = 20.0; 00045 joints_map["MFJ4"] = tmpData; 00046 00047 joints_map["RFJ0"] = tmpDataZero; 00048 tmpData.min = 0.0; 00049 tmpData.max = 90.0; 00050 joints_map["RFJ1"] = tmpData; 00051 joints_map["RFJ2"] = tmpData; 00052 joints_map["RFJ3"] = tmpData; 00053 tmpData.min = -20.0; 00054 tmpData.max = 20.0; 00055 joints_map["RFJ4"] = tmpData; 00056 00057 joints_map["LFJ0"] = tmpDataZero; 00058 tmpData.min = 0.0; 00059 tmpData.max = 90.0; 00060 joints_map["LFJ1"] = tmpData; 00061 joints_map["LFJ2"] = tmpData; 00062 joints_map["LFJ3"] = tmpData; 00063 tmpData.min = -20.0; 00064 tmpData.max = 20.0; 00065 joints_map["LFJ4"] = tmpData; 00066 tmpData.min = 0.0; 00067 tmpData.max = 45.0; 00068 joints_map["LFJ5"] = tmpData; 00069 00070 tmpData.min = 0.0; 00071 tmpData.max = 90.0; 00072 joints_map["THJ1"] = tmpData; 00073 tmpData.min = -40.0; 00074 tmpData.max = 40.0; 00075 joints_map["THJ2"] = tmpData; 00076 tmpData.min = -15.0; 00077 tmpData.max = 15.0; 00078 joints_map["THJ3"] = tmpData; 00079 tmpData.min = 0.0; 00080 tmpData.max = 75.0; 00081 joints_map["THJ4"] = tmpData; 00082 tmpData.min = -60.0; 00083 tmpData.max = 60.0; 00084 joints_map["THJ5"] = tmpData; 00085 00086 tmpData.min = -30.0; 00087 tmpData.max = 45.0; 00088 joints_map["WRJ1"] = tmpData; 00089 tmpData.min = -30.0; 00090 tmpData.max = 10.0; 00091 joints_map["WRJ2"] = tmpData; 00092 00093 joints_map_mutex.unlock(); 00094 } 00095 00096 short VirtualShadowhandLibrary::sendupdate( std::string joint_name, double target ) 00097 { 00098 return (short)0; 00099 } 00100 00101 JointData VirtualShadowhandLibrary::getJointData( std::string joint_name ) 00102 { 00103 JointData tmp; 00104 return tmp; 00105 } 00106 std::map<std::string, JointData> VirtualShadowhandLibrary::getAllJointsData() 00107 { 00108 joints_map_mutex.lock(); 00109 JointsMap tmp_map = JointsMap(joints_map); 00110 joints_map_mutex.unlock(); 00111 return tmp_map; 00112 } 00113 short VirtualShadowhandLibrary::setContrl( std::string contrlr_name, JointControllerData ctrlr_data ) 00114 { 00115 return (short)0; 00116 } 00117 JointControllerData VirtualShadowhandLibrary::getContrl( std::string ctrlr_name ) 00118 { 00119 JointControllerData tmp; 00120 return tmp; 00121 } 00122 short VirtualShadowhandLibrary::setConfig( std::vector<std::string> myConfig ) 00123 { 00124 return (short)0; 00125 } 00126 void VirtualShadowhandLibrary::getConfig( std::string joint_name ) 00127 { 00128 } 00129 std::vector<DiagnosticData> VirtualShadowhandLibrary::getDiagnostics() 00130 { 00131 std::vector<DiagnosticData> tmp; 00132 return tmp; 00133 } 00134 }//end namespace