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 
00056   virtual bool executeTrajectory(boost::shared_ptr<SpecifiedTrajectory> traj,
00057                                  boost::function<bool()> isPreemptRequested);
00058 
00059   virtual void freezeRobot();
00060   virtual bool moveJoint(int jointIndex, double turningAngle);
00061 
00062   virtual void refreshMotorStatus();
00063   virtual bool someMotorCrashed();
00064   virtual bool allJointsReady();
00065   virtual bool allMotorsReady();
00066 
00067   virtual void setLimits(void);
00068   virtual void testSpeed();
00069 
00070 protected:
00071   boost::shared_ptr<CLMBase> kni;
00072   boost::recursive_mutex kni_mutex;
00073   std::vector<TMotStsFlg> motor_status_;
00074 
00075   KNIConverter* converter;
00076 
00077   short round(const double x);
00078 
00079 private:
00080   ros::ServiceServer switch_motors_off_srv_;
00081   ros::ServiceServer switch_motors_on_srv_;
00082   ros::ServiceServer test_speed_srv_;
00083 
00084   CCplSerialCRC* protocol;
00085   CCdlBase* device;
00086 
00087   ros::Time last_encoder_update_;
00088 
00089   void calibrate();
00090 
00091   bool switchMotorsOff(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00092   bool switchMotorsOn(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00093   bool testSpeedSrv(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
00094 };
00095 
00096 }
00097 
00098 #endif /* KATANA_H_ */


katana
Author(s): Martin Günther
autogenerated on Thu Jun 6 2019 21:43:33