Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * example_plugin.cpp - Fawkes Example Plugin 00004 * 00005 * Generated: Wed Nov 22 17:06:33 2006 00006 * Copyright 2006 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #include <plugins/examples/basics/example_plugin.h> 00024 #include <plugins/examples/basics/thread.h> 00025 #include <plugins/examples/basics/net_thread.h> 00026 #include <plugins/examples/basics/finalize_nettler_thread.h> 00027 #include <plugins/examples/basics/blackboard_thread.h> 00028 00029 /** @class ExamplePlugin plugins/examples/basics/example_plugin.h 00030 * Simple example plugin. 00031 * Creates a few threads for different wakeup hooks that print out messages 00032 * every 10 iterations. 00033 * 00034 * @author Tim Niemueller 00035 */ 00036 00037 using namespace fawkes; 00038 00039 /** Modulo count */ 00040 #define MODC 100 00041 00042 /** Constructor. 00043 * @param config Fawkes configuration 00044 */ 00045 ExamplePlugin::ExamplePlugin(Configuration *config) 00046 : Plugin(config) 00047 { 00048 // printf("ExamplePlugin constructor called\n"); 00049 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_PRE_LOOP, 00050 "PreLoopThread", MODC)); 00051 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SENSOR, 00052 "SensorThread", MODC)); 00053 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_WORLDSTATE, 00054 "WorldStateThread", MODC)); 00055 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_THINK, 00056 "ThinkThread", MODC)); 00057 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SKILL, 00058 "SkillThread", MODC)); 00059 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_ACT, 00060 "ActThread", MODC)); 00061 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_POST_LOOP, 00062 "PostLoopThread", MODC)); 00063 thread_list.push_back(new ExampleNetworkThread("NetworkThread")); 00064 thread_list.push_back(new ExampleFinalizeNettlerThread("FinalizeNettlerThread")); 00065 thread_list.push_back(new ExampleBlackBoardThread(/* reader */ true)); 00066 thread_list.push_back(new ExampleBlackBoardThread(/* reader */ false)); 00067 } 00068 00069 PLUGIN_DESCRIPTION("Example plugin demonstrating Fawkes basics") 00070 EXPORT_PLUGIN(ExamplePlugin)