Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
YuqianJiang committed Nov 19, 2024
1 parent 69bde97 commit a1be45a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/show_me
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def about_id(entity_id, show_attributes=True):
print("Belongs to map {} (\'{}\')".format(parent_map.entity_id, parent_map.get_name()))

if inside_regions:
print("Inside regions {}".format(str(list(map(Region.name, inside_regions)))))
print("Inside regions {}".format(str(list(map(Region.get_name, inside_regions)))))

if not typed:
print("Entity {} does not exist".format(entity_id))
Expand Down
4 changes: 4 additions & 0 deletions sql/schema_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ VALUES ('answer_to', 'id'),
('has', 'id'),
('height', 'float'),
('width', 'float'),
('depth', 'float'),
('weight', 'float'),
('is_a', 'id'),
('is_connected', 'id'),
('is_delivered', 'id'),
Expand Down Expand Up @@ -493,6 +495,8 @@ INSERT INTO concepts
VALUES (2, 'robot'), (3, 'map'), (4, 'point'), (5, 'pose'), (6, 'region'), (7, 'door');
INSERT INTO instance_of
VALUES (1, 'robot');
INSERT INTO entity_attributes_str
VALUES (1, 'name', 'robot');

/* Manual inserts will mess up the SERIAL sequence, so we have to manually bump the number*/
SELECT setval('entities_entity_id_seq', max(entity_id))
Expand Down
6 changes: 4 additions & 2 deletions src/knowledge_representation/knowledge_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ def add_attributes(entity, attributes):
for attribute in attributes:
name = attribute["name"]
value = attribute["value"]
entity.add_attribute(name, value)

if isinstance(value, bool):
entity.add_bool_attribute(name, value)
else:
entity.add_attribute(name, value)

def add_instance_of(ltmc, instance, concept_names):
for concept_name in concept_names:
Expand Down
7 changes: 4 additions & 3 deletions src/knowledge_representation/map_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def dim_match(element, w, h):
if viewbox != target_viewbox:
problems.append("SVG viewbox is {} but should be {}".format(viewbox, target_viewbox))
dim_match(svg, map_info["width"], map_info["height"])
ori_is_zero(image)
dim_match(image, map_info["width"], map_info["height"])
# ori_is_zero(image)
# dim_match(image, map_info["width"], map_info["height"])
return problems


Expand Down Expand Up @@ -338,6 +338,7 @@ def process_paths(path_groups):
name = text

transform = get_transform(group)
# sprint (transform)

# Single line segment path => pose
try:
Expand All @@ -359,7 +360,7 @@ def process_paths(path_groups):
points = map(lambda l: l[0], lines)
points = map(lambda p: (float_s3(p[0]), float_s3(p[1])), points)
points = map(lambda p: apply_transform(p, transform), points)
regions.append((name, points))
regions.append((name, list(points)))
else:
warn("Encountered path that couldn't be parsed {}".format(name))
return poses, regions
Expand Down
2 changes: 1 addition & 1 deletion src/libknowledge_rep/python_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ BOOST_PYTHON_MODULE(_libknowledge_rep_wrapper_cpp)
.def<bool (Entity::*)(const string&, const Entity&)>("add_attribute", &Entity::addAttribute)
.def<bool (Entity::*)(const string&, uint)>("add_attribute", &Entity::addAttribute)
.def<bool (Entity::*)(const string&, int)>("add_attribute", &Entity::addAttribute)
.def<bool (Entity::*)(const string&, bool)>("add_attribute", &Entity::addAttribute)
.def<bool (Entity::*)(const string&, bool)>("add_bool_attribute", &Entity::addAttribute)
.def<bool (Entity::*)(const string&, double)>("add_attribute", &Entity::addAttribute)

.def<bool (Entity::*)(const string&, const string&)>("add_attribute", &Entity::addAttribute)
Expand Down

0 comments on commit a1be45a

Please sign in to comment.