$search
00001 /* -*- mode: C++ -*- 00002 * 00003 * Navigator U-turn controller 00004 * 00005 * Copyright (C) 2010, Austin Robot Technology 00006 * License: Modified BSD Software License Agreement 00007 * 00008 * $Id: uturn.h 872 2010-11-28 13:31:07Z jack.oquin $ 00009 */ 00010 00011 #ifndef __UTURN_HH__ 00012 #define __UTURN_HH__ 00013 00014 class Safety; 00015 class Stop; 00016 00017 class Uturn: public Controller 00018 { 00019 public: 00020 00021 Uturn(Navigator *navptr, int _verbose); 00022 ~Uturn(); 00023 void configure(); 00024 result_t control(pilot_command_t &pcmd); 00025 void reset(void); 00026 00027 private: 00028 00029 // simple state machine 00030 typedef enum 00031 { 00032 Backward, // moving backward 00033 Forward, // moving forward 00034 Wait, // wait until lane clear 00035 } state_t; 00036 00037 state_t state; // current FSM state 00038 bool do_init; 00039 00040 // subordinate controllers 00041 //Safety *safety; 00042 Stop *stop; 00043 00044 // private data 00045 float goal_heading; // heading of goal way-point 00046 poly uturn_exit; // current U-turn exit poly 00047 poly uturn_entry; // U-turn entry (goal) poly 00048 poly_list_t uturn_polys; // polygons for U-turn lanes 00049 00050 float calculate_arc_length(bool forward, const MapXY& center, 00051 float safety_radius, 00052 const MapXY& p1, const MapXY& p2); 00053 bool circle_and_line_intersect(MapXY center, float radius, 00054 MapXY p1, MapXY p2, 00055 MapXY &meet_point); 00056 float estimate_uturn_distance(bool forward, float desired_arc_length); 00057 Controller::result_t initialize(void); 00058 bool outside_lanes_front(void); 00059 bool outside_lanes_rear(void); 00060 bool point_outside_lanes(MapXY point); 00061 void reset_me(void); 00062 void set_state(state_t newstate); 00063 MapXY wheel_location(float x, float y); 00064 }; 00065 00066 #endif // __UTURN_HH__