00001 /* -*- mode: C++ -*- 00002 * 00003 * Navigator run controller 00004 * 00005 * Copyright (C) 2007, 2010, Austin Robot Technology 00006 * 00007 * License: Modified BSD Software License Agreement 00008 * 00009 * $Id: run.h 872 2010-11-28 13:31:07Z jack.oquin $ 00010 */ 00011 00012 #ifndef __RUN_HH__ 00013 #define __RUN_HH__ 00014 00015 // forward declarations for subordinate classes 00016 class Halt; 00017 class Road; 00018 class Safety; 00019 class NavTimer; 00020 class VoronoiZone; 00021 00022 class Run: public Controller 00023 { 00024 public: 00025 00026 Run(Navigator *navptr, int _verbose); 00027 ~Run(); 00028 result_t control(pilot_command_t &pcmd); 00029 void reset(void); 00030 00031 private: 00032 00033 // Go behavior state machine 00034 typedef enum 00035 { 00036 Continue, // run road controller 00037 Escape, // try to get unstuck 00038 Replan, // wait for Commander to replan 00039 } state_t; 00040 00041 state_t go_state; // current Go behavior FSM state 00042 MapPose blockage_pose; 00043 float blockage_waypt_dist; 00044 int last_replan; 00045 #if NOT_PORTED_TO_ROS 00046 NavTimer *escape_timer; 00047 #endif 00048 00049 #if NOT_PORTED_TO_ROS 00050 // .cfg variables 00051 bool escape; 00052 float escape_distance; 00053 double escape_timeout_secs; 00054 bool extra_safety_check; 00055 #endif 00056 00057 // subordinate controllers 00058 Halt *halt; 00059 Road *road; 00060 #if NOT_PORTED_TO_ROS 00061 Safety *safety; 00062 VoronoiZone *unstuck; 00063 #endif 00064 00065 // behavior-specific control methods 00066 Controller::result_t initialize(pilot_command_t &pcmd); 00067 Controller::result_t go(pilot_command_t &pcmd); 00068 00069 void begin_escape(void); 00070 void set_go_state(state_t); 00071 ElementID starting_waypt(void); 00072 }; 00073 00074 #endif // __RUN_HH__