00001 /* -*- mode: C++ -*- 00002 * 00003 * Copyright (C) 2009, 2010, Austin Robot Technology 00004 * 00005 * License: Modified BSD Software License Agreement 00006 * 00007 * $Id: command.h 615 2010-09-24 16:07:50Z jack.oquin $ 00008 * 00009 * Author: Patrick Beeson, Jack O'Quin 00010 */ 00011 #ifndef __command_h__ 00012 #define __command_h__ 00013 00014 #include <ros/ros.h> 00015 00016 #include <art_map/zones.h> 00017 00018 #include <art_nav/NavBehavior.h> 00019 #include <art_nav/Mission.h> 00020 #include <art_msgs/NavigatorCommand.h> 00021 #include <art_msgs/NavigatorState.h> 00022 00023 #include "Blockage.h" 00024 #include "Path.h" 00025 #include "Event.h" 00026 00027 class CmdrFSM; 00028 00029 class Commander 00030 { 00031 friend class CmdrFSM; // state machine is a friend 00032 00033 public: 00034 00035 Commander(int verbosity, double limit, Graph* _graph, Mission* _mission, 00036 const ZonePerimeterList& _zones); 00037 ~Commander(); 00038 art_msgs::Order command(const art_msgs::NavigatorState &cur_navstate); 00039 00040 private: 00041 int verbose; 00042 00043 CmdrFSM* fsm; 00044 00045 Graph* graph; 00046 Mission* mission; 00047 00048 Blockages* blockages; 00049 00050 ElementID current_way; 00051 const art_msgs::NavigatorState *navstate; // current Navigator state 00052 art_msgs::Order order; 00053 00054 WayPointNode goal; // next checkpoint goal 00055 WayPointNode goal2; // following checkpoint 00056 00057 ZonePerimeterList zones; 00058 00059 Path* route; 00060 00061 float speedlimit; 00062 int replan_num; 00063 00064 // private methods: 00065 00066 // return most urgent current event 00067 CmdrEvent current_event(void); 00068 00069 // get next checkpoint, return true if any remain 00070 bool next_checkpoint(void); 00071 00072 // prepare next Navigator order 00073 art_msgs::Order prepare_order(art_msgs::Behavior::_value_type behavior); 00074 00075 // replan route, return true if successful 00076 bool replan_route(); 00077 00078 // set immediate checkpoint goals from mission 00079 void set_checkpoint_goals(void); 00080 }; 00081 00082 00083 #endif