estop.h
Go to the documentation of this file.
00001 /* -*- mode: C++ -*-
00002  *
00003  * Navigator E-stop controller finite state machine
00004  *
00005  *  Copyright (C) 2007, 2010, Austin Robot Technology
00006  *
00007  *  License: Modified BSD Software License Agreement
00008  *
00009  *  $Id: estop.h 1027 2011-03-06 16:19:07Z jack.oquin $
00010  */
00011 
00012 #ifndef __ESTOP_HH__
00013 #define __ESTOP_HH__
00014 
00015 #include <art_nav/NavEstopState.h>
00016 
00017 #include "Controller.h"
00018 #include "NavEstopEvent.h"
00019 
00020 // forward declarations for subordinate classes
00021 class Halt;
00022 class Run;
00023 
00024 class Estop: public Controller
00025 {
00026 public:
00027 
00028   Estop(Navigator *navptr, int _verbose);
00029   ~Estop();
00030   result_t control(pilot_command_t &pcmd);
00031   void reset(void);
00032 
00033   NavEstopState State(void)
00034   {
00035     return state;
00036   }
00037 
00038 private:
00039 
00040   // state transition action method pointer
00041   typedef result_t (Estop::*action_t)(pilot_command_t &pcmd);
00042 
00043   // state transition table entry
00044   typedef struct
00045   {
00046     NavEstopState  next;
00047     action_t       action;
00048   } transtion_t;
00049 
00050   NavEstopEvent event;
00051   NavEstopEvent pending_event;
00052   NavEstopState prev;
00053   NavEstopState state;
00054   transtion_t ttable[NavEstopEvent::N_events][NavEstopState::N_states];
00055 
00056   // subordinate controllers
00057   Halt  *halt;
00058   Run   *run;
00059 
00060   // private methods
00061 
00062   // add a transition to the table
00063   void Add(NavEstopEvent::event_t event, action_t action,
00064            NavEstopState::state_t from_state, NavEstopState::state_t to_state);
00065 
00066   // return highest-priority current event
00067   NavEstopEvent current_event(void);
00068   void reset_me(void);
00069 
00071   // state transition action methods
00073 
00074   result_t ActionError(pilot_command_t &pcmd);
00075 
00076   // steady state actions
00077 
00078   result_t ActionInDone(pilot_command_t &pcmd);
00079   result_t ActionInPause(pilot_command_t &pcmd);
00080   result_t ActionInRun(pilot_command_t &pcmd);
00081   result_t ActionInSuspend(pilot_command_t &pcmd);
00082 
00083   // state entry actions
00084 
00085   result_t ActionToAbort(pilot_command_t &pcmd);
00086   result_t ActionToDone(pilot_command_t &pcmd);
00087   result_t ActionToPause(pilot_command_t &pcmd);
00088   result_t ActionToRun(pilot_command_t &pcmd);
00089   result_t ActionToSuspend(pilot_command_t &pcmd);
00090 };
00091 
00092 #endif // __ESTOP_HH__


art_nav
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:08:43