def get_bottom_face(arg):
    ground_atom_value = arg

    if type(arg) is Face:
        ground_atom_value = arg.value

    return GroundAtom(__BOTTOM_FACE__, [ground_atom_value])
def get_facing_robot_face(arg):
    ground_atom_value = arg

    if type(arg) is Face:
        ground_atom_value = arg.value

    return GroundAtom(__FACING_ROBOT_FACE__, [ground_atom_value])
Esempio n. 3
0
def transform_grasping_type_data_point_into_mln_database(data_point):
    word_net_concept = cram2wordnet.map_cram_object_type_to_word_net_instance(
        data_point['object_type'])

    grasp_type_ground_atom = GroundAtom(__GRASP_TYPE__, [data_point['grasp']],
                                        float(data_point['success']))
    object_to_be_grasped_ground_atom = GroundAtom(__OBJ_TO_BE_GRASPED__,
                                                  [word_net_concept])
    is_ground_atom = get_is_a_ground_atom(word_net_concept, word_net_concept)
    facing_robot_face_ground_atom = GroundAtom(
        __FACING_ROBOT_FACE__, [data_point['facing_robot_face']])
    bottom_face_ground_atom = GroundAtom(__BOTTOM_FACE__,
                                         [data_point['bottom_face']])

    train_database_file_content = \
        [transform_ground_atom_to_text(grasp_type_ground_atom),
         transform_ground_atom_to_text(object_to_be_grasped_ground_atom),
         transform_ground_atom_to_text(is_ground_atom),
         transform_ground_atom_to_text(facing_robot_face_ground_atom),
         transform_ground_atom_to_text(bottom_face_ground_atom)]

    return '\n'.join(train_database_file_content)
def get_grasp_type(arg):
    return GroundAtom(__GRASP_TYPE__, [arg])
def get_is_rotationally_symmetric(arg):
    return GroundAtom(__IS_ROTATIONALLY_SYMMETRIC__, [arg])
def get_obj_to_be_grasped(arg):
    return GroundAtom(__OBJ_TO_BE_GRASPED__, [arg])
Esempio n. 7
0
def get_is_a_ground_atom(a, b):
    similarity = determine_path_similarity_between_two_concepts(a, b)

    return GroundAtom(__IS_A__, [a, b], similarity)
from high_level_markov_logic_network.ground_atom import GroundAtom

TEST_GROUND_ATOM_1 = 'test(test1)'
TEST_GROUND_ATOM_2 = 'test(test1,test2)'

one_instance_ground_atom_1 = GroundAtom('test', ['test1'])
one_instance_ground_atom_2 = GroundAtom('test', ['test2'])
one_instance_ground_atom_3 = GroundAtom('test', ['test1'], 0.0)

two_instances_ground_atom_1 = GroundAtom('test', ['test1', 'test2'])
two_instances_ground_atom_2 = GroundAtom('test', ['test1', 'test2'])


def test_should_return_str_representation_of_one_instance_ground_atom():
    assert str(one_instance_ground_atom_1) == TEST_GROUND_ATOM_1


def test_should_return_str_representation_of_two_instances_ground_atom():
    assert str(two_instances_ground_atom_1) == TEST_GROUND_ATOM_2


def test_should_return_true_if_ground_atoms_represents_the_same_fact():
    assert two_instances_ground_atom_1 == two_instances_ground_atom_2


def test_should_return_false_if_ground_atoms_have_different_truth_value():
    assert not one_instance_ground_atom_1 == one_instance_ground_atom_3


def test_should_return_false_if_ground_atoms_have_different_instance_values():
    assert not one_instance_ground_atom_1 == one_instance_ground_atom_2