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 _POWERCUBECTRL_OROCOS_ 00055 #define _POWERCUBECTRL_OROCOS_ 00056 00057 #include <rtt/TaskContext.hpp> 00058 #include <rtt/Command.hpp> 00059 #include <rtt/Ports.hpp> 00060 #include <rtt/Property.hpp> 00061 #include <rtt/marsh/PropertyMarshaller.hpp> 00062 #include "PowerCubeCtrl.h" 00063 00064 #include <iostream> 00065 using namespace std; 00066 00067 00068 class PowerCubeCtrl_OROCOS : public RTT::TaskContext 00069 { 00070 public: 00071 00072 PowerCubeCtrl_OROCOS(std::string name, std::string file, int dof); 00073 //PowerCubeCtrl_OROCOS(std::string name); 00074 ~PowerCubeCtrl_OROCOS(); 00075 00076 bool configureHook(); 00077 bool startHook(); 00078 void updateHook(); 00079 void stopHook(); 00080 void cleanupHook(){} 00081 00082 /* The dataports have the following names: 00083 "in_Angles" 00084 "in_Velocities" 00085 "in_Currents" 00086 "out_Angles" 00087 "out_Velocities" 00088 */ 00089 00090 protected: 00091 00092 bool stopArm(); 00093 bool isArmStopped(); 00094 bool moveJointSpace(std::vector<double> target); 00095 //bool m_stopped; 00096 00097 std::string m_xmlFile; 00098 int m_dof; 00099 00100 RTT::ReadDataPort< std::vector<double> > m_in_Angles; 00101 bool m_in_Angles_connected; 00102 00103 RTT::ReadDataPort< std::vector<double> > m_in_Velocities; // MoveVel 00104 bool m_in_Velocities_connected; 00105 00106 RTT::ReadDataPort< std::vector<double> > m_in_Currents; 00107 bool m_in_Currents_connected; 00108 00109 RTT::WriteDataPort< std::vector<double> > m_out_Angles; // getConfig 00110 RTT::WriteDataPort< std::vector<double> > m_out_Velocities; // getJointVelocities 00111 //WriteDataPort< std::vector<double> > m_out_Currents; 00112 00113 RTT::Method<bool(void)> m_stop_method; 00114 //RTT::Method<bool(std::vector<double>)> m_moveJointSpace_method; 00115 00116 RTT::Property<int> m_CanDev_prop; 00117 RTT::Property<int> m_CanBaud_prop; 00118 RTT::Property<int> m_dof_prop; 00119 RTT::Property<double> m_MaxVel_prop; 00120 RTT::Property<double> m_MaxAcc_prop; 00121 00122 std::vector< RTT::PropertyBag > m_mod_params_bags; 00123 std::vector< RTT::Property<RTT::PropertyBag> > m_mod_params; 00124 00125 std::vector< RTT::Property<int> > m_modId_props; 00126 std::vector< RTT::Property<double> > m_ul_props; 00127 std::vector< RTT::Property<double> > m_ll_props; 00128 std::vector< RTT::Property<double> > m_offset_props; 00129 00130 PowerCubeCtrl m_powercubectrl; 00131 00132 }; 00133 00134 #endif 00135