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


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