00001 /* 00002 * VMObsAvoid.hpp 00003 * 00004 * Created on: Dec 14, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef VMOBSAVOID_HPP_ 00009 #define VMOBSAVOID_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 #include <tk_trajprocessor/TrajectoryModule.hpp> 00013 00014 #include <telekyb_base/Options.hpp> 00015 00016 #include <ros/ros.h> 00017 #include <boost/thread/mutex.hpp> 00018 00019 #include <telekyb_msgs/StampedPointArray.h> 00020 00021 #include <obs_avoidance/ObstacleAvoidancePotential.hpp> 00022 00023 using namespace TELEKYB_NAMESPACE; 00024 00025 namespace telekyb_traj { 00026 00027 class VMObsAvoidOptions : public OptionContainer { 00028 public: 00029 Option<std::string>* tObsPointsTopicName; 00030 00031 VMObsAvoidOptions(); 00032 }; 00033 00034 class VMObsAvoid : public TrajectoryModule { 00035 protected: 00036 VMObsAvoidOptions options; 00037 00038 ObstacleAvoidancePotential obsAvoidPotentialAlg; 00039 00040 // ros 00041 ros::Subscriber obsPointSub; 00042 00043 // CB 00044 void obsPointCB(const telekyb_msgs::StampedPointArray::ConstPtr& obsPointsMsg); 00045 00046 std::vector<Position3D> lastObstaclePoints; 00047 boost::mutex lastObstaclePointsMutex; 00048 00049 public: 00050 VMObsAvoid(); 00051 00052 virtual void initialize(); 00053 virtual void destroy(); 00054 00055 // set back to intial conditions 00056 virtual void willTurnActive(); 00057 00058 // called after turning inactive 00059 virtual void didTurnInactive(); 00060 00061 virtual bool trajectoryStep(const TKState& currentState, TKTrajectory& trajInput); 00062 00063 00064 }; 00065 00066 } /* namespace telekyb_traj */ 00067 #endif /* VMOBSAVOID_HPP_ */