$search
00001 /* -*- mode: C++ -*- 00002 * 00003 * Navigator E-stop finite state machine events 00004 * 00005 * Copyright (C) 2007, 2010, Austin Robot Technology 00006 * 00007 * License: Modified BSD Software License Agreement 00008 * 00009 * $Id: NavEstopEvent.h 1027 2011-03-06 16:19:07Z jack.oquin $ 00010 */ 00011 00012 #ifndef __NAV_ESTOP_EVENT_HH__ 00013 #define __NAV_ESTOP_EVENT_HH__ 00014 00015 #include <art_nav/FSMevent.h> 00016 00017 class NavEstopEvent: FSMevent 00018 { 00019 public: 00020 00021 // navigator E-stop control events 00022 typedef enum 00023 { 00024 Abort, // E-stop disable 00025 Pause, // E-stop pause 00026 Quit, // run finished normally 00027 Run, // E-stop run enabled 00028 Suspend, // suspend autonomous operation 00029 None, // no E-stop event this cycle 00030 N_events 00031 } event_t; 00032 00033 // return event name as a C string 00034 const char *Name(void) 00035 { 00036 static const char *event_name[N_events] = 00037 { 00038 "Abort", 00039 "Pause", 00040 "Quit", 00041 "Run", 00042 "Suspend", 00043 "None", 00044 }; 00045 return event_name[this->event]; 00046 } 00047 00048 NavEstopEvent() 00049 { 00050 this->event = Pause; 00051 } 00052 00053 NavEstopEvent(event_t ievent) 00054 { 00055 this->event = ievent; 00056 } 00057 00058 ~NavEstopEvent() {}; 00059 00060 event_t Value(void) 00061 { 00062 return this->event; 00063 } 00064 00065 void operator=(const NavEstopEvent::event_t &newevent) 00066 { 00067 this->event = newevent; 00068 } 00069 00070 bool operator==(const event_t &compare) 00071 { 00072 return this->event == compare; 00073 } 00074 00075 bool operator!=(const event_t &compare) 00076 { 00077 return this->event != compare; 00078 } 00079 00080 private: 00081 event_t event; 00082 }; 00083 00084 #endif // __NAV_ESTOP_EVENT_HH__