|
CARLA
|
Namespaces | |
| namespace | geom |
Classes | |
| struct | BoundingBox |
| struct | ClassDefaults |
| Per highway class defaults, ported from profiles.py's _EU_CLASSES. More... | |
| struct | Connection |
| struct | Controller |
| struct | Elevation |
| struct | Geom |
| struct | Junction |
| struct | Lane |
| One lane of a road, numbered outward from the reference line. More... | |
| struct | LaneGraphOptions |
| struct | LaneLink |
| struct | LaneProfile |
| The lane layout an OSM way resolves to, before it is cut at junctions. More... | |
| class | LocalFrame |
| WGS84 <-> local ENU metres, a transverse Mercator centred on the origin. More... | |
| struct | Marking |
| struct | OsmData |
| struct | OsmMember |
| struct | OsmNode |
| struct | OsmRelation |
| struct | OsmWay |
| struct | Road |
| struct | RoadLink |
| struct | Signal |
| struct | SignalOptions |
| struct | SignalType |
| struct | TwinModelData |
| Everything the OpenDRIVE writer reads. More... | |
Typedefs | |
| using | Tags = std::map< std::string, std::string > |
Enumerations | |
| enum class | ContactPoint { Start , End } |
| enum class | Direction { Forward , Backward , Both } |
| enum class | LaneType { Driving , Sidewalk , Shoulder , Parking , Biking , Border , Restricted , Median , None } |
| enum class | LinkElement { Road , Junction } |
| enum class | MarkingColor { White , Yellow } |
| enum class | MarkingKind { None , Solid , Broken , SolidSolid , SolidBroken , BrokenSolid , BrokenBroken } |
| enum class | SignalKind { TrafficLight , TrafficLightPedestrian , SpeedLimit , Stop , Yield , PriorityRoad , Crosswalk } |
| OpenDRIVE type/subtype follow road/SignalType.h; the crosswalk is not a signal in CARLA but an <object type="crosswalk">. More... | |
Functions | |
| TwinModelData | BuildLaneGraph (const OsmData &osm, const LocalFrame &frame, const std::string &name, const LaneGraphOptions &options=LaneGraphOptions()) |
| OSM ways -> roads, lanes and junctions in model space. | |
| void | BuildSignals (const OsmData &osm, const LocalFrame &frame, TwinModelData &model, const SignalOptions &options) |
| Read traffic lights, stop and give-way signs, speed limits and crossings out of the OSM tags and attach them to the roads they govern. | |
| std::string | ExportXodr (const TwinModelData &model, const LocalFrame &frame) |
| Serialise the model as an OpenDRIVE 1.6 document. | |
| const ClassDefaults * | FindClassDefaults (const std::string &highway) |
| const std::string * | FindTag (const Tags &tags, const std::string &key) |
| std::vector< Geom > | FitPlanView (const geom::Line3 &line, double max_offset=kMaxPlanViewOffset) |
| Fit a polyline as a piecewise cubic paramPoly3 planview. | |
| SignalType | GetSignalType (SignalKind kind) |
| bool | HasTag (const Tags &tags, const std::string &key, const std::string &value) |
| bool | IsDrivable (const std::string &highway) |
| True when the way carries motor traffic and should become a Road. | |
| std::optional< double > | ParseMaxSpeed (const std::string &value) |
| Parse an OSM maxspeed value into m/s; "50", "50 km/h" and "30 mph". | |
| OsmData | ParseOsmXml (const std::string &xml) |
| Parse an OpenStreetMap XML document. | |
| LaneProfile | ResolveProfile (const std::string &highway, const Tags &tags) |
| Resolve the lane layout from the way's tags, falling back to the class defaults. | |
| const char * | ToString (ContactPoint point) |
| const char * | ToString (Direction direction) |
| const char * | ToString (LaneType type) |
| const char * | ToString (MarkingColor color) |
| const char * | ToString (MarkingKind kind) |
Variables | |
| constexpr double | kMaxPlanViewOffset = 0.25 |
| A vertex whose rounding would pull the curve further than this off the polyline becomes a corner instead; export/xodr.py's MAX_PLANVIEW_OFFSET. | |
| using twinmodel::Tags = typedef std::map<std::string, std::string> |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
OpenDRIVE type/subtype follow road/SignalType.h; the crosswalk is not a signal in CARLA but an <object type="crosswalk">.
| Enumerator | |
|---|---|
| TrafficLight | |
| TrafficLightPedestrian | |
| SpeedLimit | |
| Stop | |
| Yield | |
| PriorityRoad | |
| Crosswalk | |
| TwinModelData twinmodel::BuildLaneGraph | ( | const OsmData & | osm, |
| const LocalFrame & | frame, | ||
| const std::string & | name, | ||
| const LaneGraphOptions & | options = LaneGraphOptions() |
||
| ) |
OSM ways -> roads, lanes and junctions in model space.
The C++ port of twinmodel/lanegraph.py's build_lanegraph.
Definition at line 339 of file LaneGraph.cpp.
References twinmodel::LaneGraphOptions::clip, twinmodel::LaneGraphOptions::cluster_m, twinmodel::Connection::connecting_road, contact, twinmodel::Connection::contact_point, twinmodel::Lane::direction, Driving, End, twinmodel::TwinModelData::FindRoad(), FindTag(), Forward, twinmodel::LocalFrame::GetOriginLatitude(), twinmodel::LocalFrame::GetOriginLongitude(), twinmodel::geom::HeadingAt(), highway, twinmodel::Road::highway, twinmodel::geom::Hypot(), twinmodel::Lane::id, twinmodel::RoadLink::id, twinmodel::Road::id, twinmodel::Connection::id, twinmodel::Junction::id, twinmodel::Connection::incoming_road, IsDrivable(), Junction, junction, twinmodel::Road::junction_id, twinmodel::LaneGraphOptions::junction_radius, twinmodel::TwinModelData::junctions, twinmodel::Connection::lane_links, twinmodel::Road::lanes, twinmodel::geom::Length(), twinmodel::LaneGraphOptions::min_road_length, twinmodel::TwinModelData::name, node, twinmodel::OsmData::nodes, twinmodel::geom::NormalizeAngle(), twinmodel::TwinModelData::origin_lat, twinmodel::TwinModelData::origin_lon, point, twinmodel::Road::predecessor, twinmodel::Lane::predecessor_lane, twinmodel::Road::reference_line, ResolveProfile(), Road, road, road_id, twinmodel::TwinModelData::roads, Start, twinmodel::Road::successor, twinmodel::Lane::successor_lane, twinmodel::geom::To2D(), twinmodel::LocalFrame::ToLocal(), twinmodel::Lane::type, twinmodel::LaneGraphOptions::uturn_deg, twinmodel::OsmData::ways, twinmodel::Lane::width, x, and y.
Referenced by osm2odr::ConvertOSMToOpenDRIVE().
| void twinmodel::BuildSignals | ( | const OsmData & | osm, |
| const LocalFrame & | frame, | ||
| TwinModelData & | model, | ||
| const SignalOptions & | options | ||
| ) |
Read traffic lights, stop and give-way signs, speed limits and crossings out of the OSM tags and attach them to the roads they govern.
Definition at line 89 of file Signals.cpp.
References twinmodel::SignalOptions::all_junctions_traffic_lights, twinmodel::TwinModelData::controllers, Crosswalk, twinmodel::TwinModelData::FindRoad(), FindTag(), twinmodel::SignalOptions::generate_traffic_lights, twinmodel::geom::HeadingAt(), highway, twinmodel::Controller::id, twinmodel::geom::Interpolate(), junction, twinmodel::Controller::junction_id, twinmodel::TwinModelData::junctions, twinmodel::geom::Length(), node, twinmodel::OsmData::nodes, ParseMaxSpeed(), point, PriorityRoad, road, road_id, twinmodel::TwinModelData::roads, twinmodel::Controller::sequence, twinmodel::Controller::signal_ids, twinmodel::TwinModelData::signals, twinmodel::SignalOptions::snap_m, SpeedLimit, Stop, twinmodel::geom::To2D(), twinmodel::LocalFrame::ToLocal(), TrafficLight, TrafficLightPedestrian, x, y, and Yield.
Referenced by osm2odr::ConvertOSMToOpenDRIVE().
| std::string twinmodel::ExportXodr | ( | const TwinModelData & | model, |
| const LocalFrame & | frame | ||
| ) |
Serialise the model as an OpenDRIVE 1.6 document.
The C++ port of twinmodel/export/xodr.py's export_xodr.
Definition at line 345 of file XodrExport.cpp.
References pugi::xml_node::append_attribute(), pugi::xml_node::append_child(), twinmodel::TwinModelData::controllers, twinmodel::LocalFrame::GetProjString(), junction, twinmodel::TwinModelData::junctions, twinmodel::TwinModelData::name, node, pugi::node_cdata, pugi::node_declaration, pugi::xml_node::prepend_child(), road, twinmodel::TwinModelData::roads, pugi::xml_document::save(), pugi::xml_attribute::set_value(), pugi::xml_node::set_value(), twinmodel::TwinModelData::signals, and ToString().
Referenced by osm2odr::ConvertOSMToOpenDRIVE().
| const ClassDefaults * twinmodel::FindClassDefaults | ( | const std::string & | highway | ) |
|
inline |
Definition at line 20 of file Model.h.
References tags.
Referenced by BuildLaneGraph(), BuildSignals(), HasTag(), and ResolveProfile().
| std::vector< Geom > twinmodel::FitPlanView | ( | const geom::Line3 & | line, |
| double | max_offset = kMaxPlanViewOffset |
||
| ) |
Fit a polyline as a piecewise cubic paramPoly3 planview.
Tangent directions are Catmull-Rom, magnitudes the chord length, each segment expressed in the frame rotated to its start tangent so hdg stays G1.
Definition at line 102 of file PlanView.cpp.
References twinmodel::Geom::coeffs, twinmodel::Geom::hdg, twinmodel::Geom::is_line, twinmodel::Geom::length, twinmodel::Geom::s, x, twinmodel::Geom::x, y, and twinmodel::Geom::y.
| SignalType twinmodel::GetSignalType | ( | SignalKind | kind | ) |
Definition at line 52 of file ModelStrings.cpp.
References Crosswalk, PriorityRoad, SpeedLimit, Stop, TrafficLight, TrafficLightPedestrian, and Yield.
|
inline |
| bool twinmodel::IsDrivable | ( | const std::string & | highway | ) |
True when the way carries motor traffic and should become a Road.
Definition at line 70 of file Profiles.cpp.
References highway.
Referenced by BuildLaneGraph().
| std::optional< double > twinmodel::ParseMaxSpeed | ( | const std::string & | value | ) |
Parse an OSM maxspeed value into m/s; "50", "50 km/h" and "30 mph".
Definition at line 84 of file Profiles.cpp.
Referenced by BuildSignals(), and ResolveProfile().
| OsmData twinmodel::ParseOsmXml | ( | const std::string & | xml | ) |
Parse an OpenStreetMap XML document.
Throws std::runtime_error when the document cannot be parsed or carries no nodes.
Definition at line 47 of file OsmIngest.cpp.
References pugi::xml_attribute::as_double(), pugi::xml_node::attribute(), twinmodel::OsmData::bbox, pugi::xml_node::child(), pugi::xml_parse_result::description(), twinmodel::BoundingBox::east, twinmodel::OsmNode::id, twinmodel::OsmWay::id, twinmodel::OsmRelation::id, twinmodel::OsmNode::lat, pugi::xml_document::load_buffer(), twinmodel::OsmNode::lon, twinmodel::OsmRelation::members, pugi::xml_node::next_sibling(), node, twinmodel::OsmWay::nodes, twinmodel::OsmData::nodes, twinmodel::BoundingBox::north, twinmodel::OsmMember::ref, twinmodel::OsmData::relations, twinmodel::OsmMember::role, twinmodel::BoundingBox::south, twinmodel::OsmNode::tags, twinmodel::OsmWay::tags, twinmodel::OsmRelation::tags, twinmodel::OsmMember::type, twinmodel::OsmData::ways, and twinmodel::BoundingBox::west.
Referenced by osm2odr::ConvertOSMToOpenDRIVE().
| LaneProfile twinmodel::ResolveProfile | ( | const std::string & | highway, |
| const Tags & | tags | ||
| ) |
Resolve the lane layout from the way's tags, falling back to the class defaults.
Honours lanes, lanes:forward/backward, oneway, width, maxspeed.
Definition at line 96 of file Profiles.cpp.
References twinmodel::LaneProfile::backward_lanes, FindClassDefaults(), FindTag(), twinmodel::LaneProfile::forward_lanes, highway, twinmodel::ClassDefaults::lane_width, twinmodel::LaneProfile::lane_width, twinmodel::ClassDefaults::lanes, twinmodel::LaneProfile::oneway, ParseMaxSpeed(), twinmodel::ClassDefaults::shoulder, twinmodel::LaneProfile::shoulder, twinmodel::ClassDefaults::shoulder_inner, twinmodel::LaneProfile::shoulder_inner, twinmodel::ClassDefaults::sidewalk_width, twinmodel::LaneProfile::sidewalk_width, twinmodel::LaneProfile::speed_limit, and tags.
Referenced by BuildLaneGraph().
| const char * twinmodel::ToString | ( | ContactPoint | point | ) |
Definition at line 65 of file ModelStrings.cpp.
| const char * twinmodel::ToString | ( | Direction | direction | ) |
Definition at line 26 of file ModelStrings.cpp.
| const char * twinmodel::ToString | ( | LaneType | type | ) |
Definition at line 11 of file ModelStrings.cpp.
References Biking, Border, Driving, Median, None, Parking, Restricted, Shoulder, and Sidewalk.
Referenced by ExportXodr().
| const char * twinmodel::ToString | ( | MarkingColor | color | ) |
Definition at line 48 of file ModelStrings.cpp.
References Yellow.
| const char * twinmodel::ToString | ( | MarkingKind | kind | ) |
Definition at line 35 of file ModelStrings.cpp.
References Broken, BrokenBroken, BrokenSolid, None, Solid, SolidBroken, and SolidSolid.
|
constexpr |
A vertex whose rounding would pull the curve further than this off the polyline becomes a corner instead; export/xodr.py's MAX_PLANVIEW_OFFSET.
Definition at line 18 of file PlanView.h.