<reponame>darkrush/NICS_MultiRobot_Platform<filename>src/robot_client/scripts/mac2id.py
import uuid
import os
def get_mac_address(): 
    mac=uuid.UUID(int = uuid.getnode()).hex[-12:] 
    return ":".join([mac[e:e+2] for e in range(0,11,2)])

def mac2id(mac):
    mac2id_table = {'e4:5f:01:00:d4:20':'1',
                    'e4:5f:01:00:d3:d8':'2',
                    'e4:5f:01:00:d4:5c':'3',
                    'e4:5f:01:00:d3:ae':'4'}
    assert mac in mac2id_table.keys()
    return mac2id_table[mac]

def export_id(id,prefix='car_'):
    os.system('export CAR_ID='+prefix+id)

if __name__ == '__main__':
    export_id(mac2id(get_mac_address), prefix='car_')