LaserScansMemory.cpp
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
* @author Fabian Reister ( fabian dot reister at kit dot edu )
17
* @date 2022
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#include "
LaserScansMemory.h
"
23
24
#include <SimoxUtility/algorithm/string.h>
25
26
#include <
ArmarXCore/core/exceptions/local/ExpressionException.h
>
27
#include <
ArmarXCore/core/util/StringHelpers.h
>
28
29
#include "
RobotAPI/libraries/armem/server/MemoryToIceAdapter.h
"
30
#include "
RobotAPI/libraries/armem_laser_scans/constants.h
"
31
#include <
RobotAPI/libraries/armem/core/error.h
>
32
#include <
RobotAPI/libraries/armem/server/MemoryRemoteGui.h
>
33
#include <RobotAPI/libraries/armem_laser_scans/aron/LaserScan.aron.generated.h>
34
35
namespace
armarx::armem::server::laser_scans
36
{
37
LaserScansMemory::LaserScansMemory
()
38
{
39
addPlugin
(virtualRobotReaderPlugin);
40
addPlugin
(debugObserver);
41
}
42
43
armarx::PropertyDefinitionsPtr
44
LaserScansMemory::createPropertyDefinitions
()
45
{
46
armarx::PropertyDefinitionsPtr
defs =
47
new
ComponentPropertyDefinitions
(
getConfigIdentifier
());
48
49
workingMemory
().
name
() =
"LaserScans"
;
50
51
{
52
const
std::string prefix =
""
;
53
commonVisu.
defineProperties
(defs, prefix +
"visu."
);
54
}
55
56
defs->optional(properties_.coreSeg.laserScans.maxHistorySize,
57
"LaserScans.CoreMaxHistorySize"
,
58
"Max history size of the "
+
QUOTED
(
"LaserScans"
) +
" core segment."
);
59
60
return
defs;
61
}
62
63
std::string
64
LaserScansMemory::getDefaultName
()
const
65
{
66
return
"LaserScansMemory"
;
67
}
68
69
void
70
LaserScansMemory::onInitComponent
()
71
{
72
auto
& coreSegment =
workingMemory
().
addCoreSegment
(
73
"LaserScans"
, armarx::armem::laser_scans::arondto::LaserScanStamped::ToAronType());
74
75
coreSegment.
setMaxHistorySize
(properties_.coreSeg.laserScans.maxHistorySize);
76
77
commonVisu.
init
(&coreSegment, &virtualRobotReaderPlugin->
get
());
78
}
79
80
void
81
LaserScansMemory::onConnectComponent
()
82
{
83
commonVisu.
connect
(
getArvizClient
(), debugObserver->
getDebugObserver
());
84
}
85
86
void
87
LaserScansMemory::onDisconnectComponent
()
88
{
89
}
90
91
void
92
LaserScansMemory::onExitComponent
()
93
{
94
}
95
96
armem::data::AddSegmentsResult
97
LaserScansMemory::addSegments
(
const
armem::data::AddSegmentsInput&
input
,
const
Ice::Current&)
98
{
99
// Allowing adding core segments.
100
armem::data::AddSegmentsResult result =
101
ReadWritePluginUser::addSegments
(
input
, addCoreSegmentOnUsage);
102
return
result;
103
}
104
105
}
// namespace armarx::armem::server::laser_scans
armarx::armem::server::laser_scans::LaserScansMemory::onExitComponent
void onExitComponent() override
Definition:
LaserScansMemory.cpp:92
armarx::ArVizComponentPluginUser::getArvizClient
armarx::viz::Client & getArvizClient()
Definition:
ArVizComponentPlugin.h:45
armarx::armem::server::laser_scans::LaserScansMemory::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition:
LaserScansMemory.cpp:44
armarx::armem::server::wm::detail::MaxHistorySizeParent::setMaxHistorySize
void setMaxHistorySize(long maxSize)
Sets the maximum history size of entities in this container.
Definition:
MaxHistorySize.h:41
armarx::armem::server::laser_scans::Visu::init
void init(const wm::CoreSegment *coreSegment, armem::robot_state::VirtualRobotReader *virtualRobotReader)
Definition:
Visu.cpp:57
QUOTED
#define QUOTED(x)
Definition:
StringHelpers.h:199
armarx::armem::server::laser_scans::LaserScansMemory::onInitComponent
void onInitComponent() override
Definition:
LaserScansMemory.cpp:70
armarx::armem::base::MemoryBase::name
std::string & name()
Definition:
MemoryBase.h:94
armarx::ManagedIceObject::addPlugin
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
Definition:
ManagedIceObject.h:186
armarx::armem::server::laser_scans::LaserScansMemory::addSegments
armem::data::AddSegmentsResult addSegments(const armem::data::AddSegmentsInput &input, const Ice::Current &) override
Definition:
LaserScansMemory.cpp:97
armarx::armem::server::plugins::ReadWritePluginUser::workingMemory
server::wm::Memory & workingMemory()
Definition:
ReadWritePluginUser.cpp:128
armarx::armem::server::laser_scans
This file is part of ArmarX.
Definition:
LaserScansMemory.cpp:35
StringHelpers.h
armarx::armem::server::laser_scans::Visu::connect
void connect(const viz::Client &arviz, DebugObserverInterfacePrx debugObserver=nullptr)
Definition:
Visu.cpp:65
LaserScansMemory.h
constants.h
armarx::armem::server::laser_scans::LaserScansMemory::LaserScansMemory
LaserScansMemory()
Definition:
LaserScansMemory.cpp:37
armarx::DebugObserverHelper::getDebugObserver
const DebugObserverInterfacePrx & getDebugObserver() const
Definition:
DebugObserverHelper.cpp:187
armarx::armem::server::laser_scans::Visu::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="visu.")
Definition:
Visu.cpp:43
armarx::armem::server::plugins::ReadWritePluginUser::addSegments
virtual data::AddSegmentsResult addSegments(const data::AddSegmentsInput &input, const Ice::Current &=Ice::emptyCurrent) override
Definition:
ReadWritePluginUser.cpp:36
MemoryRemoteGui.h
armarx::aron::input
ReaderT::InputType & input
Definition:
rw.h:12
error.h
armarx::armem::server::laser_scans::LaserScansMemory::onConnectComponent
void onConnectComponent() override
Definition:
LaserScansMemory.cpp:81
armarx::armem::server::laser_scans::LaserScansMemory::getDefaultName
std::string getDefaultName() const override
Definition:
LaserScansMemory.cpp:64
armarx::armem::server::laser_scans::LaserScansMemory::onDisconnectComponent
void onDisconnectComponent() override
Definition:
LaserScansMemory.cpp:87
MemoryToIceAdapter.h
armarx::armem::client::plugins::ReaderWriterPlugin::get
T & get()
Definition:
ReaderWriterPlugin.h:87
ExpressionException.h
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition:
Component.cpp:79
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition:
Component.h:69
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::server::wm::Memory::addCoreSegment
CoreSegment & addCoreSegment(const std::string &name, Args... args)
Definition:
memory_definitions.h:151
RobotAPI
components
armem
server
LaserScansMemory
LaserScansMemory.cpp
Generated by
1.8.17