Skip to content
Snippets Groups Projects
Commit ba4628f6 authored by Christian Dreher's avatar Christian Dreher
Browse files

fix: No accessor for mixin.

parent 60459a33
No related branches found
No related tags found
No related merge requests found
......@@ -93,20 +93,20 @@ exns::ExampleClient::exampleNavigation()
.configureGeneral({}/*{.maxVel = VelocityLimits{.linear = 400 , .angular = 0.1}}*/));
// Example of registering a lambda as callback.
navigator().onGoalReached([&]()
navigator.onGoalReached([&]()
{
ARMARX_IMPORTANT << "Goal reached! (lambda-style)";
});
// Example of registering a method as callback.
navigator().onGoalReached([this] { goalReached(); });
navigator.onGoalReached([this] { goalReached(); });
std::this_thread::sleep_for(1s);
ARMARX_INFO << "Moving to goal pose";
// Start moving to goal position using above config.
const Pose goal = Pose::Identity();
navigator().moveTo(goal, NavigationFrame::Absolute);
navigator.moveTo(goal, NavigationFrame::Absolute);
// Wait until goal is reached
navigator.waitForGoalReached();
......@@ -115,12 +115,12 @@ exns::ExampleClient::exampleNavigation()
ARMARX_INFO << "Moving into certain direction.";
// Start moving towards a direction
navigator().moveTowards(Direction(100, 100, 0), NavigationFrame::Relative);
navigator.moveTowards(Direction(100, 100, 0), NavigationFrame::Relative);
std::this_thread::sleep_for(3s);
ARMARX_INFO << "Pausing movement.";
navigator().pauseMovement();
navigator.pauseMovement();
}
......
#include "Navigation/libraries/client/ComponentPlugin.h"
#include "ArmarXCore/core/Component.h"
#include "ArmarXCore/core/application/properties/PropertyDefinitionContainer.h"
#include "ArmarXCore/util/CPPUtility/trace.h"
// ComponentPlugin
armarx::nav::client::ComponentPlugin::~ComponentPlugin()
= default;
void armarx::nav::client::ComponentPlugin::postCreatePropertyDefinitions(
armarx::PropertyDefinitionsPtr& properties)
{
if (not properties->hasDefinition(PROPERTY_NAME))
{
// properties->defineRequiredProperty<std::string>(PROPERTY_NAME, "Name of the Navigator");
properties->defineOptionalProperty<std::string>(PROPERTY_NAME, "Navigator", "Name of the Navigator");
}
}
void armarx::nav::client::ComponentPlugin::preOnInitComponent()
{
ARMARX_TRACE;
parent<armarx::Component>().usingProxyFromProperty(PROPERTY_NAME);
}
void armarx::nav::client::ComponentPlugin::preOnConnectComponent()
{
ARMARX_TRACE;
parent<armarx::Component>().getProxyFromProperty(navigatorPrx, PROPERTY_NAME);
ARMARX_TRACE;
parent<armarx::nav::client::ComponentPluginUser>().nav = client::Navigator(navigatorPrx);
ARMARX_TRACE;
const std::string componentName = parent().getName();
parent<armarx::nav::client::ComponentPluginUser>().nav->setConfigId(componentName);
parent<armarx::nav::client::ComponentPluginUser>().navigator.setConfigId(componentName);
}
// ComponentPluginUser
armarx::nav::client::ComponentPluginUser::ComponentPluginUser()
{
ARMARX_TRACE;
addPlugin(plugin);
}
armarx::nav::client::ComponentPluginUser::~ComponentPluginUser()
= default;
armarx::nav::client::Navigator& armarx::nav::client::ComponentPluginUser::navigator()
{
ARMARX_CHECK(nav.has_value()) << "The navigator must be set!";
return nav.value();
}
......@@ -29,7 +29,7 @@ namespace armarx::nav::client
void preOnConnectComponent() override;
private:
static constexpr const char* PROPERTY_NAME = "Navigator";
static constexpr const char* PROPERTY_NAME = "nav.NavigatorName";
components::NavigatorInterfacePrx navigatorPrx;
};
......@@ -42,16 +42,13 @@ namespace armarx::nav::client
public:
ComponentPluginUser();
~ComponentPluginUser() override;
Navigator& navigator();
~ComponentPluginUser() override;
friend class ComponentPlugin;
Navigator navigator;
private:
std::optional<Navigator> nav;
ComponentPlugin* plugin = nullptr;
......
......@@ -15,6 +15,13 @@ std::vector<Eigen::Matrix4f> convert(const std::vector<armarx::nav::core::Pose>&
}
//armarx::nav::client::Navigator::Navigator(const armarx::nav::components::NavigatorInterfacePrx& navigator)
// : navigator(navigator)
//{
// // pass
//}
void
armarx::nav::client::Navigator::setConfigId(const std::string& configId)
{
......@@ -118,7 +125,3 @@ auto armarx::nav::client::Navigator::waitForWaypointNearlyReached() -> WaypointR
{
return {};
}
armarx::nav::client::Navigator::Navigator(const armarx::nav::components::NavigatorInterfacePrx& navigator)
: navigator(navigator)
{}
......@@ -40,7 +40,7 @@ namespace armarx::nav::client
public:
Navigator(const components::NavigatorInterfacePrx& navigator);
//Navigator(const components::NavigatorInterfacePrx& navigator);
void setConfigId(const std::string& configId);
......
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