PrimitiveCall.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002  * PrimitiveCall.hpp
00003  *
00004  *  Created on: May 27, 2015
00005  *      Author: Filip Mandic
00006  *
00007  ********************************************************************/
00008 
00009 /*********************************************************************
00010 * Software License Agreement (BSD License)
00011 *
00012 *  Copyright (c) 2015, LABUST, UNIZG-FER
00013 *  All rights reserved.
00014 *
00015 *  Redistribution and use in source and binary forms, with or without
00016 *  modification, are permitted provided that the following conditions
00017 *  are met:
00018 *
00019 *   * Redistributions of source code must retain the above copyright
00020 *     notice, this list of conditions and the following disclaimer.
00021 *   * Redistributions in binary form must reproduce the above
00022 *     copyright notice, this list of conditions and the following
00023 *     disclaimer in the documentation and/or other materials provided
00024 *     with the distribution.
00025 *   * Neither the name of the LABUST nor the names of its
00026 *     contributors may be used to endorse or promote products derived
00027 *     from this software without specific prior written permission.
00028 *
00029 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00030 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00031 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00032 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00033 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00034 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00035 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00036 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00037 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00038 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00039 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00040 *  POSSIBILITY OF SUCH DAMAGE.
00041 *********************************************************************/
00042 
00043 #ifndef PRIMITIVECALL_HPP_
00044 #define PRIMITIVECALL_HPP_
00045 
00046 #include <labust/primitive/PrimitiveCallBase.hpp>
00047 
00048 #include <navcon_msgs/GoToPointAction.h>
00049 #include <navcon_msgs/CourseKeepingAction.h>
00050 #include <navcon_msgs/DynamicPositioningAction.h>
00051 #include <navcon_msgs/DOFIdentificationAction.h>
00052 
00053 #include <ros/ros.h>
00054 
00055 namespace labust
00056 {
00057         namespace primitive
00058         {
00059                 class PrimitiveCallGo2Point : public PrimitiveCallBase<navcon_msgs::GoToPointAction,
00060                                                                                                                                  navcon_msgs::GoToPointGoal,
00061                                                                                                                                  navcon_msgs::GoToPointResult,
00062                                                                                                                                  navcon_msgs::GoToPointFeedback>
00063                 {
00064                 public:
00065                         PrimitiveCallGo2Point():PrimitiveCallBase("go2point")
00066                         {
00067 
00068                         }
00069 
00070                         ~PrimitiveCallGo2Point(){};
00071 
00072                 protected:
00073                         /***  Callback called once when the goal completes ***/
00074                         void doneCb(const actionlib::SimpleClientGoalState& state, const Result::ConstPtr& result)
00075                         {
00076                                 if (state == actionlib::SimpleClientGoalState::SUCCEEDED)
00077                                 {
00078                                         ROS_ERROR("Go2PointFA - Finished in state [%s]", state.toString().c_str());
00079                                         publishEventString("/PRIMITIVE_FINISHED");
00080                                 }
00081                         }
00082 
00083                         /*** Callback called once when the goal becomes active ***/
00084                         void activeCb()
00085                         {
00086                         ROS_ERROR("Goal just went active go2point_FA");
00087                         }
00088 
00089                         /*** Callback called every time feedback is received for the goal ***/
00090                         void feedbackCb(const Feedback::ConstPtr& feedback)
00091                         {
00092                                    ROS_ERROR("Feedback - Go2point - distance: %f, bearing: %f", feedback->distance, feedback->bearing);
00093                         }
00094                 };
00095 
00096                 class PrimitiveCallCourseKeeping : public PrimitiveCallBase<navcon_msgs::CourseKeepingAction,
00097                                                                                                                                           navcon_msgs::CourseKeepingGoal,
00098                                                                                                                                           navcon_msgs::CourseKeepingResult,
00099                                                                                                                                           navcon_msgs::CourseKeepingFeedback>
00100                 {
00101                 public:
00102                         PrimitiveCallCourseKeeping():PrimitiveCallBase("course_keeping")
00103                         {
00104 
00105                         }
00106 
00107                         ~PrimitiveCallCourseKeeping(){};
00108 
00109                 protected:
00110                         /***  Callback called once when the goal completes ***/
00111                         void doneCb(const actionlib::SimpleClientGoalState& state, const Result::ConstPtr& result)
00112                         {
00113                                 if (state == actionlib::SimpleClientGoalState::SUCCEEDED)
00114                                 {
00115                                         publishEventString("/PRIMITIVE_FINISHED");
00116                                 }
00117                         }
00118 
00119                         /*** Callback called once when the goal becomes active ***/
00120                         void activeCb()
00121                         {
00122                         ROS_ERROR("Goal just went active go2point_FA");
00123                         }
00124 
00125                         /*** Callback called every time feedback is received for the goal ***/
00126                         void feedbackCb(const Feedback::ConstPtr& feedback)
00127                         {
00128                         // ROS_INFO("Got Feedback of length %lu", feedback->sequence.size());
00129                         //if((counter++)%10 == 0)
00130                         //ROS_ERROR("Feedback - distance: %f", feedback->distance);
00131                         }
00132                 };
00133 
00134                 class PrimitiveCallDynamicPositioning : public PrimitiveCallBase<navcon_msgs::DynamicPositioningAction,
00135                                                                                                                                                   navcon_msgs::DynamicPositioningGoal,
00136                                                                                                                                                   navcon_msgs::DynamicPositioningResult,
00137                                                                                                                                                   navcon_msgs::DynamicPositioningFeedback>
00138                 {
00139                 public:
00140                         PrimitiveCallDynamicPositioning():PrimitiveCallBase("dynamic_positioning")
00141                         {
00142 
00143                         }
00144 
00145                         ~PrimitiveCallDynamicPositioning(){};
00146 
00147                 protected:
00148                         /***  Callback called once when the goal completes ***/
00149                         void doneCb(const actionlib::SimpleClientGoalState& state, const Result::ConstPtr& result)
00150                         {
00151                                 if (state == actionlib::SimpleClientGoalState::SUCCEEDED)
00152                                 {
00153                                         ROS_ERROR("Dynamic Positioning - Finished in state [%s]", state.toString().c_str());
00154                                         publishEventString("/PRIMITIVE_FINISHED");
00155                                 }
00156                         }
00157 
00158                         /*** Callback called once when the goal becomes active ***/
00159                         void activeCb()
00160                         {
00161                         ROS_ERROR("Goal just went active dynamic_positioning");
00162                         }
00163 
00164                         /*** Callback called every time feedback is received for the goal ***/
00165                         void feedbackCb(const Feedback::ConstPtr& feedback)
00166                         {
00167                                 ROS_ERROR("Feedback - dynamic_positioning - x-error: %f, y-error: %f, distance: %f, bearing: %f",
00168                                                 feedback->error.point.x, feedback->error.point.y, feedback->distance, feedback->bearing);
00169                         }
00170                 };
00171 
00172                 class PrimitiveCallDOFIdentification : public PrimitiveCallBase<navcon_msgs::DOFIdentificationAction,
00173                                                                                                                                                   navcon_msgs::DOFIdentificationGoal,
00174                                                                                                                                                   navcon_msgs::DOFIdentificationResult,
00175                                                                                                                                                   navcon_msgs::DOFIdentificationFeedback>
00176                 {
00177                 public:
00178                         PrimitiveCallDOFIdentification():PrimitiveCallBase("Identification")
00179                         {
00180 
00181                         }
00182 
00183                         ~PrimitiveCallDOFIdentification(){};
00184 
00185                 protected:
00186                         /***  Callback called once when the goal completes ***/
00187                         void doneCb(const actionlib::SimpleClientGoalState& state, const Result::ConstPtr& result)
00188                         {
00189                                 if (state == actionlib::SimpleClientGoalState::SUCCEEDED)
00190                                 {
00191                                         ROS_ERROR("iso - Finished in state [%s]", state.toString().c_str());
00192                                         ROS_ERROR("Result - DOF: %d, alpha: %f, beta: %f, betaa: %f, delta %f, wn: %f", result->dof,result->alpha, result->beta, result->betaa, result->delta, result->wn);
00193                                         publishEventString("/PRIMITIVE_FINISHED");
00194                                 }
00195                         }
00196 
00197                         /*** Callback called once when the goal becomes active ***/
00198                         void activeCb()
00199                         {
00200                         ROS_ERROR("Goal just went active go2point_FA");
00201                         }
00202 
00203                         /*** Callback called every time feedback is received for the goal ***/
00204                         void feedbackCb(const Feedback::ConstPtr& feedback)
00205                         {
00206                                    ROS_ERROR("Feedback - dof: %d, error: %f, oscilation_num: %d", feedback->dof, feedback->error, feedback->oscillation_num);
00207                         }
00208                 };
00209         }
00210 }
00211 
00212 
00213 
00214 
00215 #endif /* PRIMITIVECALL_HPP_ */


labust_primitives
Author(s): Filip Mandic
autogenerated on Fri Aug 28 2015 11:22:51