Exemple #1
0
def set_vehicle_status_demo():
    vehicles = g["Vehicles"]
    target_veh_key = ''

    target_veh_name = 'Veh_1_1'  #vehicle observableName in UI

    #vehicle status data
    dic = {
        'left_light': '3',
        'right_light': '4,5,6,7,10,11',
        'emergency_brake': 0,
        'high_beam': 0,
        'dipped_headlight': 0,
        'trouble_light': 0,
        'foglight': 0,
        'automatic_lamp': 0,
        'parking_lamp': 0,
        'day_driving_lights': 0,
        'ABS': 1,
        'TCS': 0,
        'ESP': 0,
        'OTHER': 0,
        'fire-engine': 0,
        'ambulance': 0,
        'police_wagon': 0
    }

    for key in vehicles:
        if vehicles[key].ObservableName == target_veh_name:
            target_veh_key = key

    vehicle_cache = PyPanoDataIO().get_grid().GetOrCreateCache[str, str](
        "PanoDataModel.VehicleStatus")
    vehicle_cache.Put(target_veh_key, json.dumps(dic))
    print('set success : %s' % json.dumps(dic))
Exemple #2
0
def start():
    global g_db, g_grid, vehicle_cache, sim_time,host_id
    #host_id = '65ff4a6f-e423-428f-b9f1-c5e17da2fbba'
    g_db = PyPanoDataIO()
    g_grid = g_db.get_grid()
    sim_time = 0.0
    vehicle_cache = g_grid.GetOrCreateCache[str, str]("PanoDataModel.VehicleStatus")
    print("in function start")
    host_id = get_veh_id(veh_name)
    #processer.start()
    print("finish function start")
Exemple #3
0
def start():
    print('------------agent starting-----------------')
    global g_db, g_grid, cache_bsm, vehicle_cache, sim_time,host_id
    host_id = get_veh_id(veh_name)
    #host_id = '65ff4a6f-e423-428f-b9f1-c5e17da2fbba'
    g_db = PyPanoDataIO()
    g_grid = g_db.get_grid()
    sim_time = 0.0

    cache_bsm = g_grid.GetOrCreateCache[str, str]('PanoDataModel.Sensor.OBU.BSM.Output')
    vehicle_cache = g_grid.GetOrCreateCache[str, str]("PanoDataModel.VehicleStatus")
    print('------------agent started-----------------')