1. Documentation

This is the documentation for the Road Generation tool.

1.1. interface.h

This file contains important data structures.

Road-Generation

Copyright (c) 2021 Institut für Kraftfahrzeuge, RWTH Aachen, ika Report bugs and download new versions https://github.com/ika-rwth-aachen/RoadGeneration

This library is distributed under the MIT License.

Author

Jannik Busse, Christian Geller Contact: jannik.busse@rwth-aachen.de, christian.geller@rwth-aachen.de

Enums

enum junctionGroupType

Values:

enumerator roundaboutType
enumerator unknownType
enum contactPointType

Values:

enumerator startType
enumerator endType
enumerator noneType
enum geometryType

Values:

enumerator line
enumerator spiral
enumerator arc
enum linkType

Values:

enumerator roadType
enumerator junctionType

Variables

settings setting
struct connection
#include <interface.h>

connection between two lanes

Public Functions

inline string to_string()

Public Members

int id = -1
int from = -1
int to = -1
contactPointType contactPoint = noneType
int fromLane = -1
int toLane = -1
struct junction
#include <interface.h>

junction holding several connections

Public Functions

inline string to_string()

Public Members

int id = -1
vector<connection> connections
struct roadmark
#include <interface.h>

roadmark holding lane appearance properties

Public Members

double s = 0
string type = "solid"
string weight = "standard"
string color = "white"
double width = 0.15
struct width
#include <interface.h>

width holding the lanewidth with a 3rd order polynomial

Public Members

double s = 0
double a = setting.width.standard
double b = 0
double c = 0
double d = 0
struct offset
#include <interface.h>

offset holding the lanesection offset with a 3rd order polynomial

Public Members

double a = 0
double b = 0
double c = 0
double d = 0
struct material
#include <interface.h>

material holding the material properties of a lane

Public Members

double s = 0
string surface = "asphalt"
double friction = 0.8
double roughness = 0.015
struct lane
#include <interface.h>

lane holding all properties of a lane

Public Members

int id = -1
string type = "driving"
bool turnLeft = false
bool turnStraight = true
bool turnRight = false
bool level = true
double speed = setting.speed.standard
width w
roadmark rm
material m
int preId = -1
int sucId = -1
struct laneSection
#include <interface.h>

laneSection holds several lanes in a defined s section

Public Members

int id = -1
double s = 0
vector<lane> lanes
offset o
struct geometry
#include <interface.h>

geometry holds all properties of a geometry on the reference line

Public Members

geometryType type
double s = -1
double x = -1
double y = -1
double hdg = -1
double length = -1
double c = -1
double c1 = -1
double c2 = -1
#include <interface.h>

link is either predecessor or successor and defines id and properties of previous/next element

Public Members

int id = -1
linkType elementType = roadType
contactPointType contactPoint = noneType
struct object
#include <interface.h>

object holds all object properties

Public Members

int id = -1
string type = ""
double s = 0
double t = 0
double z = 0
double hdg = 0
string orientation = "none"
double length = 0
double width = 0
double height = 0
bool repeat = false
double len = 0
double distance = 0
struct sign
#include <interface.h>

sign holds all signal properties

Public Members

int id = -1
string type = ""
string subtype = "-1"
int rule = -1
double value = -1
double s = 0
double t = 0
double z = 0
string orientation = "none"
double width = 0.4
double height = 2
bool dynamic = false
string country = "OpenDRIVE"
struct control
#include <interface.h>

control to define a controller with several signals

Public Members

int id = -1
vector<sign> signs
struct road
#include <interface.h>

road holding all properties of a road

Public Members

bool isConnectingRoad = false
bool isLinkedToNetwork = false
double length = 0
int id = -1
int inputSegmentId = -1
int inputId = -1
int roundAboutInputSegment = -1
int junction = -1
string inputPos = ""
string type = "town"
string classification = ""
link predecessor
link successor
vector<geometry> geometries
vector<laneSection> laneSections
vector<object> objects
vector<sign> signs
struct junctionGroup

Public Functions

inline junctionGroup()
inline ~junctionGroup()

Public Members

int id
string name
junctionGroupType type = roundaboutType
vector<int> juncIds
struct roadNetwork
#include <interface.h>

roadNetwork is the overall struct holding all data

Public Functions

inline roadNetwork()

Public Members

string file
string outputFile
vector<road> roads
vector<junction> junctions
vector<control> controller
vector<junctionGroup> juncGroups
int nSignal = 0
int nSegment = 0

1.2. Generation

1.2.1. buildSegments.h

file contains a method for generating segments

Functions

int buildSegments(const DOMElement *rootNode, roadNetwork &data)

function creates all segments which can be either a junction, roundabout or connectingroad

Parameters:
  • inputxml – tree structure which contains the input data

  • dataroadNetwork data where the openDrive structure should be generated

Returns:

int error code

1.2.2. junctionWrapper.h

file contains method for generating junctions

Functions

int junctionWrapper(const DOMElement *node, roadNetwork &data)

function takes the junction as input argument and calls the junction type function

Parameters:
  • node – input data from the input file for the tjunction

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.3. tjunction.h

file contains method for generating t junction

Functions

int tjunction(const DOMElement *node, roadNetwork &data)

function generates the roads and junctions for a t junction which is specified in the input file

Parameters:
  • node – input data from the input file for the tjunction

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.4. xjunction.h

file contains method for generating x junction

Functions

int xjunction(const DOMElement *domNode, roadNetwork &data)

function generates the roads and junctions for a x junction which is specified in the input file

Parameters:
  • node – input data from the input file for the xjunction

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.5. roundAbout.h

file contains method for generating roundabout

Functions

int juncGroupIdToJuncId(int juncGroupId, int juncIdx)

translates the input segment id and the index of the junction inside the roundabout to an absolute junction id

Parameters:
  • juncGroupId – input id of the segment. Equals the id of the junction group

  • juncIdx – index of the junction inside the roundabout. Starts with 0 and counting up

Returns:

int resulting id of the junction in the output file

int roundAbout(const DOMElement *node, roadNetwork &data)

function generates the roads and junctions for a roundabout which is specified in the input file

Parameters:
  • node – input data from the input file for the roundAbout

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.6. buildRoad.h

file contains method for building up a road

Functions

int computeFirstLast(DOMElement *roadIn, int &foundfirst, int &foundlast, double &sStart, double &sEnd)

function computes first and last considered geometry in s interval

Parameters:
  • roadIn – road input data

  • foundfirst – id of the first considerd geometry

  • foundlast – id of the last considerd geometry

  • sStart – start of the s interval

  • sEnd – end of the s interval

Returns:

int error code

int generateGeometries(DOMElement *roadIn, road &r, double &sStart, double &sEnd)

function genetares the geometries of the reference line based on an s intervall

Parameters:
  • roadIn – road input data

  • r – road data containing the reference line information

  • sStart – start of the s interval

  • sEnd – end of the s interval

Returns:

int error code

int shiftGeometries(road &r, double sStart, double sEnd, double s0, double x0, double y0, double phi0)

function shift the geometries of the reference line

Parameters:
  • r – road input data

  • sStart – start of s interval

  • sEnd – end of s interval

  • s0 – s0 is origin of reference line

  • x0 – global x position of origin

  • y0 – global y position of origin

  • phi0 – global angle of origin

Returns:

int error code

int flipGeometries(road &r)

function flips geometries of reference line

Parameters:

r – road data error code

int addLanes(DOMElement *roadIn, road &r, int mode)

function adds lanes to the road structure

Parameters:
  • roadIn – road input data

  • r – road data

  • mode – defines the mode (flipped or not)

Returns:

int error code

int addLaneSectionChanges(DOMElement *roadIn, road &r, DOMElement *automaticWidening)

function adds additional lane sections for changing lane structure

Parameters:
  • roadIn – road input data

  • r – road data

  • automaticWidening – automatic widing input data

Returns:

int error code

int buildRoad(DOMElement *roadIn, road &r, double sStart, double sEnd, DOMElement *automaticWidening, double s0, double x0, double y0, double phi0)

function builds a road based on the input data

Parameters:
  • road – road input data

  • r – road data

  • sStart – starting s position

  • sEnd – ending s position

  • automaticWidening – automaticWiding input data

  • s0 – position of s where x0, y0, phi0 should be reached

  • x0 – reference x position

  • y0 – reference y position

  • phi0 – reference angle

Returns:

int error code

1.2.7. connectingRoad.h

file contains method for generating connecting road segment

Functions

int connectingRoad(DOMElement *node, roadNetwork &data)

function generates the road for a connecting road which is specified in the input file

Parameters:
  • node – input data from the input file for the connecting road

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.8. createRoadConnection.h

file contains method for generating connecting road segment

Functions

int connectingRoad(DOMElement *node, roadNetwork &data)

function generates the road for a connecting road which is specified in the input file

Parameters:
  • node – input data from the input file for the connecting road

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

1.2.9. createLaneConnection.h

file contains method for generating lane connection in junction area

Functions

int createLaneConnection(road &r, laneSection lS1, laneSection lS2, int from, int to, string left, string right)

function creates a new lane for a connecting road

Parameters:
  • r – connecting road

  • lS1 – lanesection of adjacent road at start

  • lS2 – lanesection of adjacent road at end

  • from – start lane Id

  • to – end lane Id

  • left – left roadmarking

  • right – right roadmarking

Returns:

int error code

1.2.10. addLaneSections.h

file contains methodology for lanesection changes such as lanedrop, lane widening or restricted lanes

Functions

int addLaneWidening(vector<laneSection> &secs, int side, double s, double ds, bool addOuterLane)

function adds a laneSection with laneWideing to a given lanesection set

Parameters:
  • secs – vector of all lanesections of a road

  • side – determines the road’s side of the widening

  • s – position of lane widening

  • ds – length of lane widening

  • addouterLane – specifies if additional lane is on the outer side or not

Returns:

int error code

int addLaneDrop(vector<laneSection> &secs, int side, double s, double ds)

function adds a laneSection with laneDrop to a given lanesection set

Parameters:
  • secs – vector of all lanesections of a road

  • side – determines the road’s side of the drop

  • s – position of laneDrop

  • ds – length of laneDrop

Returns:

int error code

int addRestrictedAreaWidening(vector<laneSection> &secs, int side, double s, double ds1, double ds2)

function adds a laneSection with restricted area after a lane widening

Parameters:
  • secs – vector of all lanesections of a road

  • side – determines the road’s side of the widening

  • s – position of lane widening

  • ds1 – length of lane widening

  • ds2 – length of restricted areay (always lager than ds1)

Returns:

int error code

int addRestrictedAreaDrop(vector<laneSection> &secs, int side, double s, double ds1, double ds2)

function adds a laneSection with restricted area after a lane drop

Parameters:
  • secs – vector of all lanesections of a road

  • side – determines the road’s side of the drop

  • s – position of lane drop

  • ds1 – length of lane drop

  • ds2 – length of restricted areay (always lager than ds1)

Returns:

int error code

int laneWideningJunction(road &r, double s, double ds, int turn, bool verschwenkung, bool restricted)

function creates laneWidenings in junction areas (in opposite s direction), for additional turning lanes

Parameters:
  • r – road data

  • s – start of widening

  • ds – length of widening

  • turn – 1 = left lane turn, -1 = right lane turn

  • verschwenkung – determines if a ‘verschwenkung’ exists

  • restricted – determines if widening is a restricted area

Returns:

int error code

1.2.11. addObjects.h

file contains methodology for object creation

Functions

int addTrafficIsland(object o, road &r)

function adds a traffic island to the lane structure

Parameters:
  • o – object data

  • r – road data

Returns:

int error code

int addRoadWork(object o, road &r, int laneId)

function generates a roadwork

Parameters:
  • o – object containing length and position of roadwork

  • r – road which contains the roadwork

  • laneId – lane which contains the roadwork

Returns:

int error code

int addParking(object o, road &r)

function adds parking splot objects

Parameters:
  • o – object data

  • r – road data

Returns:

int error code

int addBusStop(object o, road &r)

function adds a bus top

Parameters:
  • o – objct data

  • r – road data

Returns:

int error code

int getPosition(DOMElement *node, object &o)

function gets the object position

Parameters:
  • node – object input data

  • o – object data

Returns:

int error code

int addObjects(DOMElement *inRoad, road &r, roadNetwork &data)

function creates objects

Parameters:
  • inRoad – road input data from input file

  • r – road data

  • dataroadNetwork structure where the generated roads and junctions are stored

Returns:

int error code

int addSignal(road &r, roadNetwork &data, double s, double t, string type, string subtype, int controller)

function creates a signal which is automatically generated

Parameters:
  • r – road which contains the signal

  • dataroadNetwork data, which holds the controls

  • s – s position of signal

  • t – t position of signal

  • type – type of signal

  • subtype – subtype of signal

  • controller – controllerof signal

Returns:

int error code

1.3. XML parsing

1.3.1. xmlParser.h

This file contains functions to parse xml code.

Road-Generation

Copyright (c) 2021 Institut für Kraftfahrzeuge, RWTH Aachen, ika Report bugs and download new versions https://github.com/ika-rwth-aachen/RoadGeneration

This library is distributed under the MIT License.

Author

Jannik Busse Contact: jannik.busse@rwth-aachen.de, christian.geller@rwth-aachen.de

Defines

X(str)

Functions

string readNameFromNode(const DOMElement *node)
string readStrAttrFromNode(const DOMElement *node, const char *attribute, bool suppressOutput = false)

reads an attribute from a xercesC node without causing memory leak. use this method for reading attributes!!!

Parameters:
  • node – the node to read the attribute from

  • attribute – attribute to read

  • suppressOutput – suppress output if the attribute is not found.

Returns:

string returns a string value. Returns an empty string if no attribute with the given name is found.

int readIntAttrFromNode(const DOMElement *node, const char *attribute, bool suppress = false)
double readDoubleAttrFromNode(const DOMElement *node, const char *attribute)
bool readBoolAttrFromNode(const DOMElement *node, const char *attribute)
bool attributeExits(const DOMElement *node, const char *attribute)
DOMElement *getNextSiblingWithTagName(DOMElement *elem, const char *tag)

Get the Next Sibling with the specified tag name. Return NULL if nothing is found.

Parameters:
  • elem – element which to find the sibling of

  • tag – name of the desired sibling

Returns:

DOMElement* sibling if found. NULL otherwise

DOMElement *getChildWithName(const DOMElement *node, const char *childName)

looks for the first node that with matching name in the xml document

Parameters:
  • childName – name too look for

  • res – return Element

Returns:

first child element with name. NULL if nothing is found

DOMElement *getFirstChildFromNode(const DOMElement *node)

Get the First Child object.

Parameters:

node – of the parent object

Returns:

DOMElement* first child of parent object in the xml tree

string readAttributeFromChildren(DOMElement *node, const char *firstchild, const char *attr)

Reads the attribute from a child of a node. Use with caution: if multiple child nodes with the name exist, only the first one will be read.

Parameters:
  • node – the node whose childs should be read

  • firstchild – name of the first child

  • attr – name of the attribute

Returns:

string value of the attribute

string readAttributeFromChildren(DOMElement *node, const char *firstchild, const char *secondchild, const char *attr)

Reads the attribute from a child of a child of a node. Use with caution: if multiple child nodes with the name exist, only the first one will be read.

Parameters:
  • node – the node whose childs should be read

  • firstchild – name of the first child

  • firstchild – name of the child of the first child

  • attr – name of the attribute

Returns:

string value of the attribute

int generateCDATA(const char *data, DOMCDATASection **res)
int init(const char *rootNode)

initializes the dom document. needs to be called befofe using the parser

Parameters:

rootNode – name of the root node

Returns:

int error code

int serialize(const char *outname)

seriaizes the constructed xml tree

Parameters:

outname – name of the output file

Returns:

int error code

DOMElement *getRootElement()
void terminateXMLUtils()

Variables

DOMImplementation *impl
DOMDocument *doc
bool initialized = false
class ValidationErrorHandler : public ErrorHandler
#include <xmlParser.h>

very simple error hander for the xerces dom parser

Public Functions

void warning(const xercesc::SAXParseException &ex)
void error(const xercesc::SAXParseException &ex)
void fatalError(const xercesc::SAXParseException &ex)
void resetErrors()

Private Functions

void reportParseException(const xercesc::SAXParseException &ex)
class XStr
#include <xmlParser.h>

wrapper class that handles conversion from xml string to string smoothly

Public Functions

inline XStr(const char *const toTranscode)
inline XStr(const XMLCh *transcoded)
inline ~XStr()
inline operator string()
inline operator int()
inline operator double()
inline operator XMLCh*()
inline const XMLCh *unicodeForm() const

Private Members

XMLCh *fUnicodeForm
struct xmlTree
#include <xmlParser.h>

Wrapper class that stores the xml dom context.

Public Functions

inline xmlTree()
inline DOMImplementation *getDocImpl()
inline DOMElement *getRootElement()
inline DOMDocument *getDoc()
inline int parseDocument(const char *path)
inline int getErrorCount()
inline xercesc_3_2::Grammar *loadGrammar(const char *const schema_file)
inline ~xmlTree()

Private Members

XercesDOMParser *parser
DOMDocument *doc
ValidationErrorHandler *inputHandler
struct nodeElement

Public Functions

inline nodeElement(const char *value)
inline nodeElement(const char *value, nodeElement &parent)
inline ~nodeElement()
inline int createNode(const char *name)
inline int addAttribute(const char *key, const char *value)
inline int addAttribute(const char *key, string value)
inline int addAttribute(const char *key, junctionGroupType value)
inline int addAttribute(const char *key, int value)
inline int addAttribute(const char *key, float value)
inline int addAttribute(const char *key, double value)
inline int appendToNode(nodeElement &node)
inline int appendToNode(DOMElement *node)
inline int addTextNode(const char *text)

Public Members

DOMElement *domelement

1.3.2. xml.h

Functions

int validateInput(char *file, xmlTree &xmlInput)

function checks the input file against the corresponding input.xsd

Parameters:

file – input file

Returns:

int error code

int validateOutput(roadNetwork &data)

function checks the output file against the corresponding output.xsd

Parameters:

data – output data

Returns:

int error code

helper function to append the link node to road node

Parameters:
  • road – the road xml node

  • sucessor – the potential successor to the road segment

  • sucessor – the potential predecessor to the road segment *

int createXMLXercesC(roadNetwork &data)
int printLogo()

function for displaying the road generation logo

1.4. Connection

1.4.1. closeRoadConnection.h

This file contains methods for building the geometry of a new road.

Functions

int closeRoadConnection(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function generates geometries recursivly so that the two input points are connected with a feasible geometry

Parameters:
  • geo – vector which contains all output geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point

Returns:

int error code

1.4.2. closeRoadNetwork.h

This file contains methods for building the geometry of a new road.

Functions

int closeRoadConnection(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function generates geometries recursivly so that the two input points are connected with a feasible geometry

Parameters:
  • geo – vector which contains all output geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point

Returns:

int error code

1.4.3. linkSegments.h

This file contains methods for building the geometry of a new road.

Functions

int closeRoadConnection(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function generates geometries recursivly so that the two input points are connected with a feasible geometry

Parameters:
  • geo – vector which contains all output geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point

Returns:

int error code

1.5. Utils

1.5.1. curve.h

file contains curve function for calculating positions along geometries

Functions

int fresnel(double s, double &x, double &y)

function computes the fresnel integral

Parameters:
  • s – position s in a spiral

  • x – result for x component

  • y – result for y component

Returns:

int error code

int curve(double s, geometry geo, double &x, double &y, double &phi, int fd)

function computes the x, y, phi value for a given geometry at position s

Parameters:
  • s – position where x, y, phi should be computed

  • geo – geometry

  • x – start value of geometry and holds resulting value for x

  • y – start value of geometry and holds resulting value for y

  • phi – start value of geometry and holds resulting value for phi

  • fd – determines if finite differences should be used for derivative

Returns:

int error code

1.5.2. geometries.h

file contains geometry functionalities

Functions

int addLine(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function adds a line

Parameters:
  • geo – vector of all geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point (not used here)

Returns:

int error code

int addArc(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function adds an arc

Parameters:
  • geo – vector of all geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point

Returns:

int error code

int addCompositeCurve(vector<geometry> &geo, double x1, double y1, double phi1, double x2, double y2, double phi2)

function adds a composite curve

Parameters:
  • geo – vector of all geometries

  • x1 – x component of start point

  • y1 – y component of start point

  • phi1 – angle of start point

  • x2 – x component of end point

  • y2 – y component of end point

  • phi2 – angle of end point

Returns:

int error code

1.5.3. helper.h

file contains helper functionalities

Functions

int sgn(double d)

signum function

Parameters:

d – input

Returns:

int sng(d)

int fixAngle(double &a)

function fixes the input angle in the range of [-M_PI, M_PI]

Parameters:

a – angle

Returns:

int error code

int findMinLaneId(laneSection sec)

function find the minimum laneId of current lanesection

Parameters:

sec – lanesection for which the laneId should be computed

Returns:

int minimum laneId -> if not found value 100 is stored

int findMaxLaneId(laneSection sec)

function find the maximum laneId of current lanesection

Parameters:

sec – lanesection for which the laneId should be computed

Returns:

int maximum laneId -> if not found value -100 is stored

bool isBoundary(laneSection sec, int id)

function determines of given laneId is at the boundary of the current lanesection

Parameters:
  • sec – lanesection for which the boundary should be proofed

  • id – laneid for which the boundary should be proofed

Returns:

true if the lane is a boundary-lane

Returns:

false if the lane is not a boundary-lane

int findLane(laneSection sec, lane &l, int id)

function returns the lane with given id

Parameters:
  • sec – lanesection in which the lane is stored

  • l – lane which has the laneId id

  • id – laneId of the lane to find

Returns:

int position in laneSection vector

int findRoad(vector<road> roads, road &r, int id)

function returns the road with the given id

Parameters:
  • roads – road vector in which the road is stored

  • l – road which has the roadId id

  • id – roadId of the lane to find

Returns:

int position in road vector

double laneWidth(lane l, double s)

function determines lanewidth of the given lane at positon s

Parameters:
  • l – lane for which the lanewidth should be computed

  • s – position where the lanewidth should be computed

Returns:

double computed lanewidth

double findTOffset(laneSection sec, int id, double s)

function computes the tOfset of a given lane inside of a lanesection at position s

Parameters:
  • sec – lanesection for which the tOffset should be computed

  • id – laneId of the lane with the tOffset

  • s – s position of the tOffset

Returns:

double computed tOffset

int shiftLanes(laneSection &sec, int id, int dir)

function shifts all lanes in given lanesection from lane with laneId

Parameters:
  • sec – lanesection which should be shifted

  • id – lane which is the start of the shift; all outer lanes are shifted

  • dir – dir = 1 shift to outer side, die = -1 shift to inner side

Returns:

int error code

int findLeftLane(laneSection sec, int side)

function finds the id of the left turn lane

Parameters:
Returns:

int laneId of left lane

int findRightLane(laneSection sec, int side)

function finds the id of the right turn lane

Parameters:
Returns:

int laneId of right lane

int findInnerMiddleLane(laneSection sec, int side)

function finds the id of the inner middle lane (not marked)

Parameters:
Returns:

int laneId of left lane

int findOuterMiddleLane(laneSection sec, int side)

function finds the id of the outer middle lane (not marked)

Parameters:
Returns:

int laneId of left lane

int calcFromTo(road r1, road r2, int &from, int &to, int &nF, int &nT, int mode)

function calculates the possible lane connections

Parameters:
  • r1 – input from road

  • r2 – input to road

  • from – output defining from lane

  • to – output defining from lane

  • nF – amount of possible lanes from

  • nT – amount of possile lanes to

  • mode – either right-right / middle-middle / left-left

Returns:

int error code

int sortRoads(road r1, road &r2, road &r3, road &r4)

function sorts the roads r2,r3,r4 to their corresponding angle

Parameters:
  • r1 – reference road with reference angle

  • r2 – first additional road

  • r3 – second additional road

  • r4 – third additional road

Returns:

int error code

int sortRoads(road r1, road &r2, road &r3)

function sorts the roads r2,r3 to their corresponding angle

Parameters:
  • r1 – reference road with reference angle

  • r2 – first additional road

  • r3 – second additional road

Returns:

int error code

int computeIP(double x1, double y1, double phi1, double x2, double y2, double phi2, int &type, int &type1, int &type2, double &iPx, double &iPy)

function computes intersection point

Parameters:
  • x1 – x position of first point

  • y1 – y position of first point

  • phi1 – angle of first point

  • x2 – x position of second point

  • y2 – y position of second point

  • phi2 – angle of second point

  • type – type (parallel, identical, other)

  • type1 – type of first point (p,n,0)

  • type2 – type of second point (p,n,0)

  • iPx – x position of intersection point

  • iPy – y position of intersection point

Returns:

int error code

template<typename ...Args>
std::string string_format(const std::string &format, Args... args)

function used for xsd checking output

Parameters:
  • format – xsd validation file

  • args – here the project directory PROJ_DIR

Returns:

output buffer

std::string getContactPointType(contactPointType t)

function get contactpoint name

Parameters:

t – contactpoint

Returns:

string name of contactpoint

std::string getGeometryType(geometryType t)

function get geometrytype name

Parameters:

t – geometrytype

Returns:

string name of geometrytype

std::string getLinkType(linkType t)

funtion get linktype name

Parameters:

t – linkname

Returns:

string name of linkname

bool compareObjects(const object &a, const object &b)

function compares objects by id

Parameters:
  • a – object 1

  • b – object 2

Returns:

true id of object 1 is smaller than id of object 2

Returns:

false id of object 2 is smaller than id of object 1

bool compareSignals(const sign &a, const sign &b)

function compares objects by id

Parameters:
  • a – signal 1

  • b – signal 2

Returns:

true id of signal 1 is smaller than id of signal 2

Returns:

false id of signal 2 is smaller than id of signal 1

size_t getTimeStamp(char *date_time)
bool compareLanes(const lane &a, const lane &b)

function compares lanes by id

Parameters:
  • a – lane 1

  • b – lane 2

Returns:

true id of lane 1 is smaller than id of lane 2

Returns:

false id of lane 2 is smaller than id of lane 1

bool isIn(vector<int> &v, int &i)

checks if int is in vector

Parameters:
  • v – vector to check

  • i – integer

Returns:

true int is in vector

Returns:

false int is not in vector

void throwWarning(string msg, string origin, bool mute = false)
void throwWarning(string msg, bool mute = false)
void throwError(string msg, string origin)
void throwError(string msg)

1.5.4. settings.h

file contains curve function for calculating positions along geometries

Functions

int fresnel(double s, double &x, double &y)

function computes the fresnel integral

Parameters:
  • s – position s in a spiral

  • x – result for x component

  • y – result for y component

Returns:

int error code

int curve(double s, geometry geo, double &x, double &y, double &phi, int fd)

function computes the x, y, phi value for a given geometry at position s

Parameters:
  • s – position where x, y, phi should be computed

  • geo – geometry

  • x – start value of geometry and holds resulting value for x

  • y – start value of geometry and holds resulting value for y

  • phi – start value of geometry and holds resulting value for phi

  • fd – determines if finite differences should be used for derivative

Returns:

int error code

1.6. Library files

1.6.1. export.h

This file contains the most important functions for using the road generation library.

Functions

EXPORTED void setFileName (char *file)

Sets the filename of the input file.

Parameters:

file – file name *

EXPORTED void setXMLSchemaLocation (char *file)

set path to xml schema files

Parameters:

file – set path

EXPORTED void setLogFile (char *file)

set log file location

Parameters:

file – set file location

EXPORTED int execPipeline ()

execute the pippeline on fileName that is stored in settings

EXPORTED int executePipeline (char *file)

execute the pipeline on given fileName

Parameters:

file – filename to run the pipeline on

EXPORTED void setOutputName (char *file)

set the output file name

Parameters:

file – output file

EXPORTED void setSilentMode (bool sMode)

sets the silent mode. Silent mode disables most console output

Parameters:

sMode – sets silent mode to True or False

EXPORTED void setOverwriteLog (bool b)

set overwriting the error log to ture or false

Parameters:

b – true if errorlog should be overwritten