SensorActorUnit.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @package ArmarXCore::utils
17
* @author Kai Welke (welke@kit.edu)
18
* @date 2011
19
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20
* GNU General Public License
21
*/
22
23
#pragma once
24
25
#include <
ArmarXCore/core/system/ImportExport.h
>
26
#include <
ArmarXCore/core/Component.h
>
27
#include <
ArmarXCore/core/exceptions/Exception.h
>
28
#include <RobotAPI/interface/units/UnitInterface.h>
29
30
#include <mutex>
31
32
namespace
armarx
33
{
34
/**
35
* \class SensorActorUnit
36
* \ingroup RobotAPI-SensorActorUnits
37
* \brief Base Class for SensorActorUnits.
38
*
39
* SensorActorUnits are ArmarX component which provide an actor API and a sensor data stream.
40
* The SensorActorUnit provides basic execution state handling and concurrent access handling.
41
*/
42
class
ARMARXCORE_IMPORT_EXPORT
SensorActorUnit
:
43
virtual
public
SensorActorUnitInterface,
44
virtual
public
Component
45
{
46
public
:
47
/**
48
* Constructs a SensorActorUnit.
49
*/
50
SensorActorUnit
();
51
/**
52
* Destructor of SensorActorUnit.
53
*/
54
~
SensorActorUnit
()
override
;
55
56
/**
57
* Set execution state to eInitialized.
58
*
59
* Assures that init is called only once and the calls subclass method onInit().
60
*
61
* \param c Ice context provided by the Ice framework
62
*/
63
void
init(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
64
65
/**
66
* Set execution state to eStarted
67
*
68
* Start streaming of sensory data and acceptance of control data.
69
*
70
* Start can be called if the unit is initialized and not started yet (stopped).
71
* Calls subclass method inStart().
72
*
73
* \param c Ice context provided by the Ice framework
74
*/
75
void
start(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
76
77
/**
78
* Set execution state to eStopped
79
*
80
* Stop streaming of sensory data and acceptance of control data.
81
*
82
* Stop can be called if the unit is started.
83
* Calls subclass method onStop()
84
*
85
* \param c Ice context provided by the Ice framework
86
*/
87
void
stop(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
88
89
/**
90
* Retrieve current execution state
91
*
92
* \param c Ice context provided by the Ice framework
93
* \return current execution state
94
*/
95
UnitExecutionState getExecutionState(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
96
97
/**
98
* Request exclusive access to current unit. Throws ResourceUnavailableException on error.
99
*
100
* \param c Ice context provided by the Ice framework
101
*/
102
void
request(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
103
104
/**
105
* Release exclusive access to current unit. Throws ResourceUnavailableException on error.
106
*
107
* \param c Ice context provided by the Ice framework
108
*/
109
void
release(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
110
111
protected
:
112
void
onExitComponent()
override
;
113
/**
114
* callback onInit for subclass hook. See init().
115
*/
116
virtual
void
onInit
() {};
117
118
/**
119
* callback onStart for subclass hook. See start().
120
*/
121
virtual
void
onStart
() {};
122
123
/**
124
* callback onStop for subclass hook. See stop().
125
*/
126
virtual
void
onStop() {};
127
128
std::mutex unitMutex;
129
Ice::Identity
ownerId
;
130
UnitExecutionState
executionState
;
131
};
132
}
133
armarx::SensorActorUnit::onInit
virtual void onInit()
callback onInit for subclass hook.
Definition:
SensorActorUnit.h:116
c
constexpr T c
Definition:
UnscentedKalmanFilterTest.cpp:43
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition:
MatrixXX.h:523
armarx::SensorActorUnit::ownerId
Ice::Identity ownerId
Definition:
SensorActorUnit.h:129
armarx::SensorActorUnit::executionState
UnitExecutionState executionState
Definition:
SensorActorUnit.h:130
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition:
Component.h:95
armarx::SensorActorUnit
Base Class for SensorActorUnits.
Definition:
SensorActorUnit.h:42
ImportExport.h
armarx::SensorActorUnit::onStart
virtual void onStart()
callback onStart for subclass hook.
Definition:
SensorActorUnit.h:121
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition:
ImportExport.h:38
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
Exception.h
RobotAPI
components
units
SensorActorUnit.h
Generated on Sat Oct 12 2024 09:14:07 for armarx_documentation by
1.8.17