Katana.h
Go to the documentation of this file.
00001 /*
00002  * UOS-ROS packages - Robot Operating System code by the University of Osnabrück
00003  * Copyright (C) 2010  University of Osnabrück
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  *
00019  * Katana.h
00020  *
00021  *  Created on: 06.12.2010
00022  *      Author: Martin Günther <mguenthe@uos.de>
00023  */
00024 
00025 #ifndef KATANA_H_
00026 #define KATANA_H_
00027 
00028 #include <ros/ros.h>
00029 #include <std_srvs/Empty.h>
00030 #include <boost/thread/recursive_mutex.hpp>
00031 #include <boost/thread.hpp>
00032 
00033 #include <kniBase.h>
00034 
00035 #include <katana/SpecifiedTrajectory.h>
00036 #include <katana/AbstractKatana.h>
00037 #include <katana/KNIConverter.h>
00038 
00039 namespace katana
00040 {
00041 
00048 class Katana : public AbstractKatana
00049 {
00050 public:
00051   Katana();
00052   virtual ~Katana();
00053 
00054   void refreshEncoders();
00055   bool executeTrajectory(boost::shared_ptr<SpecifiedTrajectory> traj);
00056   virtual void freezeRobot();
00057   virtual bool moveJoint(int jointIndex, double turningAngle);
00058 
00059   virtual void refreshMotorStatus();
00060   virtual bool someMotorCrashed();
00061   virtual bool allJointsReady();
00062   virtual bool allMotorsReady();
00063 
00064   virtual void setLimits(void);
00065   virtual void testSpeed();
00066 
00067 protected:
00068   boost::shared_ptr<CLMBase> kni;
00069   boost::recursive_mutex kni_mutex;
00070   std::vector<TMotStsFlg> motor_status_;
00071 
00072   KNIConverter* converter;
00073 
00074 private:
00075   ros::ServiceServer switch_motors_off_srv_;
00076   ros::ServiceServer switch_motors_on_srv_;
00077   ros::ServiceServer test_speed_srv_;
00078 
00079   CCplSerialCRC* protocol;
00080   CCdlBase* device;
00081 
00082   ros::Time last_encoder_update_;
00083 
00084   void calibrate();
00085 
00086   bool switchMotorsOff(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00087   bool switchMotorsOn(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00088   bool testSpeedSrv(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00089 
00090   short round(const double x);
00091 };
00092 
00093 }
00094 
00095 #endif /* KATANA_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


katana
Author(s): Martin Günther
autogenerated on Tue May 28 2013 14:54:05