00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC. 00002 // Author 00003 // All rights reserved. 00004 // 00005 // This file is part of iri-ros-pkg 00006 // iri-ros-pkg is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 // 00019 // IMPORTANT NOTE: This code has been generated through a script from the 00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness 00021 // of the scripts. ROS topics can be easly add by using those scripts. Please 00022 // refer to the IRI wiki page for more information: 00023 // http://wikiri.upc.es/index.php/Robotics_Lab 00024 00025 #ifndef _no_collision_alg_node_h_ 00026 #define _no_collision_alg_node_h_ 00027 00028 #include <iri_base_algorithm/iri_base_algorithm.h> 00029 #include "no_collision_alg.h" 00030 00031 // [publisher subscriber headers] 00032 #include <visualization_msgs/Marker.h> 00033 #include <geometry_msgs/Twist.h> 00034 #include <sensor_msgs/LaserScan.h> 00035 00036 // [service client headers] 00037 00038 // [action server client headers] 00039 #include <iri_action_server/iri_action_server.h> 00040 #include <move_base_msgs/MoveBaseAction.h> 00041 00042 #include <tf/transform_listener.h> 00043 #include <geometry_msgs/Point.h> 00044 00049 class NoCollisionAlgNode : public algorithm_base::IriBaseAlgorithm<NoCollisionAlgorithm> 00050 { 00051 private: 00052 // [publisher attributes] 00053 ros::Publisher goal_marker_publisher_; 00054 visualization_msgs::Marker goal_marker_; 00055 ros::Publisher segway_cmd_publisher_; 00056 00057 // [subscriber attributes] 00058 ros::Subscriber target_vel_subscriber_; 00059 void target_vel_callback(const geometry_msgs::Twist::ConstPtr& msg); 00060 CMutex target_vel_mutex_; 00061 ros::Subscriber frontal_laser_subscriber_; 00062 void frontal_laser_callback(const sensor_msgs::LaserScan::ConstPtr& msg); 00063 sensor_msgs::LaserScan scan_; 00064 00065 // [service attributes] 00066 00067 // [client attributes] 00068 00069 // [action server attributes] 00070 IriActionServer<move_base_msgs::MoveBaseAction> move_base_aserver_; 00071 void startCallback(const move_base_msgs::MoveBaseGoalConstPtr& goal); 00072 void stopCallback(void); 00073 bool isFinishedCallback(void); 00074 bool hasSucceedCallback(void); 00075 void getResultCallback(move_base_msgs::MoveBaseResultPtr& result); 00076 void getFeedbackCallback(move_base_msgs::MoveBaseFeedbackPtr& feedback); 00077 00078 // [action client attributes] 00079 00080 tf::TransformListener tf_listener_, tf_listener2_; 00081 geometry_msgs::PoseStamped goal_pose_; 00082 ros::Time action_start_; 00083 static const double ACTION_TIMEOUT = 300; //[s] 00084 bool is_laser_ready_; 00085 bool action_running_; 00086 00087 std::string target_frame_; 00088 std::string fixed_frame_; 00089 00090 public: 00097 NoCollisionAlgNode(void); 00098 00105 ~NoCollisionAlgNode(void); 00106 00107 protected: 00120 void mainNodeThread(void); 00121 00134 void node_config_update(Config &config, uint32_t level); 00135 00142 void addNodeDiagnostics(void); 00143 00144 // [diagnostic functions] 00145 00146 // [test functions] 00147 }; 00148 00149 #endif