Fawkes API  Fawkes Development Version
vision.cpp
1 
2 /***************************************************************************
3  * vision.cpp - Vision aspect for Fawkes
4  *
5  * Created: Tue May 29 14:47:43 2007
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <aspect/vision.h>
25 
26 namespace fawkes {
27 
28 /** @class VisionAspect <aspect/vision.h>
29  * Thread aspect to use in FireVision apps.
30  *
31  * It is guaranteed that if used properly from within plugins that
32  * initVisionAspect() is called before the thread is started and that
33  * you can access the vision master via the vision_master member.
34  *
35  * A vision thread can be called either cyclic, which means that in every
36  * loop the vision master will wait for this vision thread to finish before
37  * the next loop. This also means that the thread has to operate in
38  * wait-for-wakeup mode. The thread is woken up when a new camera image is
39  * available. In general the vision thread should be very fast and under no
40  * conditions it should take longer to process an image than to aquire it.
41  * The thread can also operate in continuous mode, in this case also the
42  * thread has to operate in continuous mode. In this mode the vision
43  * application should keep running and the processing is independent from
44  * the camera speed. Make sure that you use strict logging on the shared
45  * memory camera to ensure healthy pictures.
46  *
47  * @ingroup Aspects
48  * @author Tim Niemueller
49  */
50 
51 
52 /** Constructor.
53  * @param mode mode to operate in
54  */
56 {
57  add_aspect("VisionAspect");
58  __vision_thread_mode = mode;
59 }
60 
61 
62 /** Virtual empty Destructor. */
64 {
65 }
66 
67 
68 /** Set vision master.
69  * @param vision_master vision master
70  * It is guaranteed that this is called for a logging thread before
71  * Thread::start() is called (when running regularly inside Fawkes).
72  * @see VisionMaster
73  */
74 void
76 {
77  this->vision_master = vision_master;
78 }
79 
80 
81 /** Get the vision thread mode of this thread.
82  * @return vision thread mode
83  */
86 {
87  return __vision_thread_mode;
88 }
89 
90 } // end namespace fawkes
Fawkes library namespace.
firevision::VisionMaster * vision_master
Vision master.
Definition: vision.h:53
virtual ~VisionAspect()
Virtual empty Destructor.
Definition: vision.cpp:63
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:52
void init_VisionAspect(firevision::VisionMaster *vision_master)
Set vision master.
Definition: vision.cpp:75
VisionThreadMode vision_thread_mode()
Get the vision thread mode of this thread.
Definition: vision.cpp:85
VisionAspect(VisionThreadMode mode)
Constructor.
Definition: vision.cpp:55
VisionThreadMode
The operation mode of this vision thread.
Definition: vision.h:41