Wiki

Note: This tutorial assumes that you have completed the previous tutorials: decision_making/Tutorials/CogniTAO.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

CogniTAO C++ Reference

Description: CogniTAO C++ Reference

Keywords: decision_making

Tutorial Level: BEGINNER

Introduction

This page includes a Reference manual to TAO C++ syntax. If you wish to get an overview of several TAO examples go to one of the links below

TAO Machine definition

TAO's are defined in a CPP file, and declared in the header file.

TAO

TAO(TAO_NAME){ ... }

TAO_HEADER

TAO_HEADER(TAO_NAME);

TAO State definition

TAO_PLANS

TAO_PLANS{ PLAN_1, PLAN_2, ... }

TAO_START

TAO_START_PLAN(PLAN_NAME);

TAO_BGN - TAO_END

TAO_BGN{ PLANS }TAO_END

TAO_PLAN

TAO_PLAN(PLAN_NAME){

TAO Conditions

TAO_START_CONDITION

TAO_START_CONDITION(CONDITION)

TAO_STOP_CONDITION

TAO_STOP_CONDITION(CONDITION)

TAO Protocols

TAO_NEXT

TAO_NEXT(PROTOCOL){ OPTIONS }

TAO_NEXT_PLAN(PLAN)

TAO_ALLOCATE

TAO_ALLOCATE(PROTOCOL){ OPTIONS }

TAO_SUBPLAN(TAO)

TAO Events

EventQueue is a events distribution system.

Each Event is a path containing:

Example: /Con/tex/Na/me/EventName. When you compare two events you can use Regular Expressions as the name of one event by writing @ on the begging of the name. Example: @/Con/.*/Event[NT]...e

Events usage : (STOP event for example)

Interface:

Common extensions :

TAO_RAISE

TAO_RAISE(EVENT)

TAO_EVENTS_DROP

TAO_EVENTS_DROP;

TAO_EVENT

TAO_EVENT(EVENT)

Example:

TAO Actions

TAO_CALL_TASK

TAO_CALL_TASK(TASK_NAME)

TAO_CALL_TAO

TAO_CALL_TAO(TAO_NAME)

TAO_CALL_BT

TAO_CALL_BT(BT_NAME)

TAO_CALL_FSM

TAO_CALL_FSM(FSM_NAME)

TAO_CLEANUP

TAO_CLEANUP_BGN{ ... }TAO_CLEANUP_END

TAO_RESULT

TAO_RESULT(EVENT,RESULT)

Call TAO

TAO is a function with signature:

 TaskResult TaoNAME(const CallContext* ctx,EventQueue* events);

This function is blocked up to TAO is finished (preempted, stopped by TAO_RESULT or EventQueue is closed). So, just call this function. If you need special rates for decision making (stop conditions validation) use EventQueue::spin, spinOne or async_spin methods.

CallContext

This is a class for shearing parameters and context information through calls of TAO/HSM/BT machines.

Interface:

Tasks

Task is an atomic preemptable action. decision making supports two types of Tasks

  1. ROS remote task
  2. Local task

ROS remote task

Special Activelib client. For create this kind of task, you need extend RobotTask class from robot_task package.

Local task

It's a callback function:

 TaskResult FUNCTION_NAME( string task_name, const CallContext& context, EventQueue& events)

You need to registrate local task before usage (otherwise, the system assumes that the task is remote).

 LocalTasks::registrate(''TASK_NAME'', ''CALLBACK'')

Wiki: decision_making/Tutorials/CogniTAO(C++) (last edited 2014-01-26 10:52:25 by Ari Yakir)