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 /** Constructor.
52  * @param mode mode to operate in
53  */
55 {
56  add_aspect("VisionAspect");
57  vision_thread_mode_ = mode;
58 }
59 
60 /** Virtual empty Destructor. */
62 {
63 }
64 
65 /** Set vision master.
66  * @param vision_master vision master
67  * It is guaranteed that this is called for a logging thread before
68  * Thread::start() is called (when running regularly inside Fawkes).
69  * @see VisionMaster
70  */
71 void
73 {
74  this->vision_master = vision_master;
75 }
76 
77 /** Get the vision thread mode of this thread.
78  * @return vision thread mode
79  */
82 {
83  return vision_thread_mode_;
84 }
85 
86 } // end namespace fawkes
Fawkes library namespace.
firevision::VisionMaster * vision_master
Vision master.
Definition: vision.h:51
virtual ~VisionAspect()
Virtual empty Destructor.
Definition: vision.cpp:61
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
void init_VisionAspect(firevision::VisionMaster *vision_master)
Set vision master.
Definition: vision.cpp:72
VisionThreadMode vision_thread_mode()
Get the vision thread mode of this thread.
Definition: vision.cpp:81
VisionAspect(VisionThreadMode mode)
Constructor.
Definition: vision.cpp:54
VisionThreadMode
The operation mode of this vision thread.
Definition: vision.h:38