Ejemplo n.º 1
0
                # sort tuples by priority
                sorted_list = sorted(command_potential, key=lambda t: t[1])
                # get final command
                priority_command = sorted_list[0][0]
                self.message_object.message_warp(target_type,priority_command)
                self.output_message_to_topic(report_control_data)

    def find_all_index(self, array_list, item):
        return [i for i, a in enumerate(array_list) if a == item]


def find_all_index(array_list, item):
    return [i for i,a in enumerate(array_list) if a == item]

if __name__ == '__main__':
    master = Components.Master()
    AI = AI(master)

    data = [100, 5]
    msg = [0, 3, data, "A"]
    print AI.generate_command(msg)
    types = [34, 31]
    p = [1,1]

    # AI.sort_and_output_commands(data, types, p)

    kkk = ["arm_command", "wheel_command", "cloud_deck_command", "voice_command", "light_command"]
    for i in range(len(kkk)-1,0,-1):
        print kkk[i]

    index = kkk.index("arm_command")