Topological Map Helper Script

Uses Service:

/state/get_battery_level

/state/get_pose

Uses helper script:

/utilities/armor_api/armor_client.py

Defines the topological map using the armor_client.py helper script methods and the ontology file topological_map.owl, which is not complete (only contatins class definitions)

class utilities.ontological_robot_control.topological_map.TopologicalMap(log_tag, init_time)[source]

Class for implemnting the topological map. When an instance is taken from this class, it loads the ontology file using armor_client loading method and tries to complete it by adding rooms, doors and robot individuals, disjointing them, predefining the last visit times and placing the robot to room “E” by calling the corresponding functions which use armor_client methods.

add_door(door)[source]

Adds door to the topological map using armor_client add individual to class method and finaly syncs the reasoner

Parameters

door (string) –

add_last_visit_time(room, visit_time)[source]

Defines the initial last visit times using armor_client add data to individual method and finally syncs the reasoner

Parameters
  • room (string) –

  • visit_time (string) –

add_robot()[source]

Places the robot in room “E” and sets its initial time instance and battery level and defines its urgency and battery threshold using armor_client add data and object to individual methods and finally syncs the reasoner

add_room(room)[source]

Adds room to the topological map using armor_client add individual to class method and finaly syncs the reasoner

Parameters

room (string) –

assign_doors_to_room(room, doors)[source]

Assigns the doors to the corresponding room using armor_client add object to individual method and finally syncs the reasoner

Parameters
  • room (string) –

  • doors[] (string) –

cut_dataprop(data_prop)[source]

Cuts the data property from a string received from armor.

Parameters

data_prop (string) –

cut_dataprop_list(data_prop_list)[source]

Cuts the data property from a list of strings received from armor.

Parameters

data_prop_list (string[]) –

cut_objprop(obj_prop)[source]

Cuts the object property from a string received from armor.

Parameters

obj_prop (string) –

cut_objprop_list(obj_prop_list)[source]

Cuts the object property from a list of strings received from armor.

Parameters

obj_prop_list (string[]) –

disjoint_individuals()[source]

Disjoints every individual in each class using armor_client disjoint individuals of class method and finally syncs the reasoner

get_battery_level()[source]

Retrieve the current robot battery level by the state/battery_level server of the robot-state node.

Returns

battery_level(int)

get_location()[source]

Detects robot current position using get_pose() function and then checks in which room it is, considering the assignment_world.world file.

Returns

is_in(string)

get_pose()[source]

Retrieve the current robot pose by the state/get_pose server of the robot-state node.

Returns

pose(Point)

update_ontology(now)[source]

The function which is called in finite_state_machine node, it gets current time instance as an argument, it gets robot current location using get_location() function, it gets robot current battery level using get_battery_level() function, and updates them in the ontology. It sorts the last visit times and detects which room is the most behind and sets it as the target room. It detects the urgent rooms considering the last visit times and robot urgeny threshold and updates them in the ontology, finally, it returns the target room as it is found.If the battery level is high enough otherwise it returns room “E” as target room, and battery level state.

Parameters

now (float32) –

Returns

target_room(string) battery_low(bool)