25#include <SimoxUtility/algorithm/string.h>
45 defs->defineOptionalProperty<std::string>(
46 "PriorKnowledgeName",
"PriorKnowledge",
"Prior knowledge name.");
47 defs->defineOptionalProperty<std::string>(
48 "WorkingMemoryName",
"WorkingMemory",
"Working memory name.");
49 defs->defineOptionalProperty<std::string>(
50 "RobotStateComponentName",
"RobotStateComponent",
"Robot state component name.");
53 defs->defineOptionalProperty<std::string>(
54 "ObjectClassBlackWhitelistTopic",
55 "WorkingMemoryToArVizObjectClassBlackWhitelistUpdates",
56 "The topic where updates to the object class black-whitelist are published.");
57 defs->defineOptionalProperty<std::vector<std::string>>(
58 "ObjectClassWhitelist",
60 "If not empty, only these object classes are shown (comma separated list).")
61 .map(
"[empty whitelist]", {});
62 defs->defineOptionalProperty<std::vector<std::string>>(
63 "ObjectClassBlacklist",
65 "These object classes will never be shown (comma separated list).")
66 .map(
"[empty blacklist]", {});
70 p.updateFrequency,
"p.UpdateFrequency",
"Target number of updates per second.");
72 defs->optional(p.floor.show,
"p.floor.Show",
"Whether to show the floor.");
76 "Height (z) of the floor plane. \n"
77 "Set slightly below 0 to avoid z-fighting when drawing planes on the ground.");
78 defs->optional(p.loadObjectDatasetsStr,
80 "Only load the files for the following datasets, separated by ;. Load all "
81 "if input is empty.");
90 return "WorkingMemoryToArViz";
96 return "WorkingMemoryToArViz";
118 auto datasets = simox::alg::split(p.loadObjectDatasetsStr,
";");
120 drawer.setArViz(
arviz);
121 drawer.initFromProxies(priorKnowledge, workingMemory, robotStateComponent, datasets);
124 armarx::BlackWhitelistUpdate update;
125 getProperty(update.whitelist.set,
"ObjectClassWhitelist");
126 getProperty(update.blacklist.set,
"ObjectClassBlacklist");
127 drawer.updateObjectClassBlackWhitelist(update);
130 if (p.floor.show > 0)
132 drawer.updateFloorObject(p.floor.height);
141 CycleUtil cycle(
int(1000 / p.updateFrequency));
143 while (task && !task->isStopped())
146 std::scoped_lock lock(drawerMutex);
147 drawer.updateObjects();
178 std::scoped_lock lock(drawerMutex);
179 drawer.updateObjectClassBlackWhitelist(update);
184 const memoryx::AttachObjectToRobotNodeInput& input,
188 std::scoped_lock lock(drawerMutex);
189 drawer.attachObjectToRobotNode(input);
194 const memoryx::DetachObjectFromRobotNodeInput& input,
198 std::scoped_lock lock(drawerMutex);
199 drawer.detachObjectFromRobotNode(input);
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
armarx::viz::Client arviz
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
bool usingProxyFromProperty(const std::string &propertyName, const std::string &endpoints="")
Use a proxy whose name is specified by the given property.
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
ProxyType getProxyFromProperty(const std::string &propertyName, bool addToDependencies=false, const std::string &endpoints="", bool throwOnProxyError=true)
Get a proxy whose name is specified by the given property.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
This util class helps with keeping a cycle time during a control cycle.
IceUtil::Time waitForCycleDuration()
This function will wait (virtual or system time) until the cycle time is reached.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Property definitions of WorkingMemoryToArViz.
WorkingMemoryToArVizPropertyDefinitions(std::string prefix)
Brief description of class WorkingMemoryToArViz.
void onInitComponent() override
Pure virtual hook for the subclass.
void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput &input, const Ice::Current &=Ice::emptyCurrent) override
void onDisconnectComponent() override
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
Pure virtual hook for the subclass.
static std::string GetDefaultName()
void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput &input, const Ice::Current &=Ice::emptyCurrent) override
void onExitComponent() override
Hook for subclass.
void updateBlackWhitelist(const BlackWhitelistUpdate &update, const Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
SimpleRunningTask(Ts...) -> SimpleRunningTask< std::function< void(void)> >
#define ARMARX_TRACE_LITE