Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * vision.cpp - Vision aspect for Fawkes 00004 * 00005 * Created: Tue May 29 14:47:43 2007 00006 * Copyright 2006-2010 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 add_aspect("VisionAspect"); 00058 __vision_thread_mode = mode; 00059 } 00060 00061 00062 /** Virtual empty Destructor. */ 00063 VisionAspect::~VisionAspect() 00064 { 00065 } 00066 00067 00068 /** Set vision master. 00069 * @param vision_master vision master 00070 * It is guaranteed that this is called for a logging thread before 00071 * Thread::start() is called (when running regularly inside Fawkes). 00072 * @see VisionMaster 00073 */ 00074 void 00075 VisionAspect::init_VisionAspect(firevision::VisionMaster *vision_master) 00076 { 00077 this->vision_master = vision_master; 00078 } 00079 00080 00081 /** Get the vision thread mode of this thread. 00082 * @return vision thread mode 00083 */ 00084 VisionAspect::VisionThreadMode 00085 VisionAspect::vision_thread_mode() 00086 { 00087 return __vision_thread_mode; 00088 } 00089 00090 } // end namespace fawkes