def get_best_solution_for_config_id(self, T06, config_id):
    solution = self.compute_joint_angles(T06)
    if self.is_valid_solution_by_config_id(solution, config_id):
        return self.get_solution_for_config_id(solution, config_id)
    else:
        index = (config_id + 1)
        checked_all = False
        while (not checked_all):
            if (index >= 8):
                index = 0
            if (index == config_id):
                print('Found no valid solutions..')
                return None
            if self.is_valid_solution_by_config_id(solution, index):
                return self.get_solution_for_config_id(solution, index)
            index += 1
def get_best_solution_for_config_id(self, T06, config_id):
    solution = self.compute_joint_angles(T06)
    if self.is_valid_solution_by_config_id(solution, config_id):
        return self.get_solution_for_config_id(solution, config_id)
    else:
        index = (config_id + 1)
        checked_all = False
        while (not checked_all):
            if (index >= 8):
                index = 0
            if (index == config_id):
                print('Found no valid solutions..')
                return None
            if self.is_valid_solution_by_config_id(solution, index):
                return self.get_solution_for_config_id(solution, index)
            index += 1