$search
00001 /* -*- mode: C++ -*- 00002 * 00003 * Finite state machine interface 00004 * 00005 * Copyright (C) 2007, 2010, Austin Robot Technology 00006 * 00007 * License: Modified BSD Software License Agreement 00008 * 00009 * $Id: evade.h 519 2010-09-01 04:39:33Z jack.oquin $ 00010 */ 00011 00012 #ifndef __EVADE_HH__ 00013 #define __EVADE_HH__ 00014 00015 class Halt; 00016 class LaneEdge; 00017 class Safety; 00018 class NavTimer; 00019 00020 class Evade: public Controller 00021 { 00022 public: 00023 00024 Evade(Navigator *navptr, int _verbose); 00025 ~Evade(); 00026 void configure(); 00027 result_t control(pilot_command_t &pcmd); 00028 void reset(void); 00029 00030 private: 00031 00032 // .cfg variables 00033 float evade_delay; 00034 float evade_offset_ratio; 00035 float evasion_speed; 00036 00037 // simple state machine 00038 typedef enum 00039 { 00040 Init, 00041 Leave, 00042 Wait, 00043 Return, 00044 } state_t; 00045 00046 state_t state; // current FSM state 00047 00048 NavTimer *evade_timer; 00049 00050 // subordinate controllers 00051 Halt *halt; 00052 LaneEdge *lane_edge; 00053 Safety *safety; 00054 00055 Controller::result_t leave_lane_right(pilot_command_t &pcmd); 00056 void reset_me(void); 00057 void set_state(state_t newstate); 00058 }; 00059 00060 #endif // __EVADE_HH__