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

fix: Formatting.

parent ef940758
No related branches found
No related tags found
No related merge requests found
...@@ -40,147 +40,169 @@ ...@@ -40,147 +40,169 @@
#include <Navigation/libraries/factories/NavigationStackFactory.h> #include <Navigation/libraries/factories/NavigationStackFactory.h>
namespace armarx::nav::components armarx::nav::components::Navigator::Navigator() : executor{platformUnit}
{ {
}
Navigator::Navigator() : executor{platformUnit} armarx::nav::components::Navigator::~Navigator()
{ {
} }
Navigator::~Navigator()
{
}
void Navigator::onInitComponent() void
{ armarx::nav::components::Navigator::onInitComponent()
} {
}
void Navigator::onConnectComponent()
{
}
void Navigator::onDisconnectComponent() void
{ armarx::nav::components::Navigator::onConnectComponent()
} {
}
void Navigator::onExitComponent()
{
}
void Navigator::updateContext() void
{ armarx::nav::components::Navigator::onDisconnectComponent()
scene.staticScene = staticScene(); {
scene.robot = getRobot(); }
}
std::string Navigator::getDefaultName() const
{
return "Navigator";
}
std::vector<core::Pose> convert(const std::vector<Eigen::Matrix4f>& wps) void
{ armarx::nav::components::Navigator::onExitComponent()
std::vector<core::Pose> p; {
p.reserve(wps.size()); }
std::transform(wps.begin(), wps.end(), std::back_inserter(p), [](const auto & p)
{
return Eigen::Affine3f(p);
});
return p;
}
std::string
Navigator::createConfig(const aron::data::AronDictPtr& stackConfig,
const Ice::Current&)
{
// TODO: Not thread-safe.
const std::string uuid = boost::uuids::to_string(boost::uuids::random_generator()());
server::NavigationStack stack = fac::NavigationStackFactory::create(stackConfig, scene);
navigators.emplace(uuid, server::Navigator{stack, scene, executor});
return uuid; void
} armarx::nav::components::Navigator::updateContext()
{
scene.staticScene = staticScene();
scene.robot = getRobot();
}
void Navigator::moveTo(const std::vector<Eigen::Matrix4f>& waypoints,
const std::string& navigationMode,
const std::string& configId,
const Ice::Current&)
{
// TODO: Error handling.
navigators.at(configId).moveTo(convert(waypoints), core::NavigationFramesMap.from_name(navigationMode)); std::string
} armarx::nav::components::Navigator::getDefaultName() const
{
return "Navigator";
}
void Navigator::moveTowards(const Eigen::Vector3f& direction,
const std::string& navigationMode, std::vector<armarx::nav::core::Pose>
const std::string& configId, convert(const std::vector<Eigen::Matrix4f>& wps)
const Ice::Current&) {
std::vector<core::Pose> p;
p.reserve(wps.size());
std::transform(wps.begin(), wps.end(), std::back_inserter(p), [](const auto & p)
{ {
// TODO: Error handling. return Eigen::Affine3f(p);
});
return p;
}
navigators.at(configId).moveTowards(direction, core::NavigationFramesMap.from_name(navigationMode));
}
void std::string
Navigator::pauseMovement(const Ice::Current&) armarx::nav::components::Navigator::createConfig(const aron::data::AronDictPtr& stackConfig,
{ const Ice::Current&)
{
// TODO: Not thread-safe.
const std::string uuid = boost::uuids::to_string(boost::uuids::random_generator()());
} server::NavigationStack stack = fac::NavigationStackFactory::create(stackConfig, scene);
navigators.emplace(uuid, server::Navigator{stack, scene, executor});
void return uuid;
Navigator::resumeMovement(const Ice::Current&) }
{
}
armarx::PropertyDefinitionsPtr Navigator::createPropertyDefinitions() void
{ armarx::nav::components::Navigator::moveTo(const std::vector<Eigen::Matrix4f>& waypoints,
armarx::PropertyDefinitionsPtr def = const std::string& navigationMode,
new ComponentPropertyDefinitions(getConfigIdentifier()); const std::string& configId,
const Ice::Current&)
{
// TODO: Error handling.
navigators.at(configId).moveTo(convert(waypoints), core::NavigationFramesMap.from_name(navigationMode));
}
// Publish to a topic (passing the TopicListenerPrx).
// def->topic(myTopicListener);
// Subscribe to a topic (passing the topic name). void
// def->topic<PlatformUnitListener>("MyTopic"); armarx::nav::components::Navigator::moveTowards(const Eigen::Vector3f& direction,
const std::string& navigationMode,
const std::string& configId,
const Ice::Current&)
{
// TODO: Error handling.
// Use (and depend on) another component (passing the ComponentInterfacePrx). navigators.at(configId).moveTowards(direction, core::NavigationFramesMap.from_name(navigationMode));
def->component(platformUnit); }
// Add a required property.
// def->required(properties.boxLayerName, "p.box.LayerName", "Name of the box layer in ArViz.");
// Add an optionalproperty. void
// def->optional(properties.numBoxes, "p.box.Number", "Number of boxes to draw in ArViz."); armarx::nav::components::Navigator::pauseMovement(const Ice::Current&)
{
return def; }
}
core::StaticScene Navigator::staticScene()
{
core::StaticScene scene;
objpose::ObjectPoseSeq objectPoses = ObjectPoseClientPluginUser::getObjectPoses(); void
armarx::nav::components::Navigator::resumeMovement(const Ice::Current&)
{
scene.objects = util::asSceneObjects(objectPoses); }
return scene;
}
VirtualRobot::RobotPtr Navigator::getRobot() armarx::PropertyDefinitionsPtr
{ armarx::nav::components::Navigator::createPropertyDefinitions()
auto robot = RemoteRobot::createLocalCloneFromFile( {
getRobotStateComponent(), VirtualRobot::RobotIO::RobotDescription::eFull); armarx::PropertyDefinitionsPtr def =
// auto robot = RemoteRobot::createLocalClone(getRobotStateComponent()); new ComponentPropertyDefinitions(getConfigIdentifier());
ARMARX_CHECK_NOT_NULL(robot);
// Publish to a topic (passing the TopicListenerPrx).
// def->topic(myTopicListener);
// Subscribe to a topic (passing the topic name).
// def->topic<PlatformUnitListener>("MyTopic");
// Use (and depend on) another component (passing the ComponentInterfacePrx).
def->component(platformUnit);
// ARMARX_INFO << "Resetting robot"; // Add a required property.
// robot = VirtualRobot::RobotIO::loadRobot(robot->getFilename()); // def->required(properties.boxLayerName, "p.box.LayerName", "Name of the box layer in ArViz.");
// Add an optionalproperty.
// def->optional(properties.numBoxes, "p.box.Number", "Number of boxes to draw in ArViz.");
return def;
}
armarx::nav::core::StaticScene
armarx::nav::components::Navigator::staticScene()
{
core::StaticScene scene;
objpose::ObjectPoseSeq objectPoses = ObjectPoseClientPluginUser::getObjectPoses();
scene.objects = util::asSceneObjects(objectPoses);
return scene;
}
VirtualRobot::RobotPtr
armarx::nav::components::Navigator::getRobot()
{
auto robot = RemoteRobot::createLocalCloneFromFile(
getRobotStateComponent(), VirtualRobot::RobotIO::RobotDescription::eFull);
// auto robot = RemoteRobot::createLocalClone(getRobotStateComponent());
ARMARX_CHECK_NOT_NULL(robot);
RemoteRobot::synchronizeLocalClone(robot, getRobotStateComponent()); // ARMARX_INFO << "Resetting robot";
// robot = VirtualRobot::RobotIO::loadRobot(robot->getFilename());
return robot; RemoteRobot::synchronizeLocalClone(robot, getRobotStateComponent());
}
} // namespace armarx::nav::components return robot;
}
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