Main Page
Namespaces
Classes
Files
File List
include
yocs_controllers
default_controller.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012, Yujin Robot.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of Yujin Robot nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
38
/*****************************************************************************
39
** Ifdefs
40
*****************************************************************************/
41
42
#ifndef DEFAULT_CONTROLLER_HPP_
43
#define DEFAULT_CONTROLLER_HPP_
44
45
/*****************************************************************************
46
** Includes
47
*****************************************************************************/
48
49
namespace
yocs
50
{
51
57
class
Controller
58
{
59
public
:
60
Controller
() :
controller_active_
(false)
61
{};
62
virtual
~Controller
(){};
70
virtual
bool
init
() = 0;
71
77
bool
enable
()
78
{
79
if
(
controller_active_
)
80
{
81
return
false
;
82
}
83
else
84
{
85
controller_active_
=
true
;
86
return
true
;
87
}
88
};
89
95
bool
disable
()
96
{
97
if
(!
controller_active_
)
98
{
99
return
false
;
100
}
101
else
102
{
103
controller_active_
=
false
;
104
return
true
;
105
}
106
};
107
113
bool
getState
()
114
{
115
return
controller_active_
;
116
}
122
virtual
void
spin
()
123
{
124
// do nothing
125
};
126
127
private
:
128
bool
controller_active_
;
129
};
130
131
}
// namespace yocs
132
133
#endif
/* DEFAULT_CONTROLLER_HPP_ */
yocs
Definition:
default_controller.hpp:49
yocs::Controller::~Controller
virtual ~Controller()
Definition:
default_controller.hpp:62
yocs::Controller::Controller
Controller()
Definition:
default_controller.hpp:60
yocs::Controller::enable
bool enable()
Enables the controller.
Definition:
default_controller.hpp:77
yocs::Controller
Controller template.
Definition:
default_controller.hpp:57
yocs::Controller::spin
virtual void spin()
For complex controlling work.
Definition:
default_controller.hpp:122
yocs::Controller::getState
bool getState()
Returns the current state of the controller.
Definition:
default_controller.hpp:113
yocs::Controller::init
virtual bool init()=0
Initialise the controller.
yocs::Controller::controller_active_
bool controller_active_
Definition:
default_controller.hpp:125
yocs::Controller::disable
bool disable()
Disables the controller.
Definition:
default_controller.hpp:95
yocs_controllers
Author(s): Marcus Liebhardt
autogenerated on Mon Jun 10 2019 15:53:31