wiki:Plugins/readylogagent
Last modified 5 years ago Last modified on 13.05.2014 15:56:09

Readylogagent Plugin

Integrates a Readylogagent based on ECLiPSe into Fawkes. Different agents can be written in ECLiPSe to perform as high-level agent.

Requires

BlackBoard Interfaces

In order to use all freatures of the dummy interpreter provided, the plugin has to access it's own interface (TestInterface::readylog_test) as reader. This is done automatically and does not need to be configured.

Config Values

PathTypeDescriptionDefault
/readylogagent/agentstringName of ECLiPSe module in which the agent is stored (needs to be placed in plugins/readylogagent/interpreter/)"indi_elevator"
/readylogagent/eclipse_dirstringBasedirectory of ECLiPSe"/usr/libexec/eclipse-clp-6.1-164-x86_64/"

Furthermore for each agent-value, it has to be said whether it uses a navgraph. For example "indi_elevator" does not use a navgraph, so the config looks as follows:

PathTypeDescriptionDefault
/readylogagent/indi_elevator/use_graphbooleanWhether to use a graphFalse

As an example for a agent that uses a navgraph, consider the config for "drive_indi":

PathTypeDescriptionDefault
/readylogagent/indi_elevator/use_graphbooleanWhether to use a graphYes
/readylogagent/indi_elevator/rel_graph_pathstringlocation of navgraph file relative to CONFDIR"/locations/robolab/navgraph-robolab.yaml"

Provides

BlackBoard Interfaces

  • TestInterface::readylog_test

Compilation and Runtime Requirements

Usage Instructions

Load the plugin, the robot will use a dummy agent for testing located in fawkes/src/plugins/readylogagent/interpreter/dummy.ecl.

Basic concepts when writing new agents

The agent will be called by the goal "run" which is executed only once at the start of the plugin.

Provide event handlers for the events update and terminate, e.g.:

%% event handlers
handle_update(update) :-
        log_debug("Event: UPDATE"),
	asserta(update(update)).

handle_terminate(terminate) :-
        log_info("Event: TERMINATE"),
        asserta(terminate(1)).

%% setup event handlers
:- set_event_handler(update, handle_update/1).
:- set_event_handler(terminate, handle_terminate/1).

The event update is passed to ECLiPSe whenever the think-hook is started. Terminate is passed when the plugin prepares to finalize itself.

Interacting with the BlackBoard from within ECLiPSe

In order to use the BlackBoard from within ECLiPSe your agent needs to import the blackboard module by calling use_module with the path to fawkes/src/readylog/externals/blackboard.ecl.

Here is a description of the predicates blackboard.ecl exports:

PredicateDescription
bb_connect(+Host)Host spezifies the hostname with where fawkes is running and where one wants to connect to. Note: fails if already connected.
bb_disconnectDisconnects from Blackboard
bb_is_aliveDetects if the Blackboard is still alive
bb_open_interface(+Mode,+Type,+Id)mode is either "w" or "r" for writing/reading. Type and Id specify the interface that should be opened. Needs to be connected before usage.
bb_close_interface(+Id)Closes the interface with the given Id.
bb_has_writer(+Id)Succeeds if interface with given Id has a writer, fails otherwise
bb_instance_serial(+Id, -Serial)Binds the serial of the interface specified by Id to Serial
bb_read_interfacesReads all interfaces that are open (this will update the underlying storage, so call this predicate before using bb_read_interface/3)
bb_write_interfacesWrites all changes that have been made by bb_write_interface/3 to the blackboard, so you need to call this after using bb_write_interface/3.
bb_read_interface(+Id,+Field,-Value)Given Id and Field name, unify current value of that field with Value. Need to bb_read_interfaces/0 before.
bb_write_interface(+Id,+Field,+Value)Given Id and Field name, write Value to that field. Need to bb_write_interfaces/0 afterwards.
bb_send_message(+Id,+Message, +Args)Id of Blackboard, message type and a list containing arguments for the message. Args is of the format: [[field1, value1], [field2, value2]..]
bb_recv_messages(+Id,-List) List is unified with a list of all messages currently on the message stack. The List is of the form: [[MsgType1, [[Key1, Val1], ...]], ... ]

Changes that will apply in future:

PredicateDescription
bb_connect_remote(+Host)(Renaming of bb_connect/1.) Host spezifies the hostname with where fawkes is running and where one wants to connect to. Note: fails if already connected.
bb_connectUses the blackboard of the readylogagent thread. Note: fails if already connected.
bb_ensure_connected_remote(+Host) Wrapper for bb_connect_remote(+Host). Will succeed if already connected.
bb_ensure_connectedWrapper for bb_connect/0. Will succeed if already connected.

Debugging

See eclipsedebugger.