ExpRobLab assignment’s documentation

State Machine Module

ROS node for implementing a state machine which sets the desired robot’s behaviour

Action client(s):

  • action_scanner

  • action_planner

  • action_controller

  • OntologyInterface

class scripts.state_machine.Mapping

Class implementing the Mapping state of the state machine

execute(userdata)

Mapping state callback Sends a goal “load_map” to the scanner node and busy waits for it to end

class scripts.state_machine.Monitor

Class implementing the Monitor state of the state machine Ask the scanner to scan the room while checking if the state is preempted

execute(userdata)

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.state_machine.Move(type)

Class implementing the Move state of the state machine Manages the motion to a location:

  • asks the Ontology Interface for the target

  • ask move_base to plan and control the motion to the target

  • asks the Ontology Interface to set the new robot position in the ontology

execute(userdata)

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.state_machine.Recharge

Class implementing the Recharge state of the state machine Waits for the given time while checking if the state is preempted

execute(userdata)

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.state_machine.child_term_cb(outcome_map)

Function called when an inner state terminates It just terminates all the inner states

scripts.state_machine.main()

This function initializes the ROS node, the state machine and the clients for the scanner, planner, controller and ontology_interface modules.

scripts.state_machine.monitor_cb(ud, msg)

Function called when a message is published in the battery_status topic Decides if preempting the states based on the message

scripts.state_machine.out_cb_monitoring(outcome_map)

Function called when all the MONITORING-state’s inner states terminate It chose the outcome of the main state

Returns:

‘battery_low’ if the inner state machine EXECUTE has been preempted

‘monitoring_done’ if EXECUTE ended the execution

scripts.state_machine.out_cb_recharge(outcome_map)

Function called when all the RECHARGING-state’s inner states terminate It sets the outcome of the main state

Returns:

‘recharge_done’

Ontology Interface Module

ROS node for quering and manipulating the ontology loaded in the ARMOR server.

Action server:

  • OntologyInterface

class scripts.ontology_interface.OntologyInterface

Class implementing an interface for the ontology

choose_next_location()

Choose the next target following the following algorithm

  • choose an urgent room (randomly) if reachable

  • else, choose a corridor (randomly)

  • else, choose any reachable room (randomly)

clean_response_list(res)

Clean an armor query’s output from the IRI and some special character

execute_callback(goal)

Action server callback It calls a function according to the received command and returns the function output

load_map(ids)

Popolates the ontology according to the markers ids and save the names of the robot and all the locations, rooms and corridors

set_location(to)

Set a new robot location according to the input It replaces the robot’s isIn value and the new location’s visitedAt value with the new ones

update_timestamp()

Call the reasoner and replace the robot’s now value with a new one

Scanner Module

ROS node for controlling the camera arm of the proposed robot

Action server:

  • action_scanner

class scripts.scanner.ScannerAction

Class implementing the scanner action server

execute_callback(goal)

When receives a goal, if it makes sense, call the corresponding function

id_detected(marker)

Get the id and checks if it’s valid

load_map()

Scan the markers and send the ids to the ontology_interface in order to load the map

scan()

Rotates the camera of 360 degrees

wait_for_joint(joint)

Wait until the joint reaches the desired configuration

Robot-State Module

ROS node which keeps track of the robot pose and battery status.

Being a simpler version, for the documentation please refer to the original code

Planner Module

ROS node for implementing a planner.

Being this a simpler version, for the documentation please refer to the original code

It calls the service ‘make_plan’ offered by move_base.

Controller Module

ROS node for implementing a controller.

Being a simpler version, for the documentation please refer to the original code

It calls the move_base package to make a plan and control the motion to a given target.

class scripts.controller.ControllerAction

Class implementing the controller

execute_callback(goal)

Called every time a goal comes: - Checks if there’s a target into the goal std_msg - Send the goal to the move_base package - Waits while checking for preemption

update_pose(feedback)

Move_base feedback callback. Set the new pose in the robot_state node