Exemplo n.º 1
0
    def setUp(self):
        '''Build an sdf file from a known set of data'''
        osmDict = {}
        osmDict = getOsmFile([-75.93, 40.61, -75.90, 40.62], 'map.osm')
        osmRoads = Osm2Dict(-75.93, 40.61, osmDict)
        (roadPointWidthMap,
         modelPoseMap,
         buildingLocationMap) = osmRoads.getMapDetails()

        #Initialize the getSdf class
        sdfFile = GetSDF()

        #Set up the spherical coordinates
        sdfFile.addSphericalCoords(osmRoads.getLat(), osmRoads.getLon())

        #add Required models
        sdfFile.includeModel("sun")

        for model in modelPoseMap.keys():
            points = modelPoseMap[model]['points']
            sdfFile.addModel(modelPoseMap[model]['mainModel'],
                             model,
                             [points[0, 0], points[1, 0], points[2, 0]])

        for building in buildingLocationMap.keys():
            sdfFile.addBuilding(buildingLocationMap[building]['mean'],
                                buildingLocationMap[building]['points'],
                                building,
                                buildingLocationMap[building]['color'])

        #Include the roads in the map in sdf file
        for road in roadPointWidthMap.keys():
            sdfFile.addRoad(road)
            sdfFile.setRoadWidth(roadPointWidthMap[road]['width'], road)
            points = roadPointWidthMap[road]['points']
            for point in range(len(points[0, :])):
                sdfFile.addRoadPoint([points[0, point],
                                      points[1, point],
                                      points[2, point]],
                                     road)
        #output sdf File
        sdfFile.writeToFile('outFile.sdf')
Exemplo n.º 2
0
    def setUp(self):
        '''Build an sdf file from a known set of data'''
        osmDict = {}
        osmDict = getOsmFile([-75.93, 40.61, -75.90, 40.62], 'map.osm')
        osmRoads = Osm2Dict(-75.93, 40.61, osmDict)
        (roadPointWidthMap, modelPoseMap,
         buildingLocationMap) = osmRoads.getMapDetails()

        #Initialize the getSdf class
        sdfFile = GetSDF()

        #Set up the spherical coordinates
        sdfFile.addSphericalCoords([-75.93, 40.61, -75.90, 40.62])

        #add Required models
        sdfFile.includeModel("sun")

        for model in modelPoseMap.keys():
            points = modelPoseMap[model]['points']
            sdfFile.addModel(modelPoseMap[model]['mainModel'], model,
                             [points[0, 0], points[1, 0], points[2, 0]])

        for building in buildingLocationMap.keys():
            sdfFile.addBuilding(buildingLocationMap[building]['mean'],
                                buildingLocationMap[building]['points'],
                                building,
                                buildingLocationMap[building]['color'])

        #Include the roads in the map in sdf file
        for road in roadPointWidthMap.keys():
            sdfFile.addRoad(road)
            sdfFile.setRoadWidth(roadPointWidthMap[road]['width'], road)
            points = roadPointWidthMap[road]['points']
            for point in range(len(points[0, :])):
                sdfFile.addRoadPoint(
                    [points[0, point], points[1, point], points[2, point]],
                    road)
        #output sdf File
        sdfFile.writeToFile('outFile.sdf')
Exemplo n.º 3
0
                    osmDictionary, flags)

print ('| Extracting the map data for gazebo ...')
#get Road and model details
#roadPointWidthMap, modelPoseMap, buildingLocationMap = osmRoads.getMapDetails()
roadPointWidthMap = osmRoads.getRoadDetails()
print ('| Building sdf file ...')
#Initialize the getSdf class
sdfFile = GetSDF()


#Set up the spherical coordinates
sdfFile.addSphericalCoords(osmRoads.getLat(), osmRoads.getLon())

#add Required models
sdfFile.includeModel("sun")
# for model in modelPoseMap.keys():
#     points = modelPoseMap[model]['points']
#     sdfFile.addModel(modelPoseMap[model]['mainModel'],
#                      model,
#                      [points[0, 0], points[1, 0], points[2, 0]])

# for building in buildingLocationMap.keys():
#     sdfFile.addBuilding(buildingLocationMap[building]['mean'],
#                         buildingLocationMap[building]['points'],
#                         building,
#                         buildingLocationMap[building]['color'])
print ('|')
print ('|-----------------------------------')
print ('| Number of Roads: ' + str(len(roadPointWidthMap.keys())))
print ('|-----------------------------------')
Exemplo n.º 4
0
                    osmDictionary, flags)

print ('| Extracting the map data for gazebo ...')
#get Road and model details
#roadPointWidthMap, modelPoseMap, buildingLocationMap = osmRoads.getMapDetails()
roadPointWidthMap = osmRoads.getRoadDetails()
print ('| Building sdf file ...')
#Initialize the getSdf class
sdfFile = GetSDF()


#Set up the spherical coordinates
sdfFile.addSphericalCoords(osmRoads.getLat(), osmRoads.getLon())

#add Required models
sdfFile.includeModel("sun")
# for model in modelPoseMap.keys():
#     points = modelPoseMap[model]['points']
#     sdfFile.addModel(modelPoseMap[model]['mainModel'],
#                      model,
#                      [points[0, 0], points[1, 0], points[2, 0]])

# for building in buildingLocationMap.keys():
#     sdfFile.addBuilding(buildingLocationMap[building]['mean'],
#                         buildingLocationMap[building]['points'],
#                         building,
#                         buildingLocationMap[building]['color'])
print ('|')
print ('|-----------------------------------')
print ('| Number of Roads: ' + str(len(roadPointWidthMap.keys())))
print ('|-----------------------------------')