MapLanes.h
Go to the documentation of this file.
00001 /* -*- mode: C++ -*- */
00002 /*
00003  *  Copyright (C) 2007, 2010 David Li, Patrick Beeson, Jack O'Quin
00004  *
00005  *  License: Modified BSD Software License Agreement
00006  * 
00007  *  $Id: MapLanes.h 614 2010-09-24 15:08:46Z jack.oquin $
00008  */
00009 
00018 #ifndef __MapLanes_h__
00019 #define __MapLanes_h__
00020 
00021 #include <math.h>
00022 #include <vector>
00023 #include <stdio.h>
00024 
00025 #include <art/UTM.h>
00026 #include <art/error.h>
00027 #include <art/conversions.h>
00028 
00029 #include <art_msgs/ArtLanes.h>
00030 #include <art_map/FilteredPolygon.h>
00031 #include <art_map/DrawLanes.h>
00032 #include <art_map/Graph.h>
00033 #include <art_map/PolyOps.h>
00034 #include <art_map/RNDF.h>
00035 #include <art_map/SmoothCurve.h>
00036 #include <art_map/types.h>
00037 #include <art_map/zones.h>
00038 
00039 #define MIN_POLY_SIZE 2.5
00040 
00041 //#define DEBUGMAP
00042 
00043 class MapLanes
00044 {
00045 public:
00046   MapLanes(float r=-1)
00047   {
00048     range = r;
00049     transition=false;
00050     trans_index=-1;
00051   };
00052   ~MapLanes()
00053   {
00054      #ifdef DEBUGMAP
00055       fclose(debugFile);
00056      #endif
00057    };
00058 
00059   int MapRNDF(Graph* _graph, float _max_poly_size=MIN_POLY_SIZE);
00060 
00061   int getAllLanes(art_msgs::ArtLanes *lanes);
00062   int getLanes(art_msgs::ArtLanes *lanes, MapXY here);
00063   int getVisionLanes(art_msgs::ArtLanes *lanes, float x, float y, float heading);
00064 
00065   void SetGPS(double centerX, double centerY)
00066   {
00067     cX=centerX;
00068     cY=centerY;
00069   }
00070 
00071   void SetRobotPos(MapPose pose)
00072   {
00073     rX = pose.map.x;
00074     rY = pose.map.y;
00075     rOri = pose.yaw;
00076   }
00077 
00078   //for testing purposes, outputs an image of all polygons
00079   void testDraw(bool with_trans = false);
00080   void testDraw(bool with_trans, const ZonePerimeterList &zones);
00081   void UpdateWithCurrent(int i);
00082 
00083   void UpdatePoly(polyUpdate upPoly, float rX, float rY, float rOri);
00084 
00085 private:
00086   int32_t poly_id_counter;
00087   std::vector<poly> allPolys;
00088   std::vector<FilteredPolygon> filtPolys;
00089 
00090   float max_poly_size;
00091 
00092   float range;
00093 
00094   bool transition;
00095   int trans_index;
00096 
00097   Graph* graph;
00098 
00099   float rX,rY,rOri;
00100 
00101   void MakePolygons();
00102 
00103   poly build_waypoint_poly(const WayPointNode& w1, const WayPointEdge &e,
00104                            const Point2f& _pt,
00105                            float time,
00106                            SmoothCurve& c);
00107 
00108   void MakeLanePolygon(WayPointNode w1, WayPointNode w2, WayPointEdge e,
00109                        float time1, float time2,
00110                        SmoothCurve& c,
00111                        bool new_edge,
00112                        float ltime1, float ltime2,
00113                        SmoothCurve& lc,
00114                        float rtime1, float rtime2,
00115                        SmoothCurve& rc);
00116 
00117   void MakeTransitionPolygon(WayPointNode w1, WayPointNode w2, WayPointEdge e, 
00118                              float time1, float time2,
00119                              SmoothCurve& c);
00120 
00121   void SetFilteredPolygons();
00122 
00123   PolyOps ops;
00124   
00125   // File Writing / Reading
00126   bool WriteToFile(char* fName);
00127   bool LoadFromFile(char* fName);
00128 
00129   double cX;
00130   double cY;
00131 
00132 #ifdef DEBUGMAP
00133   // Debugging stuff
00134   FILE* debugFile;
00135   void WritePolygonToDebugFile(int poly_id); 
00136 #endif
00137 };
00138 
00139 #endif // __MapLanes_h__


art_map
Author(s): David Li, Patrick Beeson, Bartley Gillen, Tarun Nimmagadda, Mickey Ristroph, Michael Quinlan, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:08:34