Welcome to Description Logic & Finite State Machine Robot’s documentation!

Indices and tables

Ontology Build

This node imports the main ontology topological_map.owl file which is provided form this repo:. Adds the locations and doors and disjoints them, later it makes the robot take a cruise in each room adding the visitedAt property for each of them and also updating the robot now property. This makes it easier for the node *finitestates to replace these properties.

Furthermore, the newly built ontology is saved on a separate file to be used from the finitestates node and a message is sent to the topic mapsituation indicating that the map is built.

scripts.Ontologybuild.build_Ontology()[source]

Function for loading the Ontology, building it, visiting rooms, updating timestamps and saving the new Ontology

Parameters

void

Returns

void

scripts.Ontologybuild.findtime(list)[source]

Function for finding the time with Unix format from the return of a qureied proprity from armor.

Parameters

Time (list) – The time in the armor resonse format ex. [‘“1669241751”^^xsd:long’]

Returns

The time extarcted and changed to a string ex. “1665579740”

Return type

Time(string)

scripts.Ontologybuild.newontology = '/root/ros_ws/src/fsm_robot/Ontologies/my_map.owl'

Global Variables used to set the random sleeping time between each visit, the maxwait is set as as the urgent room threshold is 7 and there is 4 wait periods so 7/4 = 1.75 sec

Finite state Machine

This node handles the main robot behavior, first it waits for the ontology (map) to be built.

Then starting from the (move_in_corridor) state it checks if the battery is not low or there is no urgent room, it moves randomly in the two corridors and wait for some time.

However, if a battery is low it goes to the state (charging), which keeps moves the robot in room E and stayes there untill the battery is charged Also, if there is an urgent room while the battery is charged the robot visits it and stays there for some time (visitroom state).

scripts.finitestates.callbackbattery(data)[source]

Function is the callback for the topic batterylevel and sets the global varible batflag.

Parameters

state (Battery) – The data recived from the message.

Returns

void

scripts.finitestates.callbackmap(data)[source]

Function is the callback for the topic mapsituation and sets the global varible mapflag.

Parameters

state (Map) – The data recived from the message.

Returns

void

class scripts.finitestates.charging[source]

Class for state charging in which the moves to room E and stayes there untill the battery is charged.

Returns

keepcharging if the battery is still low, battfull if the batery is fully charged by other means the batflag is True.

execute(userdata)[source]

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

scripts.finitestates.findindividual(list)[source]

Function for finding the individual in a list from the return of a qureied proprity from armor.

Parameters

Individual (list) – The individual in the armor resonse format ex. [‘<http://bnc/exp-rob-lab/2022-23#R1>’]

Returns

The individual extarcted and changed to a string ex. “R1”

Return type

Individual(string)

scripts.finitestates.findtime(list)[source]

Function for finding the time with Unix format from the return of a qureied proprity from armor.

Parameters

Time (list) – The time in the armor resonse format ex. [‘“1669241751”^^xsd:long’]

Returns

The time extarcted and changed to a string ex. “1665579740”

Return type

Time(string)

scripts.finitestates.main()[source]

This function initializes the ROS node, creates the finite state machine using SMACH package:. Also it subscries to both batterylevel and mapsituation topics.

class scripts.finitestates.move_in_corridor[source]

Class for state move_in_corridor in which the robot checks if the battery is not low or there is no urgent room, it moves randomly in the two corridors and wait for some time.

Returns

keepmoving if the battery is not low and there is no urgent room, battlow if the batery is low and urgentvisit if there is an urgent room

execute(userdata)[source]

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

scripts.finitestates.moveto(newloction)[source]

Function for changing to robot isIn property according to where is robot is. First it quires the robot location if the robot was in R1 or R2 it moves it to C1 else if the robot was in R3 or R4 it moves it to C2. And from there the robot can reach the nearby urgent rooms, the E charging room or go to the other corridor. Furthermore, updates the robot now property and also the location visitedAt property.

NOTE: This function is not generic, by other means can not be used for other ontologies as it depends mainly on the architecture of the currently used map. However, using the connectedTo property a more general function can be implemented.

Parameters

loction (New) –

Returns

void

scripts.finitestates.newontology = '/root/ros_ws/src/fsm_robot/Ontologies/my_map.owl'

Global Variables used to understand the map, battery and urgent room situation. Also, set the sleeping time in each room.

scripts.finitestates.urgentupdate()[source]

Function for checking if there is an urgent room to set the global urgentflag, also returns the nearby urgent room.

Parameters

void

Returns

The nearby urgent room according to the robot position in the corridors.

Return type

Urgent room(string)

class scripts.finitestates.visitroom[source]

Class for state visitroom in which the robot checks the nearby urgent rooms and visit them staying some time. Only if the battery is charged.

Returns

keepvisiting if the battery is still charged and there are nearby urgent room, noturgentvisit if there is not urgent room by other means: visited all the nearby urgent rooms, battlow if the battery is low.

execute(userdata)[source]

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

class scripts.finitestates.waiting_for_map[source]

Class for state waiting_for_map in which the robot waits for the mapflag to be True and then load the ontlogy.

Returns

keepwaiting if map is not loaded and maploaded if the map is loaded.

execute(userdata)[source]

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

Battery

scripts.batterynode.talker()[source]

Function to initiate a topic batterylevel to publish the battery situation.

Parameters

void

Returns

void