Skip to content
Snippets Groups Projects
Commit 233eb78a authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Make ArVizComponentPlugin usable in gui plugins

parent dc737232
No related branches found
No related tags found
1 merge request!76Update cartesian impedance and arviz
......@@ -2,10 +2,16 @@
namespace armarx::plugins
{
std::string ArVizComponentPlugin::getTopicName()
{
return parentDerives<Component>() ?
parent<Component>().getProperty<std::string>(makePropertyName(PROPERTY_NAME)) :
std::string{PROPERTY_DEFAULT};
}
void ArVizComponentPlugin::preOnInitComponent()
{
parent<Component>().offeringTopicFromProperty(makePropertyName(PROPERTY_NAME));
parent().offeringTopic(getTopicName());
}
void ArVizComponentPlugin::preOnConnectComponent()
......@@ -19,22 +25,19 @@ namespace armarx::plugins
{
properties->defineOptionalProperty<std::string>(
makePropertyName(PROPERTY_NAME),
"ArVizTopic",
PROPERTY_DEFAULT,
"Name of the ArViz topic");
}
}
viz::Client ArVizComponentPlugin::createClient()
{
viz::Client client(parent<Component>(), makePropertyName(PROPERTY_NAME));
return client;
return viz::Client(parent(), getTopicName());
}
}
namespace armarx
{
ArVizComponentPluginUser::ArVizComponentPluginUser()
{
addPlugin(plugin);
......@@ -44,7 +47,4 @@ namespace armarx
{
return plugin->createClient();
}
}
......@@ -4,10 +4,8 @@
#include <RobotAPI/components/ArViz/Client/Client.h>
namespace armarx::plugins
{
class ArVizComponentPlugin : public ComponentPlugin
{
public:
......@@ -21,13 +19,14 @@ namespace armarx::plugins
armarx::viz::Client createClient();
std::string getTopicName();
private:
static constexpr const char* PROPERTY_NAME = "ArVizTopicName";
static constexpr const char* PROPERTY_DEFAULT = "ArVizTopic";
};
}
namespace armarx
{
/**
......@@ -45,7 +44,6 @@ namespace armarx
private:
armarx::plugins::ArVizComponentPlugin* plugin = nullptr;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment