$search
00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2010 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: care-o-bot 00011 * ROS stack name: cob_driver 00012 * ROS package name: cob_powercube_chain 00013 * Description: 00014 * 00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00016 * 00017 * Author: Alexander Bubeck, email:alexander.bubeck@ipa.fhg.de 00018 * Supervised by: Alexander Bubeck, email:alexander.bubeck@ipa.fhg.de 00019 * 00020 * Date of creation: Dec 2009 00021 * ToDo: 00022 * 00023 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00024 * 00025 * Redistribution and use in source and binary forms, with or without 00026 * modification, are permitted provided that the following conditions are met: 00027 * 00028 * * Redistributions of source code must retain the above copyright 00029 * notice, this list of conditions and the following disclaimer. 00030 * * Redistributions in binary form must reproduce the above copyright 00031 * notice, this list of conditions and the following disclaimer in the 00032 * documentation and/or other materials provided with the distribution. 00033 * * Neither the name of the Fraunhofer Institute for Manufacturing 00034 * Engineering and Automation (IPA) nor the names of its 00035 * contributors may be used to endorse or promote products derived from 00036 * this software without specific prior written permission. 00037 * 00038 * This program is free software: you can redistribute it and/or modify 00039 * it under the terms of the GNU Lesser General Public License LGPL as 00040 * published by the Free Software Foundation, either version 3 of the 00041 * License, or (at your option) any later version. 00042 * 00043 * This program is distributed in the hope that it will be useful, 00044 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00045 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00046 * GNU Lesser General Public License LGPL for more details. 00047 * 00048 * You should have received a copy of the GNU Lesser General Public 00049 * License LGPL along with this program. 00050 * If not, see <http://www.gnu.org/licenses/>. 00051 * 00052 ****************************************************************/ 00053 00054 #ifndef OROCOSRTTARMDRIVERINTERFACE_H_ 00055 #define OROCOSRTTARMDRIVERINTERFACE_H_ 00056 #include "Joint.h" 00057 #include <rtt/TaskContext.hpp> 00058 #include <rtt/Command.hpp> 00059 #include <rtt/Ports.hpp> 00060 #include <rtt/Method.hpp> 00061 00062 using namespace RTT; 00063 00064 class OrocosRTTArmDriverInterface : public TaskContext 00065 { 00066 00067 public: 00068 00069 00070 00071 ReadDataPort<Jointd> set_position_inport; 00072 ReadDataPort<Jointd> set_velocity_inport; 00073 00074 WriteDataPort<Jointd> current_position_outport; 00075 WriteDataPort<Jointd> current_velocity_outport; 00076 00077 Method<void(Jointd)> setMaxVelocity; 00078 Method<void(float)> setMaxVelocityFloat; 00079 Method<void(Jointd)> setMaxAcceleration; 00080 Method<void(float)> setMaxAccelerationFloat; 00081 00082 OrocosRTTArmDriverInterface(std::string name) : TaskContext(name), 00083 set_position_inport("SetPositionPort"), 00084 set_velocity_inport("SetVelocityPort"), 00085 current_position_outport("CurrentPositionPort"), 00086 current_velocity_outport("CurrentVelocityPort"), 00087 setMaxVelocity("setMaxVelocity", 00088 &OrocosRTTArmDriverInterface::setMaxVelocityF, 00089 this), 00090 setMaxVelocityFloat("setMaxVelocityFloat", 00091 &OrocosRTTArmDriverInterface::setMaxVelocityFloatF, 00092 this), 00093 setMaxAcceleration("setMaxAcceleration", 00094 &OrocosRTTArmDriverInterface::setMaxAccelerationF, 00095 this), 00096 setMaxAccelerationFloat("setMaxAccelerationFloat", 00097 &OrocosRTTArmDriverInterface::setMaxAccelerationFloatF, 00098 this) 00099 { 00100 this->ports()->addEventPort(&set_position_inport); 00101 this->ports()->addEventPort(&set_velocity_inport); 00102 this->ports()->addPort(¤t_position_outport); 00103 this->ports()->addPort(¤t_velocity_outport); 00104 00105 this->methods()->addMethod( &setMaxVelocity, 00106 "Setting maximal velocity of joints.", "Jointd", "maximal velocity in rad per second"); 00107 this->methods()->addMethod( &setMaxVelocityFloat, 00108 "Setting maximal velocity of joints.", "float", "maximal velocity in rad per second"); 00109 this->methods()->addMethod( &setMaxAcceleration, 00110 "Setting maximal acceleration of joints.", "Jointd", "maximal acceleration in rad per second squared"); 00111 this->methods()->addMethod( &setMaxAccelerationFloat, 00112 "Setting maximal acceleration of joints.", "float", "maximal acceleration in rad per second squared"); 00113 00114 } 00115 ~OrocosRTTArmDriverInterface() {}; 00116 00117 private: 00118 virtual void setMaxVelocityF(Jointd radpersec) = 0; 00119 virtual void setMaxVelocityFloatF(float radpersec) = 0; 00120 virtual void setMaxAccelerationF(Jointd radpersec) = 0; 00121 virtual void setMaxAccelerationFloatF(float radpersec) = 0; 00122 00123 00124 }; 00125 00126 00127 #endif /* OROCOSRTTARMDRIVERINTERFACE_H_ */