30 ' - !gov.dot.fhwa.saxton.carma.route.RouteWaypoint\n'
31 ' location: !gov.dot.fhwa.saxton.carma.geometry.geodesic.Location\n'
32 ' latitude: ' + str(lat) +
'\n'
33 ' longitude: ' + str(lon) +
'\n'
35 ' minCrossTrack: -10.0\n'
36 ' maxCrossTrack: 10.0\n'
37 ' lowerSpeedLimit: 0\n'
38 ' upperSpeedLimit: ' + str(speedLimit) +
'\n'
40 ' interiorLaneMarkings: SOLID_WHITE\n'
41 ' leftMostLaneMarking: SOLID_YELLOW\n'
42 ' rightMostLaneMarking: SOLID_WHITE\n'
48 print(
'Converting csv file to route file...')
49 with open(csvPath,
'rb')
as csvfile:
50 with open(routeFilePath,
'wb')
as yamlfile:
51 waypoint_reader = csv.reader(csvfile, delimiter=
',')
53 yamlfile.write(
'!gov.dot.fhwa.saxton.carma.route.Route' +
'\n')
54 yamlfile.write(
'routeName: ' + routeName +
'\n')
55 yamlfile.write(
'maxJoinDistance: ' +
'40.0' +
'\n')
56 yamlfile.write(
'waypoints:\n')
61 for row
in waypoint_reader:
65 if (col_name ==
'Latitude'):
67 elif (col_name ==
'Longitude'):
69 elif (col_name ==
'Speed'):
70 speedLimitIndex = index
74 lat = float(row[latIndex])
75 lon = float(row[lonIndex])
76 speedLimit = int(row[speedLimitIndex])
80 print(
'Done converting csv file to route file')
83if __name__ ==
"__main__":
86 if (len(sys.argv) <= 3):
87 print(
'Please rerun with command line arguments <input csv file path> <output route yaml file path> <route name>')
def waypointAsYAMLString(lat, lon, speedLimit)
def convertCSVToRouteFile(csvPath, routeFilePath, routeName)