00001 00002 // 00003 // Package: RoadNarrows Robotics Hekateros Robotiic Manipulator ROS Package 00004 // 00005 // Link: https://github.com/roadnarrows-robotics/hekateros 00006 // 00007 // ROS Node: hekateros_control 00008 // 00009 // File: hekateros_as_calib.h 00010 // 00026 /* 00027 * @EulaBegin@ 00028 * 00029 * Permission is hereby granted, without written agreement and without 00030 * license or royalty fees, to use, copy, modify, and distribute this 00031 * software and its documentation for any purpose, provided that 00032 * (1) The above copyright notice and the following two paragraphs 00033 * appear in all copies of the source code and (2) redistributions 00034 * including binaries reproduces these notices in the supporting 00035 * documentation. Substantial modifications to this software may be 00036 * copyrighted by their authors and need not follow the licensing terms 00037 * described here, provided that the new terms are clearly indicated in 00038 * all files where they apply. 00039 * 00040 * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES 00041 * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY 00042 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 00043 * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, 00044 * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF 00045 * THE POSSIBILITY OF SUCH DAMAGE. 00046 * 00047 * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES, 00048 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00049 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN 00050 * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO 00051 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00052 * 00053 * @EulaEnd@ 00054 */ 00056 00057 #ifndef _HEKATEROS_AS_CALIB_H 00058 #define _HEKATEROS_AS_CALIB_H 00059 00060 // 00061 // System and Boost 00062 // 00063 #include <unistd.h> 00064 #include <boost/bind.hpp> 00065 #include <string> 00066 00067 // 00068 // ROS 00069 // 00070 #include "ros/ros.h" 00071 00072 // 00073 // ROS generated core, industrial, and hekateros messages. 00074 // 00075 #include "std_msgs/String.h" 00076 #include "sensor_msgs/JointState.h" 00077 #include "hekateros_control/HekJointStateExtended.h" 00078 00079 // 00080 // ROS generated action servers. 00081 // 00082 #include "actionlib/server/simple_action_server.h" 00083 #include "hekateros_control/CalibrateAction.h" 00084 00085 // 00086 // RoadNarrows embedded hekateros library. 00087 // 00088 #include "Hekateros/hekateros.h" 00089 #include "Hekateros/hekRobot.h" 00090 00091 // 00092 // Node headers. 00093 // 00094 #include "hekateros_control.h" 00095 00096 00097 namespace hekateros_control 00098 { 00102 class ASCalibrate 00103 { 00104 public: 00111 ASCalibrate(std::string name, HekaterosControl &node) : 00112 action_name_(name), // action name 00113 node_(node), // hekateros node 00114 as_(node.getNodeHandle(), // simple action server 00115 name, // action name 00116 boost::bind(&ASCalibrate::execute_cb, this, _1), 00117 // execute callback 00118 false) // don't auto-start 00119 { 00120 // 00121 // Optionally register the goal and feeback callbacks 00122 // 00123 as_.registerPreemptCallback(boost::bind(&ASCalibrate::preempt_cb, this)); 00124 00125 // start the action server 00126 start(); 00127 } 00128 00132 virtual ~ASCalibrate() 00133 { 00134 } 00135 00139 void start() 00140 { 00141 as_.start(); 00142 } 00143 00150 void execute_cb(const CalibrateGoalConstPtr &goal); 00151 00158 void preempt_cb(); 00159 00160 protected: 00161 std::string action_name_; 00162 HekaterosControl &node_; 00163 00164 actionlib::SimpleActionServer<CalibrateAction> as_; 00166 CalibrateFeedback feedback_; 00167 CalibrateResult result_; 00168 }; 00169 00170 } // namespace hekateros_control 00171 00172 #endif // _HEKATEROS_AS_CALIB_H