Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
motion_thread.cpp
1
2
/***************************************************************************
3
* motion_thread.h - Katana one-time thread interface for motions
4
*
5
* Created: Wed Jun 10 11:41:36 2009
6
* Copyright 2006-2009 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.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#include "motion_thread.h"
24
#include "controller.h"
25
26
/** @class KatanaMotionThread "motion_thread.h"
27
* Katana motion thread base class.
28
* Base class for motion threads for the Katana.
29
*
30
* When implementing a motion thread ensure that you read the sensor data
31
* during the communication with the arm. The main (act) thread will not do
32
* this as not to interfere with motion thread communication. You can use
33
* code like this:
34
* @code
35
* _katana->GetBase()->GetSCT()->arr[0].recvDAT(); // update sensor values
36
* @endcode
37
* @author Tim Niemueller.
38
*/
39
40
/** Constructor.
41
* @param thread_name name of the thread
42
* @param katana katana controller base class
43
* @param logger logger
44
*/
45
KatanaMotionThread::KatanaMotionThread
(
const
char
* thread_name,
46
fawkes::RefPtr<fawkes::KatanaController>
katana,
47
fawkes::Logger
*logger)
48
: Thread(thread_name, Thread::OPMODE_CONTINUOUS)
49
{
50
_katana
= katana;
51
_logger
= logger;
52
_finished
=
false
;
53
_error_code
= 0;
54
}
55
56
57
/** Did the motion finish already?
58
* @return true if the motion was finished, flase otherwise
59
*/
60
bool
61
KatanaMotionThread::finished
()
const
62
{
63
return
_finished
;
64
}
65
66
67
/** Error code.
68
* @return error code, one or more of the ERROR_* constants from the
69
* KatanaInterface or'ed.
70
*/
71
unsigned
int
72
KatanaMotionThread::error_code
()
const
73
{
74
return
_error_code
;
75
}
76
77
78
/** Reset for next execution.
79
* Resets _finished and _error_code. If you override this method call the base
80
* class method in your method. It should be used to do anything that is required
81
* to be able to run the thread again.
82
*/
83
void
84
KatanaMotionThread::reset
()
85
{
86
_finished
=
false
;
87
_error_code
= 0;
88
}
src
plugins
katana
motion_thread.cpp
Generated by
1.8.1.2