cajun::state_machine_t Class Reference

#include <state_machine.H>

List of all members.

Public Member Functions

 state_machine_t (task_plan_handler_t *tp_handler_, mission_handler_t *mission_handler_, tp_plan_t *tp_plan_, world_state_t *ws_, rndf_t const *rndf_, mdf_t const *mdf_)
bool update_state ()
 Returns False = if modified tp_plan and need to regenerate the path, else returns true.
bool is_bot_stopped () const
bool lane_blocked () const
 Returns true if bot stopped for given amount of time.
void tp_blocked (blocked_lane_data_t const &blk_data_, unsigned blk_tp_ind_, unsigned path_blk_ind_, unsigned LA_tp_ind_, unsigned LA_path_ind_)
 informs state machine that a TP is blocked
bool active_TP_blocked () const
 Returns true if active TP is blocked.
bool tp_blocked_is_LF () const
bool drove_to_blk_safety_distance () const
 Returns true if blocked TP has its zero size path or if 1st or 2nd point of its path is set to zero speed.
bool blk_before_stop_intersection () const
 blk is before any stop intersection, does not mean just before stop intersection
bool blk_after_stop_intersection () const
 There is a stop intersection before blk.
bool blk_at_intersection () const
 blk with in intersection region
bool blk_in_safety_region () const
 Returns false if the blk is not close to intersection, else returns false. Especially used for checking if PL_TP or CL_TP is possible hence not checking after_intersection_distance.
bool blk_just_before_stop_intersection () const
bool no_blockage () const
 Returns true if path is not blocked.
bool completed_CL () const
 Returns true if first TP is not change lane task planner.
bool completed_PL () const
 Returns true if first TP is not passing lane task planner.
bool completed_UT () const
 Returns true if first TP is not uturn task planner.
bool lane_for_CL (unsigned &change_lid_) const
 Returns true if there is neighboring lane to which can switch lane. Else returns false. The condition checked to make sure there is path possible to new lane is checking if there is enough free distance to travel on new lane and enough free space on intermediate lanes for going to that lane. It check this for lanes in both left and right hand side and picks the new lane with minimum lane changes.
bool passing_lane_exist (unsigned &passing_lid_) const
 Returns true if one of the immediate neighbors is passing lane.
bool enough_passing_lane_exist (unsigned passing_lid_) const
 Returns true if enough passing lane exist away from safety region.
bool passing_lane_blocked (unsigned passing_lid_) const
 Returns false if either enough passing lane is not available or its blocked by any static obstacles.
bool enough_uturn_region (unsigned passing_lid_) const
 Returns true if there is enough area for U-turn, ie safe enough away from intersection on present and new lane.
bool uturn_region_blocked (unsigned lane_id_) const
 returns true if uturn neighboring lane is not blocked for certain distance
bool uturn_takes_to_next_checkpoint (unsigned passing_lid_) const
 Returns true if can reach next checkpoint by making a U-turn.
void change_lane ()
 Adds LF, CL, LF, CL, LF TPs to avoid a obstacle by changing lane in same direction.
void pass_lane ()
 Add passing lane TP.
bool set_road_blocked ()
 Sets the present lane where the obstacle is noticed to be blocked.
void uturn_lane ()
 flushes tp_plan, does graph search from the point where bot would be after U-turn, creates new tp_plan for new mission_plan and appends UT_TP
bool nudge_path ()

Private Member Functions

void update_bot_stopped ()
bool changing_lane_on_one_side (unsigned sid_, unsigned start_lid_, unsigned end_lid_, int del_lid_, double x_, double y_, unsigned &best_lid_, rndf_t::lane_t::direction_t direction_) const
 Goes through start_lid (excluding)to end_lid (including) and checks if there is lane for peroforming change lane and driving on this lane for some fixed distance is possible.
bool switch_lane_possible (unsigned sid_, unsigned org_lid_, unsigned new_lid_, double x_, double y_, double &ch_x_, double &ch_y) const
 Returns true if there is enough safety space for changing lane from seg_ seg, org_lid_ lane at (x_, y_) to new lane new_lid_. If switching lane is possible then returns the expected position on new lane (ch_x_, ch_y_).
void create_new_state (state_machine_id_t state_id_)
 Creates new state machine state and assings it to m_state.
bool rndf_point_after_uturn (rndf_point_t *&start_wp_id, unsigned sid_, unsigned new_lid, double x_, double y_) const
 returns the rndf point just before the point that reached after uturn onto new lane. Returns false if could not find one, else returns true
void point_after_blk (unsigned &aft_blk_sid_, unsigned &aft_blk_lid_, unsigned &aft_blk_wid_, double &aft_blk_x_, double &aft_blk_y_)
 Returns the point after the blockage at a safety distance. Also returns what segment, lane and wp before this point.
void start_new_mission_from (rndf_point_t *start_rp_)

Private Attributes

bool m_bot_stop
double m_bot_stop_time
base_state_machine_tm_state
task_plan_handler_tm_tp_handler
mission_handler_tm_mission_handler
tp_plan_tm_tp_plan
world_state_t * m_ws
rndf_t const * m_rndf
mdf_t const * m_mdf
bool m_tp_blocked
blocked_lane_data_t m_blk_data
unsigned m_blk_tp_ind
unsigned m_path_blk_ind
unsigned m_LA_tp_ind
unsigned m_LA_path_ind
double m_LA_blk_x
double m_LA_blk_y
unsigned m_LA_blk_sid
unsigned m_LA_blk_lid
unsigned m_LA_blk_wid
const uc_planner_param_tm_uc_param

Constructor & Destructor Documentation

state_machine_t::state_machine_t ( task_plan_handler_t tp_handler_,
mission_handler_t mission_handler_,
tp_plan_t tp_plan_,
world_state_t *  ws_,
rndf_t const *  rndf_,
mdf_t const *  mdf_ 
)

Member Function Documentation

bool state_machine_t::active_TP_blocked (  )  const

Returns true if active TP is blocked.

References m_blk_tp_ind, m_tp_blocked, and m_tp_plan.

Referenced by cajun::confirm_obstacle_t::new_state().

bool state_machine_t::blk_after_stop_intersection (  )  const

There is a stop intersection before blk.

References cajun::INTERSECTION_TP, m_blk_tp_ind, and cajun::task_planner_t::type().

Referenced by cajun::lane_blocked_t::new_state().

bool state_machine_t::blk_at_intersection (  )  const
bool state_machine_t::blk_before_stop_intersection (  )  const

blk is before any stop intersection, does not mean just before stop intersection

References cajun::INTERSECTION_TP, m_blk_tp_ind, and cajun::task_planner_t::type().

Referenced by cajun::intersection_queueing_t::new_state(), and cajun::lane_blocked_t::new_state().

bool state_machine_t::blk_in_safety_region (  )  const
bool state_machine_t::blk_just_before_stop_intersection (  )  const
void state_machine_t::change_lane (  ) 
bool state_machine_t::changing_lane_on_one_side ( unsigned  sid_,
unsigned  start_lid_,
unsigned  end_lid_,
int  del_lid_,
double  x_,
double  y_,
unsigned &  best_lid_,
rndf_t::lane_t::direction_t  direction_ 
) const [private]

Goes through start_lid (excluding)to end_lid (including) and checks if there is lane for peroforming change lane and driving on this lane for some fixed distance is possible.

References cajun::before_intersection_within_dis(), cajun::lane_blocked_for_dis(), cajun::uc_planner_param_t::m_dis_to_pass_lane, m_rndf, m_uc_param, m_ws, and switch_lane_possible().

Referenced by lane_for_CL().

bool state_machine_t::completed_CL (  )  const

Returns true if first TP is not change lane task planner.

References cajun::CHANGE_LANE_TP, and m_tp_plan.

Referenced by cajun::changing_lane_t::new_state().

bool state_machine_t::completed_PL (  )  const

Returns true if first TP is not passing lane task planner.

References m_tp_plan, and cajun::PASSING_LANE_TP.

Referenced by cajun::passing_lane_t::new_state().

bool state_machine_t::completed_UT (  )  const

Returns true if first TP is not uturn task planner.

References m_tp_plan, and cajun::UTURN_TP.

Referenced by cajun::uturn_state_t::new_state().

void state_machine_t::create_new_state ( state_machine_id_t  state_id_  )  [private]
bool state_machine_t::drove_to_blk_safety_distance (  )  const

Returns true if blocked TP has its zero size path or if 1st or 2nd point of its path is set to zero speed.

References cajun::task_planner_t::get_path(), and m_blk_tp_ind.

Referenced by cajun::confirm_obstacle_t::new_state().

bool state_machine_t::enough_passing_lane_exist ( unsigned  passing_lid_  )  const
bool state_machine_t::enough_uturn_region ( unsigned  passing_lid_  )  const
bool cajun::state_machine_t::is_bot_stopped (  )  const [inline]

References m_bot_stop.

Referenced by cajun::confirm_obstacle_t::update().

bool state_machine_t::lane_blocked (  )  const

Returns true if bot stopped for given amount of time.

Returns true if road is blocked (fixme: presently checks if tp is blocked

References m_tp_blocked.

Referenced by cajun::post_stop_lane_blocked_t::new_state(), cajun::confirm_obstacle_t::new_state(), and cajun::safe_state_t::new_state().

bool state_machine_t::lane_for_CL ( unsigned &  change_lid_  )  const

Returns true if there is neighboring lane to which can switch lane. Else returns false. The condition checked to make sure there is path possible to new lane is checking if there is enough free distance to travel on new lane and enough free space on intermediate lanes for going to that lane. It check this for lanes in both left and right hand side and picks the new lane with minimum lane changes.

References changing_lane_on_one_side(), m_LA_blk_lid, m_LA_blk_sid, m_LA_blk_x, m_LA_blk_y, and m_rndf.

Referenced by change_lane(), and cajun::pre_stop_lane_blocked_t::new_state().

bool state_machine_t::no_blockage (  )  const

Returns true if path is not blocked.

References m_tp_blocked.

Referenced by cajun::pre_stop_lane_blocked_t::new_state(), and cajun::lane_blocked_t::new_state().

bool cajun::state_machine_t::nudge_path (  )  [inline]
void state_machine_t::pass_lane (  ) 
bool state_machine_t::passing_lane_blocked ( unsigned  passing_lid_  )  const

Returns false if either enough passing lane is not available or its blocked by any static obstacles.

References cajun::lane_blocked_for_dis(), cajun::uc_planner_param_t::m_dis_to_pass_lane, m_LA_blk_sid, m_LA_blk_x, m_LA_blk_y, m_uc_param, and m_ws.

Referenced by cajun::pre_stop_lane_blocked_t::new_state().

bool state_machine_t::passing_lane_exist ( unsigned &  passing_lid_  )  const
void state_machine_t::point_after_blk ( unsigned &  aft_blk_sid_,
unsigned &  aft_blk_lid_,
unsigned &  aft_blk_wid_,
double &  aft_blk_x_,
double &  aft_blk_y_ 
) [private]

Returns the point after the blockage at a safety distance. Also returns what segment, lane and wp before this point.

References m_blk_data, m_rndf, m_uc_param, cajun::uc_planner_param_t::m_width_multiplier, and m_ws.

Referenced by set_road_blocked().

bool state_machine_t::rndf_point_after_uturn ( rndf_point_t *&  start_wp_id,
unsigned  sid_,
unsigned  new_lid,
double  x_,
double  y_ 
) const [private]

returns the rndf point just before the point that reached after uturn onto new lane. Returns false if could not find one, else returns true

References cajun::mission_handler_t::active_rndf_point_before(), m_mission_handler, m_rndf, m_uc_param, and cajun::uc_planner_param_t::m_width_multiplier.

bool state_machine_t::set_road_blocked (  ) 
void state_machine_t::start_new_mission_from ( rndf_point_t start_rp_  )  [private]
bool state_machine_t::switch_lane_possible ( unsigned  sid_,
unsigned  org_lid_,
unsigned  new_lid_,
double  x_,
double  y_,
double &  ch_x_,
double &  ch_y 
) const [private]
void state_machine_t::tp_blocked ( blocked_lane_data_t const &  blk_data_,
unsigned  blk_tp_ind_,
unsigned  path_blk_ind_,
unsigned  LA_tp_ind_,
unsigned  LA_path_ind_ 
)
bool state_machine_t::tp_blocked_is_LF (  )  const
void state_machine_t::update_bot_stopped (  )  [private]

References m_bot_stop, m_bot_stop_time, and m_ws.

Referenced by update_state().

bool state_machine_t::update_state (  ) 
void state_machine_t::uturn_lane (  ) 

flushes tp_plan, does graph search from the point where bot would be after U-turn, creates new tp_plan for new mission_plan and appends UT_TP

References cajun::mission_handler_t::active_rndf_point_before(), m_LA_blk_lid, m_LA_blk_sid, m_LA_blk_wid, m_LA_blk_x, m_LA_blk_y, m_mission_handler, passing_lane_exist(), and start_new_mission_from().

Referenced by cajun::uturn_state_t::update().

bool state_machine_t::uturn_region_blocked ( unsigned  lane_id_  )  const
bool state_machine_t::uturn_takes_to_next_checkpoint ( unsigned  passing_lid_  )  const

Member Data Documentation

blocked_lane_data_t cajun::state_machine_t::m_blk_data [private]

Referenced by tp_blocked().

Referenced by tp_blocked().

mdf_t const* cajun::state_machine_t::m_mdf [private]

Referenced by change_lane().

Referenced by pass_lane(), and tp_blocked().

rndf_t const* cajun::state_machine_t::m_rndf [private]
world_state_t* cajun::state_machine_t::m_ws [private]

The documentation for this class was generated from the following files:

Generated on Fri Apr 9 10:45:15 2010 for UCPlanner by  doxygen 1.6.1