Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * logging.h - Logging aspect for Fawkes 00004 * 00005 * Created: Tue May 29 14:47:43 2007 00006 * Copyright 2006-2007 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. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <aspect/vision.h> 00025 00026 namespace fawkes { 00027 00028 /** @class VisionAspect <aspect/vision.h> 00029 * Thread aspect to use in FireVision apps. 00030 * 00031 * It is guaranteed that if used properly from within plugins that 00032 * initVisionAspect() is called before the thread is started and that 00033 * you can access the vision master via the vision_master member. 00034 * 00035 * A vision thread can be called either cyclic, which means that in every 00036 * loop the vision master will wait for this vision thread to finish before 00037 * the next loop. This also means that the thread has to operate in 00038 * wait-for-wakeup mode. The thread is woken up when a new camera image is 00039 * available. In general the vision thread should be very fast and under no 00040 * conditions it should take longer to process an image than to aquire it. 00041 * The thread can also operate in continuous mode, in this case also the 00042 * thread has to operate in continuous mode. In this mode the vision 00043 * application should keep running and the processing is independent from 00044 * the camera speed. Make sure that you use strict logging on the shared 00045 * memory camera to ensure healthy pictures. 00046 * 00047 * @ingroup Aspects 00048 * @author Tim Niemueller 00049 */ 00050 00051 00052 /** Constructor. 00053 * @param mode mode to operate in 00054 */ 00055 VisionAspect::VisionAspect(VisionThreadMode mode) 00056 { 00057 __vision_thread_mode = mode; 00058 } 00059 00060 00061 /** Virtual empty Destructor. */ 00062 VisionAspect::~VisionAspect() 00063 { 00064 } 00065 00066 00067 /** Set vision master. 00068 * @param vision_master vision master 00069 * It is guaranteed that this is called for a logging thread before 00070 * Thread::start() is called (when running regularly inside Fawkes). 00071 * @see VisionMaster 00072 */ 00073 void 00074 VisionAspect::init_VisionAspect(firevision::VisionMaster *vision_master) 00075 { 00076 this->vision_master = vision_master; 00077 } 00078 00079 00080 /** Get the vision thread mode of this thread. 00081 * @return vision thread mode 00082 */ 00083 VisionAspect::VisionThreadMode 00084 VisionAspect::vision_thread_mode() 00085 { 00086 return __vision_thread_mode; 00087 } 00088 00089 } // end namespace fawkes