diff --git a/LibCarla/source/carla/road/MapBuilder.h b/LibCarla/source/carla/road/MapBuilder.h index fa55cff24..c49d572ba 100644 --- a/LibCarla/source/carla/road/MapBuilder.h +++ b/LibCarla/source/carla/road/MapBuilder.h @@ -6,16 +6,91 @@ #pragma once -namespace carla { -namespace road { +#include "carla/geom/Location.h" +#include "carla/road/Map.h" - class MapBuilder { - public: +#include +#include +namespace carla +{ +namespace road +{ +using id_type = size_t; +// Geometry //////////////////////////////////////////////////////////// - }; +enum class GeometryType : unsigned int +{ + LINE, + ARC, + SPIRAL +}; + +struct Geometry +{ + GeometryType type; // geometry type + double length = 1.0; // length of the road section [meters] + + double start_position_offset = 0.0; // s-offset [meters] + double heading = 0.0; // start orientation [radians] + + geom::Location start_position; // [meters] + +protected: + Geometry(GeometryType type) : type(type) {} +}; + +struct GeometryLine : public Geometry +{ + GeometryLine() : Geometry(GeometryType::LINE) {} +}; + +struct GeometryArc : public Geometry +{ + double curvature = 0.0; + GeometryArc() : Geometry(GeometryType::ARC) {} +}; + +struct GeometrySpiral : public Geometry +{ + double curve_start = 0.0; + double curve_end = 0.0; + GeometrySpiral() : Geometry(GeometryType::SPIRAL) {} +}; + +// Roads ////////////////////////////////////////////////////////////// + +struct RoadInfo +{ + // distance from RoadSegment origin to where + // the informations starts affecting + double d = 0; // [meters] +}; + +struct SpeedLimit : public RoadInfo +{ + double value = 0; // [meters/second] +}; + +struct RoadSegment +{ + id_type id = -1; + std::vector predecessor_id; + std::vector successor_id; + std::vector geom; + std::multimap info; +}; + +class MapBuilder +{ +public: + bool AddRoadSegment(const RoadSegment &seg) {} + +private: + Map map; +}; } // namespace road -} // namespace carla +} // namespace carla \ No newline at end of file