00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
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
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
00084 void activeCb()
00085 {
00086 ROS_ERROR("Goal just went active go2point_FA");
00087 }
00088
00089
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
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
00120 void activeCb()
00121 {
00122 ROS_ERROR("Goal just went active go2point_FA");
00123 }
00124
00125
00126 void feedbackCb(const Feedback::ConstPtr& feedback)
00127 {
00128
00129
00130
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
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
00159 void activeCb()
00160 {
00161 ROS_ERROR("Goal just went active dynamic_positioning");
00162 }
00163
00164
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
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
00198 void activeCb()
00199 {
00200 ROS_ERROR("Goal just went active go2point_FA");
00201 }
00202
00203
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