00001
00002
00003
00004
00005
00006
00007
00008
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
00030 typedef enum
00031 {
00032 Backward,
00033 Forward,
00034 Wait,
00035 } state_t;
00036
00037 state_t state;
00038 bool do_init;
00039
00040
00041
00042 Stop *stop;
00043
00044
00045 float goal_heading;
00046 poly uturn_exit;
00047 poly uturn_entry;
00048 poly_list_t uturn_polys;
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__