import pickle

def audio_condition():
    # natural versus narration
    narration_users = ['user2', 'user4', 'user7', 'user8', 'user10','user14','user16','user18','user20']
    natural_users = ['user3','user5','user6','user9','user11','user12','user15','user17','user19']

    filename = '../data/narration_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(narration_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/natural_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(natural_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def expertise():
    expert_users = ['user2', 'user3', 'user4','user5','user8','user16']
    novice_users = ['user6', 'user7', 'user9', 'user10', 'user11', 'user12', 'user14','user15','user17','user18','user19','user20']

    filename = '../data/expert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(expert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/novice_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(novice_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def gender():
    male_users = ['user6','user8','user9','user10','user11','user16','user18']
    female_users = ['user2', 'user3', 'user4', 'user5', 'user7','user12','user13','user14','user15','user17','user19','user20']

    filename = '../data/male_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(male_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/female_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(female_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def task_complexity():
    box_harder = ['user3','user10','user17','user19','user20']
    cutting_harder = ['user2','user4','user5','user6','user7','user8','user9','user11','user12','user14','user15',\
                    'user16','user18']


    filename = '../data/box_harder.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(box_harder, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/cutting_harder.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(cutting_harder, handle, protocol=pickle.HIGHEST_PROTOCOL)

def personality():
    extrovert_users = ['user5','user10','user16']
    introvert_users = ['user2','user3','user4','user6','user7','user8','user9','user11','user12','user14','user15',\
                    'user17','user18','user19','user20']

    filename = '../data/extrovert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(extrovert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/introvert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(introvert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def box_manipulation_segments():
    '''
        0:'Move arm towards the lid on the closed box', 
        1:'Click button to open the lid of the box',
        2:'Grasp button on the lid of the box', 
        3:'Transport the lid from the box towards table',
        4:'Release the button of the lid on the table from the gripper',
        5:'Move arm towards the green object that\'s inside the box',
        6:'Grasp the green object',
        7:'Transport the green object from inside the box towards the table',
        8:'Release the green object from gripper',
        9:'Move arm towards the lid on the table',
        10:'Grasp the button of the lid placed on the table',
        11:'Transport the lid from the table towards the box\'s body',
        12:'Release the button of the lid on top of the box from the gripper',
        13:'Push the button to lock lid',
        14:'Move arm towards green object',
        15:'Grasp green object on the table',
        16:'Transport the green object towards lid button',
        17:'Release the green object on top of the lid from gripper'
    '''
    precise = [1,2,6,10,13,15]
    not_precise = [0,3,4,5,7,8,9,11,12,14,16,17]

    filename = '../data/box_precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(precise, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/box_not-precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(not_precise, handle, protocol=pickle.HIGHEST_PROTOCOL)


def cutting_manipulation_segments():
    '''
        0:'Move arm towards the knife', 
        1:'Grasp the knife',
        2:'Move the knife out from knife holder',
        3:'Transport knife from the knife holder towards the banana', 
        4:'Cut the first piece of the banana',
        5:'Cut the second piece of the banana',
        6:'Transport knife back from the cutting board to the knife holder',
        7:'Placing the knife back in knife holder',
        8:'Release the knife from the gripper'
    '''
    precise = [1,2,4,5,7]
    not_precise = [0,3,6,8]

    filename = '../data/cutting_precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(precise, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/cutting_not-precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(not_precise, handle, protocol=pickle.HIGHEST_PROTOCOL)


def mistake_sounds():
    cutting_mistake_sounds={
        'forgot_step': [],
        'struggle_arm': ['robot'],
        'struggle_gripper': ['robot'],
        'wrong_sequence': [],
        'restrategize_cutting': ['robot'],
        'restrategize_grasping': ['robot','object'],
        'collide': ['robot', 'object'],
        'less_force': ['robot'],
        'two_hands': [],
        'dropped_object': ['object'],
        'human_hand': [],
        'other_wrong': []
    }

    box_mistake_sounds={
        'forgot_step': [],
        'struggle_arm': ['robot'],
        'struggle_gripper': ['robot'],
        'wrong_sequence': [],
        'restrategize': ['robot','object'],
        'collide': ['robot', 'object'],
        'two_hands': [],
        'dropped_object': ['object'],
        'human_hand': [],
        'other_wrong': []
    }

    filename = '../data/cutting_mistake_sounds.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(cutting_mistake_sounds, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/box_mistake_sounds.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(box_mistake_sounds, handle, protocol=pickle.HIGHEST_PROTOCOL)



def main():
    audio_condition()
    expertise()
    personality()
    gender()
    task_complexity()
    box_manipulation_segments()
    cutting_manipulation_segments()
    mistake_sounds()
    

if __name__ == "__main__":  
    main()
import pickle

def audio_condition():
    # natural versus narration
    narration_users = ['user2', 'user4', 'user7', 'user8', 'user10','user14','user16','user18','user20']
    natural_users = ['user3','user5','user6','user9','user11','user12','user15','user17','user19']

    filename = '../data/narration_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(narration_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/natural_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(natural_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def expertise():
    expert_users = ['user2', 'user3', 'user4','user5','user8','user16']
    novice_users = ['user6', 'user7', 'user9', 'user10', 'user11', 'user12', 'user14','user15','user17','user18','user19','user20']

    filename = '../data/expert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(expert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/novice_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(novice_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def gender():
    male_users = ['user6','user8','user9','user10','user11','user16','user18']
    female_users = ['user2', 'user3', 'user4', 'user5', 'user7','user12','user13','user14','user15','user17','user19','user20']

    filename = '../data/male_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(male_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/female_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(female_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def task_complexity():
    box_harder = ['user3','user10','user17','user19','user20']
    cutting_harder = ['user2','user4','user5','user6','user7','user8','user9','user11','user12','user14','user15',\
                    'user16','user18']


    filename = '../data/box_harder.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(box_harder, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/cutting_harder.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(cutting_harder, handle, protocol=pickle.HIGHEST_PROTOCOL)

def personality():
    extrovert_users = ['user5','user10','user16']
    introvert_users = ['user2','user3','user4','user6','user7','user8','user9','user11','user12','user14','user15',\
                    'user17','user18','user19','user20']

    filename = '../data/extrovert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(extrovert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/introvert_users.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(introvert_users, handle, protocol=pickle.HIGHEST_PROTOCOL)

def box_manipulation_segments():
    '''
        0:'Move arm towards the lid on the closed box', 
        1:'Click button to open the lid of the box',
        2:'Grasp button on the lid of the box', 
        3:'Transport the lid from the box towards table',
        4:'Release the button of the lid on the table from the gripper',
        5:'Move arm towards the green object that\'s inside the box',
        6:'Grasp the green object',
        7:'Transport the green object from inside the box towards the table',
        8:'Release the green object from gripper',
        9:'Move arm towards the lid on the table',
        10:'Grasp the button of the lid placed on the table',
        11:'Transport the lid from the table towards the box\'s body',
        12:'Release the button of the lid on top of the box from the gripper',
        13:'Push the button to lock lid',
        14:'Move arm towards green object',
        15:'Grasp green object on the table',
        16:'Transport the green object towards lid button',
        17:'Release the green object on top of the lid from gripper'
    '''
    precise = [1,2,6,10,13,15]
    not_precise = [0,3,4,5,7,8,9,11,12,14,16,17]

    filename = '../data/box_precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(precise, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/box_not-precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(not_precise, handle, protocol=pickle.HIGHEST_PROTOCOL)


def cutting_manipulation_segments():
    '''
        0:'Move arm towards the knife', 
        1:'Grasp the knife',
        2:'Move the knife out from knife holder',
        3:'Transport knife from the knife holder towards the banana', 
        4:'Cut the first piece of the banana',
        5:'Cut the second piece of the banana',
        6:'Transport knife back from the cutting board to the knife holder',
        7:'Placing the knife back in knife holder',
        8:'Release the knife from the gripper'
    '''
    precise = [1,2,4,5,7]
    not_precise = [0,3,6,8]

    filename = '../data/cutting_precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(precise, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/cutting_not-precise.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(not_precise, handle, protocol=pickle.HIGHEST_PROTOCOL)


def mistake_sounds():
    cutting_mistake_sounds={
        'forgot_step': [],
        'struggle_arm': ['robot'],
        'struggle_gripper': ['robot'],
        'wrong_sequence': [],
        'restrategize_cutting': ['robot'],
        'restrategize_grasping': ['robot','object'],
        'collide': ['robot', 'object'],
        'less_force': ['robot'],
        'two_hands': [],
        'dropped_object': ['object'],
        'human_hand': [],
        'other_wrong': []
    }

    box_mistake_sounds={
        'forgot_step': [],
        'struggle_arm': ['robot'],
        'struggle_gripper': ['robot'],
        'wrong_sequence': [],
        'restrategize': ['robot','object'],
        'collide': ['robot', 'object'],
        'two_hands': [],
        'dropped_object': ['object'],
        'human_hand': [],
        'other_wrong': []
    }

    filename = '../data/cutting_mistake_sounds.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(cutting_mistake_sounds, handle, protocol=pickle.HIGHEST_PROTOCOL)
        
    filename = '../data/box_mistake_sounds.pkl'
    with open(filename, 'wb') as handle:
        pickle.dump(box_mistake_sounds, handle, protocol=pickle.HIGHEST_PROTOCOL)



def main():
    audio_condition()
    expertise()
    personality()
    gender()
    task_complexity()
    box_manipulation_segments()
    cutting_manipulation_segments()
    mistake_sounds()
    

if __name__ == "__main__":  
    main()
# natural versus narration 0:'Move arm towards the lid on the closed box',          1:'Click button to open the lid of the box',         2:'Grasp button on the lid of the box',          3:'Transport the lid from the box towards table',         4:'Release the button of the lid on the table from the gripper',         5:'Move arm towards the green object that\'s inside the box',         6:'Grasp the green object',         7:'Transport the green object from inside the box towards the table',         8:'Release the green object from gripper',         9:'Move arm towards the lid on the table',         10:'Grasp the button of the lid placed on the table',         11:'Transport the lid from the table towards the box\'s body',         12:'Release the button of the lid on top of the box from the gripper',         13:'Push the button to lock lid',         14:'Move arm towards green object',         15:'Grasp green object on the table',         16:'Transport the green object towards lid button',         17:'Release the green object on top of the lid from gripper' 0:'Move arm towards the knife',          1:'Grasp the knife',         2:'Move the knife out from knife holder',         3:'Transport knife from the knife holder towards the banana',          4:'Cut the first piece of the banana',         5:'Cut the second piece of the banana',         6:'Transport knife back from the cutting board to the knife holder',         7:'Placing the knife back in knife holder',         8:'Release the knife from the gripper'