Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
RouteCreation_CSV2Yaml Namespace Reference

Functions

def waypointAsYAMLString (lat, lon, speedLimit)
 
def convertCSVToRouteFile (csvPath, routeFilePath, routeName)
 

Function Documentation

◆ convertCSVToRouteFile()

def RouteCreation_CSV2Yaml.convertCSVToRouteFile (   csvPath,
  routeFilePath,
  routeName 
)

Definition at line 47 of file RouteCreation_CSV2Yaml.py.

47def convertCSVToRouteFile(csvPath, routeFilePath, routeName):
48 print('Converting csv file to route file...')
49 with open(csvPath, 'rb') as csvfile: # Open csv file
50 with open(routeFilePath, 'wb') as yamlfile: # Open yaml file
51 waypoint_reader = csv.reader(csvfile, delimiter=',')
52 # Write header
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')
57 latIndex = 2
58 lonIndex = 3
59 speedLimitIndex = 4
60 firstLine = True
61 for row in waypoint_reader:
62 if (firstLine): # Find needed column index and skip header row
63 index = 0
64 for col_name in row:
65 if (col_name == 'Latitude'):
66 latIndex = index
67 elif (col_name == 'Longitude'):
68 lonIndex = index
69 elif (col_name == 'Speed'):
70 speedLimitIndex = index
71 index += 1
72 firstLine = False
73 continue
74 lat = float(row[latIndex])
75 lon = float(row[lonIndex])
76 speedLimit = int(row[speedLimitIndex])
77 # Write waypoint to file
78 yamlfile.write(waypointAsYAMLString(lat,lon,speedLimit))
79
80 print('Done converting csv file to route file')
81
82# Main execution
def waypointAsYAMLString(lat, lon, speedLimit)
def convertCSVToRouteFile(csvPath, routeFilePath, routeName)

References convertCSVToRouteFile(), and waypointAsYAMLString().

Referenced by convertCSVToRouteFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waypointAsYAMLString()

def RouteCreation_CSV2Yaml.waypointAsYAMLString (   lat,
  lon,
  speedLimit 
)

Definition at line 28 of file RouteCreation_CSV2Yaml.py.

28def waypointAsYAMLString(lat, lon, speedLimit):
29 return (
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'
34 ' altitude: 0.0\n'
35 ' minCrossTrack: -10.0\n'
36 ' maxCrossTrack: 10.0\n'
37 ' lowerSpeedLimit: 0\n'
38 ' upperSpeedLimit: ' + str(speedLimit) + '\n'
39 ' laneCount: 1\n'
40 ' interiorLaneMarkings: SOLID_WHITE\n'
41 ' leftMostLaneMarking: SOLID_YELLOW\n'
42 ' rightMostLaneMarking: SOLID_WHITE\n'
43 '\n'
44 )
45
46# Main function which converts the provided csv file to the specified route file

Referenced by convertCSVToRouteFile().

Here is the caller graph for this function: