Instinct Planner

Instinct with an ant, a monkey and a biological cell

The Instinct Planner is a new biologically inspired reactive planner, based on an established behaviour based robotics methodology and its reactive planner component — the POSH planner implementation. However, it includes several significant enhancements to facilitate plan design and runtime debugging. It has been specifically designed for low power processors and has a tiny memory footprint. Written in C++, it runs efficiently on both ARDUINO (ATMEL AVR) and MICROSOFT VC++ environments and has been deployed within the R5 low cost maker robot to study AI Transparency. Plans may be authored using a variety of tools including a promising visual design language iVDL, currently implemented using the DIA drawing package.

Reactive Planning

Reactive planning is sometimes called dynamic planning. It’s all about action selection – having a strategy or algorithm that makes the agent do the right thing at the right time, from its available repertoire of behaviours, in order to achieve some goal or set of goals. In a robot, a reactive plan is evaluated typically many times per second, even though actions may take many seconds to complete. The plan is arranged as an acyclic directed graph – a tree structure allowing lower level branches to be reused multiple times at higher levels. At the top of the tree we have Drives. Each Drive is intended to achieve one goal. The Drive is ‘released’ when certain sensory conditions are met, and the Drive then invokes a structure of Competences and Action Patterns. These structure may contain further levels of Competences and Action Patterns, as behaviour is decomposed into its constituent parts. The leaf nodes of the tree are Actions, the basic units of behaviour. The planner remembers its state between each plan cycle, and allows pending actions to continue until complete, unless interrupted by a Drive with higher priority.

A more complete and formal explanation of the Instinct reactive planner is available here –  Instinct: A Biologically Inspired Reactive Planner for Embedded Environments.

Source Code

This technology is available in GitHub as an open source project.

Help System

The Planner includes online Help. Here is a trace of the help output. It explains all the commands available to define plans, configure monitoring and obtain information about the current plan.

HELP PLAN
PLAN Commands:
A{Add plan element}|U{Update plan element}|M{Config Monitor}|R{Reset plan}]
                                                         [parameter values]
A - add elements to the existing plan
  A [D{Drive}|C{Competence}|A{Action}|P{Action Pattern}|E{Competence Element}|
     L{ActionPattern Element}] [parameters]
    The A D command has 12 parameters as below:
        A D Runtime_ElementID Runtime_ChildID Priority uiInterval SenseID
            Comparator SenseValue SenseHysteresis SenseFlexLatchHysteresis
            RampIncrement UrgencyMultiplier RampInterval
    The A C command has 2 parameters:
        A C Runtime_ElementID UseORWithinCEGroup
    The A A command has 3 parameters:
        A A Runtime_ElementID ActionID ActionValue
    The A P command has just one parameter:
        A P Runtime_ElementID
    The A E command has 10 parameters:
        A E Runtime_ElementID Runtime_ParentID Runtime_ChildID Priority
            RetryLimit SenseID Comparator SenseValue SenseHysteresis
            SenseFlexLatchHysteresis
      The A L command has 4 parameters:
        A L Runtime_ElementID Runtime_ParentID Runtime_ChildID Order
D - display a given node, or the highest element ID
  D [N{display plan settings for a node}|C{display counters for a node}|
     H{Highest node ID}]
      The D N and D C commands have 1 parameter as below:
          D {N|C} Runtime_ElementID
      The D H command takes no parameters.
U - command not yet supported. Will allow update of individual nodes
M - Update the monitor flags for a specific node, or the global flags
  M [N{Node ID}|G{Global flags}]
      The M N command has 7 parameters
          M N Runtime_ElementID MonitorExecuted MonitorSuccess MonitorPending
              MonitorFail MonitorError MonitorSense e.g. M N 27 1 1 0 1 1 1
      The M G command has 6 parameters
          M G MonitorExecuted MonitorSuccess MonitorPending MonitorFail
              MonitorError MonitorSense e.g. M N  0 1 0 0 0 1
R - Clear the plan and initialise a new one
  R [C{clear plan}|I{clear plan and initialise new one}]
      The R C command takes no parameters
      The R I command takes 6 parameters
          R I COUNT_ACTIONPATTERN COUNT_ACTIONPATTERNELEMENT COUNT_COMPETENCE
              COUNT_COMPETENCEELEMENT COUNT_DRIVE COUNT_ACTION
              e.g. R I 0 0 1 10 2 20
S - return the size of the plan into a string buffer
  S [C{return node counts}|S{return total plan size}]
      The S C and S S commands take no parameters
I - Set/return the ID of the plan
  I [S{set the plan ID}|R{return the plan ID}]
      The I S command takes 1 parameter
          I S [PlanID]
      The I R command takes no parameters

Visual Design Tool

A python plugin for Dia is available to enable the rapid creation and editing of plans. The plugin is included in the GitHub repository in the extras directory. A typical plan looks like this

Robot Plan Created using iVDL in Dia
Robot Plan Created using iVDL in Dia

An iVDL Plan Template is included in the GitHub repository.

Instinct Server

The Instinct Server is a simple Java command line tool that interacts with the R5 robot using TCP/IP over a wifi link. It allows the user to automatically download a plan, or send other robot commands, when the robot first connects to the server. It then provides an on screen trace and a log file of all communication with the robot. Most importantly, it captures the Instinct Planner runtime trace that can then be used to debug the Instinct Plan. When the trace data is retrieved it replaces the Plan IDs, used internally by Instinct, with the plan element names defined by iVDL. In this way the trace is human readable.

The source code, example command files and an example plan file are available in GitHub.

Instinct Robot World

The Instinct Robot World is a simple 2D world within which multiple simulated robots can move and interact. Each robot has senses and behaviours (actions) and the action selection is provided by the Instinct Planner. Each robot runs its own plan, and the GUI allows different plans to be loaded for each robot, or each group of robots. A 2nd instance of the Instinct Planner is available within each robot, and this may be used to monitor and modify the parameters of the action selection as the robot operates. This enables learning and plan optimisation. The Instinct Robot World was developed with the following objectives:

  1. To provide a test-bed to fully test and debug the Instinct Planner
  2. To test and demonstrate the tiny memory and cpu footprint of the Instinct Planner, and therefore the ability to run many (hundreds) of robots in a simple, single threaded environment
  3. To demonstrate how the Instinct planner may be used for Agent Based Modelling (ABM) where a more sophisticated action selection model may be required than is typically provided by tools ABM such as NetLogo.
  4. To investigate the idea of a ‘2nd order Darwinian mind’. That is, a mind consisting of one pre-defined action selection mechanism within an agent being modified in real time by another similar mechanism, giving rise to ontogenic learning.
  5. To be used as a learning tool for understanding reactive planning in general, and in particular the Instinct Planner and iVDL. It can also be used to investigate ABM using C++.

Here is an example screenshot:

Instinct Planner Robot World
The Instinct Robot World GUI

The source code and example Instinct plan files available in GitHub.

Further Details

For further details please see Instinct: A Biologically Inspired Reactive Planner for Embedded Environments. This page will be updated with further details as they become available. Please contact me directly for questions.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Rob Wortham – PhD researcher in Autonomous Robotics