def __init__(self): print "Initialized new supervisor" self.time_limit = 3 self.state_machine = msm.motion_state_machine() self.bumper = bump.Bumper((0.161, 0, 0)) self.start_time = time.time() self.vac=vacuum() self.hand = HandHandler() self.handler=jsonHandler() (self.origMap,self.workOrder)=self.handler.readInFile("RandomTestB.json") self.items_to_stow = len(self.workOrder[0]) ##Load bin Selector self.binSelect=binSelector() ##Initialize bin Selector self.binSelect.initialize("RandomTestB.json")
def __init__(self,filename=None): self.counter = 0 self.parser=json_parser_stow.json_parser_stow() self.binSelector=binSelector(); self.binSelector.initialize(filename) self.bin=[None]*24 self.scale = None self.scale=scale.Scale_Measurement() self.currentWeight=float(self.scale.readData(10).split(' ')[0]) print 'Initial Reading', self.currentWeight # self.currentWeight = self.currentWeight.split(' ')[0] print 'Numeric Reading', self.currentWeight if filename is not None: (self.binContents, self.toteContents)=self.parser.readInFile(filename) print self.toteContents # self.weightClass=[["oral_b_toothbrush_green", "oral_b_toothbrush_red","expo_dry_erase_board_eraser","expo_dry_erase_board_eraser","scotch_bubble_mailer","scotch_bubble_mailer"], # ["fiskars_scissors_red"], # ["cloud_b_plush_bear","womens_knit_gloves"], # ["safety_first_outlet_plugs","platinum_pets_dog_bowl"], # ["kyjen_squeakin_eggs_plush_puppies"], # ["cherokee_easy_tee_shirt"], # ["cool_shot_glue_sticks"], # ["dr_browns_bottle_brush","soft_white_lightbulb"], # ["ticonderoga_12_pencils","barkely_hide_bones","laugh_out_loud_joke_book","command_hooks","jane_eyre_dvd"], # ["rolodex_jumbo_pencil_cup","creativity_chenille_stems","creativity_chenille_stems"], # ["i_am_a_bunny_book"], # ["dove_beauty_bar"], # ["staples_index_cards","staples_index_cards"], # ["crayola_24_ct"], # ["easter_turtle_sippy_cup","woods_extension_cord"], # ["rawlings_baseball","clorox_utility_brush","elmers_washable_no_run_school_glue","elmers_washable_no_run_school_glue","scotch_duct_tape","scotch_duct_tape"], # ["kleenex_tissue_box"], # ["peva_shower_curtain_liner"], # ["up_glucose_bottle"], # ["kleenex_paper_towels"], # ["folgers_classic_roast_coffee"], # ["hanes_tube_socks"], # ["dasani_water_bottle","dasani_water_bottle"], # ["fitness_gear_3lb_dumbbell"]] self.weightClass=[["expo_dry_erase_board_eraser","oral_b_toothbrush_green", "oral_b_toothbrush_red","scotch_bubble_mailer"], ["fiskars_scissors_red"], ["cloud_b_plush_bear","womens_knit_gloves"], ["safety_first_outlet_plugs","platinum_pets_dog_bowl"], ["kyjen_squeakin_eggs_plush_puppies"], ["cherokee_easy_tee_shirt"], ["cool_shot_glue_sticks"], ["dr_browns_bottle_brush","soft_white_lightbulb"], ["barkely_hide_bones","command_hooks","jane_eyre_dvd","ticonderoga_12_pencils","laugh_out_loud_joke_book"], ["rolodex_jumbo_pencil_cup","creativity_chenille_stems"], ["i_am_a_bunny_book"], ["dove_beauty_bar"], ["staples_index_cards"], ["crayola_24_ct"], ["easter_turtle_sippy_cup","woods_extension_cord"], ["clorox_utility_brush","rawlings_baseball","elmers_washable_no_run_school_glue","scotch_duct_tape"], ["kleenex_tissue_box"], ["peva_shower_curtain_liner"], ["up_glucose_bottle"], ["kleenex_paper_towels"], ["folgers_classic_roast_coffee"], ["hanes_tube_socks"], ["dasani_water_bottle"], ["fitness_gear_3lb_dumbbell"]] self.overlap = [filter(lambda x: x in sublist, self.toteContents) for sublist in self.weightClass] print self.overlap