00001 /****************************************************************************** 00002 * Copyright (c) 2011 00003 * Locomotec 00004 * 00005 * Author: 00006 * Sebastian Blumenthal 00007 * 00008 * 00009 * This software is published under a dual-license: GNU Lesser General Public 00010 * License LGPL 2.1 and BSD license. The dual-license implies that users of this 00011 * code may choose which terms they prefer. 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions are met: 00015 * 00016 * * Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * * Redistributions in binary form must reproduce the above copyright 00019 * notice, this list of conditions and the following disclaimer in the 00020 * documentation and/or other materials provided with the distribution. 00021 * * Neither the name of Locomotec nor the names of its 00022 * contributors may be used to endorse or promote products derived from 00023 * this software without specific prior written permission. 00024 * 00025 * This program is free software: you can redistribute it and/or modify 00026 * it under the terms of the GNU Lesser General Public License LGPL as 00027 * published by the Free Software Foundation, either version 2.1 of the 00028 * License, or (at your option) any later version or the BSD license. 00029 * 00030 * This program is distributed in the hope that it will be useful, 00031 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00032 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00033 * GNU Lesser General Public License LGPL and the BSD license for more details. 00034 * 00035 * You should have received a copy of the GNU Lesser General Public 00036 * License LGPL and BSD license along with this program. 00037 * 00038 ******************************************************************************/ 00039 00040 00041 #include <YouBotConfiguration.h> 00042 00043 namespace youBot 00044 { 00045 00046 YouBotBaseConfiguration::YouBotBaseConfiguration() 00047 { 00048 youBotBase = 0; 00049 00050 /* provide some default values for the joint names (might be overwritten) */ 00051 /* 00052 * numbering of youBot wheels: 00053 * 00054 * FRONT 00055 * 00056 * 1 ---+--- 2 00057 * | 00058 * | 00059 * | 00060 * | 00061 * 3 ---+--- 4 00062 * 00063 * BACK 00064 */ 00065 wheelNames.clear(); 00066 wheelNames.push_back("wheel_joint_fl"); //wheel #1 00067 wheelNames.push_back("wheel_joint_fr"); //wheel #2 00068 wheelNames.push_back("wheel_joint_bl"); //wheel #3 00069 wheelNames.push_back("wheel_joint_br"); //wheel #4 00070 00071 } 00072 00073 YouBotBaseConfiguration::~YouBotBaseConfiguration() 00074 { 00075 00076 // No delete of youBot base pointer - this class has no ownership 00077 } 00078 00079 YouBotArmConfiguration::YouBotArmConfiguration() 00080 { 00081 00082 youBotArm = 0; 00083 armJointTrajectoryAction = 0; 00084 00085 /* provide some default values for the joint names (might be overwritten) */ 00086 jointNames.clear(); 00087 jointNames.push_back("arm_joint_1"); 00088 jointNames.push_back("arm_joint_2"); 00089 jointNames.push_back("arm_joint_3"); 00090 jointNames.push_back("arm_joint_4"); 00091 jointNames.push_back("arm_joint_5"); 00092 00093 gripperFingerNames.clear(); 00094 gripperFingerNames.push_back("gripper_finger_joint_l"); 00095 gripperFingerNames.push_back("gripper_finger_joint_r"); 00096 } 00097 00098 YouBotArmConfiguration::~YouBotArmConfiguration() 00099 { 00100 // No delete of youBot arm pointer - this class has no ownership 00101 if (armJointTrajectoryAction) 00102 { 00103 delete armJointTrajectoryAction; 00104 armJointTrajectoryAction = 0; 00105 } 00106 jointNames.clear(); 00107 } 00108 00109 YouBotConfiguration::YouBotConfiguration() 00110 { 00111 youBotArmConfigurations.clear(); 00112 armNameToArmIndexMapping.clear(); 00113 hasBase = false; 00114 hasArms = false; 00115 } 00116 00117 YouBotConfiguration::~YouBotConfiguration() 00118 { 00119 youBotArmConfigurations.clear(); 00120 armNameToArmIndexMapping.clear(); 00121 } 00122 00123 bool YouBotConfiguration::isEtherCATOkay() { 00124 //std::vector<YouBotArmConfiguration> youBotArmConfigurations 00125 bool okay=true; 00126 for (std::vector<YouBotArmConfiguration>::iterator it = youBotArmConfigurations.begin(); 00127 it != youBotArmConfigurations.end(); ++it) 00128 { 00129 if (!(*it).youBotArm->isEtherCATConnectionEstablished()) { 00130 okay=false; 00131 break; 00132 } 00133 } 00134 return okay; 00135 } 00136 00137 } // namespace youBot 00138 00139 /* EOF */