Difference between revisions of "Category:Cognitao"
|  (→World model access in CogniTAO) | |||
| (17 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
| CogniTAO is a collection of decision making tools that include | CogniTAO is a collection of decision making tools that include | ||
| − | * A pure C++ Cx11 executive for   | + | * A pure C++ Cx11 executive for (Windows 10, Linux Debian, Intel / ARM support) | 
| ** Finite State Machines | ** Finite State Machines | ||
| ** Hierarchical State Machines | ** Hierarchical State Machines | ||
| ** Behavior Trees | ** Behavior Trees | ||
| ** BDI models   | ** BDI models   | ||
| − | * A Web visualization pure Javascript  | + | * A Web monitoring and visualization tool in pure Javascript   | 
| * A teamwork controller   | * A teamwork controller   | ||
| * A real-time planner | * A real-time planner | ||
| + | |||
| + | === Simple task in CogniTAO (Synchronous execution) === | ||
| + | <source lang="C++"> | ||
| + | class TaskTrue: public Task{ | ||
| + | public: | ||
| + | 	virtual void run() { | ||
| + | 		std::cout << "." << std::flush; | ||
| + | 		std::this_thread::sleep_for(std::chrono::milliseconds(1000)); | ||
| + | 		setReturn(true); | ||
| + | 	} | ||
| + | }; | ||
| + | </source> | ||
| + | |||
| + | === Task preemption in CogniTAO  (Asynchronous execution) === | ||
| + | Below is an example of task preemption while the task is busy waiting. <br> | ||
| + | Busy waiting for completion is not a requirement, the task will end only once it's stopped <br> | ||
| + | so returning from a run method and asynchronously setting it's return value and ending the task is perfectly fine. | ||
| + | <source lang="C++"> | ||
| + | class TaskIdle: public TaskThread | ||
| + | { | ||
| + | public: | ||
| + | 	// Function to be executed by thread function | ||
| + | 	void run() | ||
| + | 	{ | ||
| + | 		// Check if thread is requested to stop ? | ||
| + | 		while (stopRequested == false) | ||
| + | 		{ | ||
| + | 			std::this_thread::sleep_for(std::chrono::milliseconds(1000)); | ||
| + | 		} | ||
| + | 	} | ||
| + | }; | ||
| + | </source> | ||
| + | |||
| + | === Behaviors in CogniTAO === | ||
| + | Behavior tree support is for Sequencer / Selector / Parallel. <br> | ||
| + | More logic flow controllers can be easily defined. <br> | ||
| + | Behavior is an extension wrapper for Task, that sets it's return value at the end of the action. <br> | ||
| + | <source lang="C++"> | ||
| + | class BehaviourTrue : public Behaviour | ||
| + | { | ||
| + | public: | ||
| + | 	virtual bool action(){ | ||
| + | 		std::cout << "." << std::flush; | ||
| + | 		std::this_thread::sleep_for(std::chrono::milliseconds(2000)); | ||
| + | 		return  true; | ||
| + | 	} | ||
| + | }; | ||
| + | </source> | ||
| + | |||
| + | === World model access in CogniTAO === | ||
| + | The world model is a thread-safe global container for predicate data.  | ||
| + | <source lang="C++"> | ||
| + | WM::setVar("EVENT","E2"); | ||
| + | </source> | ||
| + | |||
| + | === XML plan definition support CogniTAO === | ||
| + | Simple SCXML support | ||
| + | <source lang="C++"> | ||
| + | <state initial="A"> | ||
| + |     <state id="A">  | ||
| + |         <state initial="a1"> | ||
| + |             <state id="a1"> | ||
| + |                 <transition event="COIN_A" target="a2"/> | ||
| + |             </state> | ||
| + |             <state id="a2"> | ||
| + |             </state> | ||
| + |         </state> | ||
| + |         <transition event="CHANGE_M" target="B"/> | ||
| + |     </state> | ||
| + | |||
| + |     <state id="B"> | ||
| + |         <state initial="b1"> | ||
| + |             <state id="b1"> | ||
| + |                 <transition event="COIN_B" target="b2"/> | ||
| + |             </state> | ||
| + |             <state id="b2"> | ||
| + |             </state> | ||
| + |         </state> | ||
| + |          <transition event="UNCHANGE_M" target="A"/> | ||
| + |     </state> | ||
| + | </state> | ||
| + | </source> | ||
| + | |||
| + | Behaviour Tree XML support | ||
| + | <source lang="C++"> | ||
| + | <plan> | ||
| + |    <seq name="S">  | ||
| + |          <sel name="S1">  | ||
| + |                <seq name="S2">  | ||
| + |                      <tsk name="Test1" /> | ||
| + |                      <tsk name="Test2" /> | ||
| + |                </seq> | ||
| + |                <tsk name="Test3" /> | ||
| + |          </sel> | ||
| + |          <sel name="S3">  | ||
| + |                <seq name="S4">  | ||
| + |                      <tsk name="Test4" /> | ||
| + |                      <tsk name="Test5" /> | ||
| + |                </seq> | ||
| + |                <tsk name="Test6" /> | ||
| + |          </sel> | ||
| + |          <sel name="S5">  | ||
| + |                <seq name="S6">  | ||
| + |                      <tsk name="Test7" /> | ||
| + |                      <tsk name="Test8" /> | ||
| + |                </seq> | ||
| + |                <tsk name="Test9" /> | ||
| + |          </sel> | ||
| + |    </seq> | ||
| + | </plan> | ||
| + | </source> | ||
Latest revision as of 11:11, 19 September 2019
Contents
CogniTAO
CogniTAO is a collection of decision making tools that include
-  A pure C++ Cx11 executive for (Windows 10, Linux Debian, Intel / ARM support)
- Finite State Machines
- Hierarchical State Machines
- Behavior Trees
- BDI models
 
- A Web monitoring and visualization tool in pure Javascript
- A teamwork controller
- A real-time planner
Simple task in CogniTAO (Synchronous execution)
<source lang="C++"> class TaskTrue: public Task{ public: virtual void run() { std::cout << "." << std::flush; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); setReturn(true); } }; </source>
Task preemption in CogniTAO (Asynchronous execution)
Below is an example of task preemption while the task is busy waiting. 
Busy waiting for completion is not a requirement, the task will end only once it's stopped 
so returning from a run method and asynchronously setting it's return value and ending the task is perfectly fine.
<source lang="C++">
class TaskIdle: public TaskThread
{
public:
	// Function to be executed by thread function
	void run()
	{
		// Check if thread is requested to stop ?
		while (stopRequested == false)
		{
			std::this_thread::sleep_for(std::chrono::milliseconds(1000));
		}
	}
};
</source>
Behaviors in CogniTAO
Behavior tree support is for Sequencer / Selector / Parallel. 
More logic flow controllers can be easily defined. 
Behavior is an extension wrapper for Task, that sets it's return value at the end of the action. 
<source lang="C++">
class BehaviourTrue : public Behaviour
{
public:
	virtual bool action(){
		std::cout << "." << std::flush;
		std::this_thread::sleep_for(std::chrono::milliseconds(2000));
		return  true;
	}
};
</source>
World model access in CogniTAO
The world model is a thread-safe global container for predicate data. <source lang="C++"> WM::setVar("EVENT","E2"); </source>
XML plan definition support CogniTAO
Simple SCXML support <source lang="C++"> <state initial="A">
   <state id="A"> 
       <state initial="a1">
           <state id="a1">
               <transition event="COIN_A" target="a2"/>
           </state>
           <state id="a2">
           </state>
       </state>
       <transition event="CHANGE_M" target="B"/>
   </state>
   <state id="B">
       <state initial="b1">
           <state id="b1">
               <transition event="COIN_B" target="b2"/>
           </state>
           <state id="b2">
           </state>
       </state>
        <transition event="UNCHANGE_M" target="A"/>
   </state>
</state> </source>
Behaviour Tree XML support <source lang="C++"> <plan>
  <seq name="S"> 
        <sel name="S1"> 
              <seq name="S2"> 
                    <tsk name="Test1" />
                    <tsk name="Test2" />
              </seq>
              <tsk name="Test3" />
        </sel>
        <sel name="S3"> 
              <seq name="S4"> 
                    <tsk name="Test4" />
                    <tsk name="Test5" />
              </seq>
              <tsk name="Test6" />
        </sel>
        <sel name="S5"> 
              <seq name="S6"> 
                    <tsk name="Test7" />
                    <tsk name="Test8" />
              </seq>
              <tsk name="Test9" />
        </sel>
  </seq>
</plan> </source>
This category currently contains no pages or media.
