NavEstopState.h
Go to the documentation of this file.
00001 /* -*- mode: C++ -*-
00002  * 
00003  *  Navigator E-stop finite state machine states
00004  *
00005  *  Copyright (C) 2007, 2010, Austin Robot Technology
00006  *
00007  *  License: Modified BSD Software License Agreement
00008  *
00009  *  $Id: NavEstopState.h 1539 2011-05-09 04:09:20Z jack.oquin $
00010  *
00011  *  Author: Jack O'Quin
00012  */
00013 
00014 
00015 #ifndef __NAV_ESTOP_STATE_H__
00016 #define __NAV_ESTOP_STATE_H__
00017 
00018 #include <art_msgs/EstopState.h>
00019 #include <art_nav/FSMstate.h>
00020 
00021 class NavEstopState: FSMstate
00022 {
00023 public:
00024 
00025   // navigator E-stop control states
00026   typedef enum
00027     {
00028       Pause = art_msgs::EstopState::Pause,
00029       Run = art_msgs::EstopState::Run,
00030       Done = art_msgs::EstopState::Done,
00031       Suspend = art_msgs::EstopState::Suspend,
00032       N_states = art_msgs::EstopState::N_states
00033     } state_t;
00034 
00035   NavEstopState()
00036   {
00037     this->state = Pause;
00038   }
00039 
00040   NavEstopState(state_t &istate)
00041   {
00042     this->state = istate;
00043   }
00044 
00045   NavEstopState(const art_msgs::EstopState &estop_msg)
00046   {
00047     this->state = (NavEstopState::state_t) estop_msg.state;
00048   }
00049 
00050   ~NavEstopState();
00051 
00052   state_t Value(void) const
00053   {
00054     return this->state;
00055   }
00056 
00057   // return state name as a C string
00058   const char *Name(void) const
00059   {
00060     static const char *state_name[N_states] =
00061       {
00062         "Pause",
00063         "Run",
00064         "Done",
00065         "Suspend",
00066       };
00067     return state_name[this->state];
00068   }
00069 
00070   void operator=(const NavEstopState::state_t &newstate)
00071   {
00072     this->state = newstate;
00073   }
00074 
00075   void operator=(uint16_t value)
00076   {
00077     this->state = (NavEstopState::state_t) value;
00078   }
00079 
00080   bool operator==(const NavEstopState &compare) const
00081   {
00082     return this->state == compare.state;
00083   }
00084 
00085   bool operator==(const state_t &compare) const
00086   {
00087     return this->state == compare;
00088   }
00089 
00090   bool operator!=(const NavEstopState &compare) const
00091   {
00092     return this->state != compare.state;
00093   }
00094 
00095   bool operator!=(const state_t &compare) const
00096   {
00097     return this->state != compare;
00098   }
00099 
00100 private:
00101   state_t state;
00102 };
00103 
00104 #endif // __NAV_ESTOP_STATE_H__


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