Skip to content
Snippets Groups Projects
Commit 71a2e891 authored by Fabian Reister's avatar Fabian Reister
Browse files

update

parent c3ba41a5
No related branches found
No related tags found
No related merge requests found
Showing
with 286 additions and 22 deletions
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
// #include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h> // #include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>
namespace armarx namespace armarx::nav::components
{ {
/** /**
...@@ -142,4 +142,9 @@ namespace armarx ...@@ -142,4 +142,9 @@ namespace armarx
}; };
} // namespace armarx::nav::components
namespace armarx::nav
{
using NavigatorComponent = components::Navigator;
} }
...@@ -6,4 +6,5 @@ add_subdirectory(trajectory_control) ...@@ -6,4 +6,5 @@ add_subdirectory(trajectory_control)
add_subdirectory(client) add_subdirectory(client)
add_subdirectory(algorithms) add_subdirectory(algorithms)
add_subdirectory(factories) add_subdirectory(factories)
add_subdirectory(safety_control) add_subdirectory(safety_control)
\ No newline at end of file add_subdirectory(server)
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace armarx::nav::client namespace armarx::nav::client
{ {
aron::data::AronDictPtr NavigatorConfig::toAron() const aron::data::AronDictPtr NavigationStackConfig::toAron() const
{ {
return dict.toAronDictPtr(); return dict.toAronDictPtr();
} }
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <memory> #include <memory>
#include <SimoxUtility/meta/enum/EnumNames.hpp>
#include "RobotAPI/libraries/aron/core/navigator/data/NavigatorFactory.h" #include "RobotAPI/libraries/aron/core/navigator/data/NavigatorFactory.h"
#include "RobotAPI/libraries/aron/core/navigator/data/primitive/String.h" #include "RobotAPI/libraries/aron/core/navigator/data/primitive/String.h"
#include <RobotAPI/interface/aron/Aron.h> #include <RobotAPI/interface/aron/Aron.h>
...@@ -36,12 +38,15 @@ namespace armarx::nav::client ...@@ -36,12 +38,15 @@ namespace armarx::nav::client
const std::string NAME_KEY = "name"; const std::string NAME_KEY = "name";
const std::string PARAMS_KEY = "params"; const std::string PARAMS_KEY = "params";
enum class GlobalPlannerAlgorithm enum class GlobalPlannerAlgorithms
{ {
AStar AStar
// TODO extend // TODO extend
}; };
simox::meta::EnumNames<GlobalPlannerAlgorithms> GlobalPlannerAlgorithmNames{
{GlobalPlannerAlgorithms::AStar, "AStar"}};
class GlobalPlanner class GlobalPlanner
{ {
}; };
...@@ -50,15 +55,15 @@ namespace armarx::nav::client ...@@ -50,15 +55,15 @@ namespace armarx::nav::client
struct GlobalPlannerParams struct GlobalPlannerParams
{ {
virtual GlobalPlannerAlgorithm algorithm() const = 0; virtual GlobalPlannerAlgorithms algorithm() const = 0;
virtual aron::datanavigator::DictNavigatorPtr toAron() const = 0; virtual aron::datanavigator::DictNavigatorPtr toAron() const = 0;
}; };
struct AStarParams : public GlobalPlannerParams struct AStarParams : public GlobalPlannerParams
{ {
GlobalPlannerAlgorithm algorithm() const override GlobalPlannerAlgorithms algorithm() const override
{ {
return GlobalPlannerAlgorithm::AStar; return GlobalPlannerAlgorithms::AStar;
} }
aron::datanavigator::DictNavigatorPtr toAron() const override aron::datanavigator::DictNavigatorPtr toAron() const override
...@@ -75,7 +80,12 @@ namespace armarx::nav::client ...@@ -75,7 +80,12 @@ namespace armarx::nav::client
class AStar : public GlobalPlanner class AStar : public GlobalPlanner
{ {
public: public:
AStar(const AStarParams& params) : params(params)
{
}
// const static GlobalPlannerAlgorithm Algo = GlobalPlannerAlgorithm::AStar; // const static GlobalPlannerAlgorithm Algo = GlobalPlannerAlgorithm::AStar;
AStarParams params;
}; };
class Factory class Factory
...@@ -85,28 +95,33 @@ namespace armarx::nav::client ...@@ -85,28 +95,33 @@ namespace armarx::nav::client
const aron::datanavigator::DictNavigatorPtr dict = const aron::datanavigator::DictNavigatorPtr dict =
aron::datanavigator::DictNavigator::FromAronDictPtr(params); aron::datanavigator::DictNavigator::FromAronDictPtr(params);
GlobalPlannerAlgorithm algo; // TODO from params / dict GlobalPlannerAlgorithms algo; // TODO from params / dict
aron::datanavigator::DictNavigatorPtr algoParams =
aron::datanavigator::DictNavigator::DynamicCast(dict->getElement(PARAMS_KEY));
GlobalPlannerPtr globalPlanner; GlobalPlannerPtr globalPlanner;
switch (algo) switch (algo)
{ {
case GlobalPlannerAlgorithm::AStar: case GlobalPlannerAlgorithms::AStar:
globalPlanner = std::make_shared<AStar>(AStarParams::FromAron(dict->getElement(PARAMS_KEY))); globalPlanner = std::make_shared<AStar>(AStarParams::FromAron(algoParams));
} }
return globalPlanner;
} }
}; };
class NavigatorConfig class NavigationStackConfig
{ {
public: public:
NavigatorConfig() = default; NavigationStackConfig() = default;
NavigatorConfig& setGlobalPlanner(const GlobalPlannerParams& params) NavigationStackConfig& configureGlobalPlanner(const GlobalPlannerParams& params)
{ {
aron::datanavigator::DictNavigatorPtr element(new aron::datanavigator::DictNavigator); aron::datanavigator::DictNavigatorPtr element(new aron::datanavigator::DictNavigator);
element->addElement( element->addElement(NAME_KEY,
NAME_KEY, std::make_shared<aron::datanavigator::StringNavigator>(params.name())); std::make_shared<aron::datanavigator::StringNavigator>(
GlobalPlannerAlgorithmNames.to_name(params.algorithm())));
element->addElement(PARAMS_KEY, params.toAron()); element->addElement(PARAMS_KEY, params.toAron());
dict.addElement(GLOBAL_PLANNER, element); dict.addElement(GLOBAL_PLANNER, element);
...@@ -114,12 +129,12 @@ namespace armarx::nav::client ...@@ -114,12 +129,12 @@ namespace armarx::nav::client
return *this; return *this;
} }
NavigatorConfig& setLocalPlanner(); NavigationStackConfig& configureLocalPlanner();
template <typename ParamType> template <typename ParamType>
NavigatorConfig& setTrajectoryController(); NavigationStackConfig& configureTrajectoryController();
NavigatorConfig& setSafetyController(); NavigationStackConfig& configureSafetyController();
aron::data::AronDictPtr toAron() const; aron::data::AronDictPtr toAron() const;
...@@ -127,9 +142,10 @@ namespace armarx::nav::client ...@@ -127,9 +142,10 @@ namespace armarx::nav::client
private: private:
aron::datanavigator::DictNavigator dict; aron::datanavigator::DictNavigator dict;
// TODO enum
const std::string GLOBAL_PLANNER = "global_planner"; const std::string GLOBAL_PLANNER = "global_planner";
const std::string LOCAL_PLANNER = "global_planner"; const std::string LOCAL_PLANNER = "local_planner";
const std::string TRAJECTORY_CONTROLLEr = "trajectory_controller"; const std::string TRAJECTORY_CONTROLLER = "trajectory_controller";
const std::string SAFETY_CONTROLLER = "safety_controller"; const std::string SAFETY_CONTROLLER = "safety_controller";
}; };
} // namespace armarx::nav::client } // namespace armarx::nav::client
\ No newline at end of file
...@@ -34,8 +34,34 @@ using namespace armarx::nav::client; ...@@ -34,8 +34,34 @@ using namespace armarx::nav::client;
BOOST_AUTO_TEST_CASE(testExample) BOOST_AUTO_TEST_CASE(testExample)
{ {
NavigatorConfig cfg; // create navigation stack config
cfg.setGlobalPlanner(AStarP) NavigationStackConfig cfg;
cfg.configureGlobalPlanner(AStarParams());
const auto stackConfig = cfg.toAron();
// here, we would send data over Ice ...
NavigatorPrx navigator;
navigator->moveTo(goal, stackConfig, Mode::Absolute);
navigator->moveTorwards(direction, stackConfig, Mode::Relative);
// CLIENT
////////////////////////////////////////////////
// SERVER
// create Navigator
server::NavigationStack stack = NavigationStackFactory::create(stackConfig);
server::Navigator navigator(stack);
// DirectionNavigator
// RelativePointNavigator
navigator->moveTo(goal);
BOOST_CHECK_EQUAL(true, true); BOOST_CHECK_EQUAL(true, true);
......
set(LIB_NAME server)
armarx_component_set_name("${LIB_NAME}")
armarx_set_target("Library: ${LIB_NAME}")
armarx_add_library(
LIBS
ArmarXCoreInterfaces
ArmarXCore
SOURCES
./server.cpp
HEADERS
./server.h
)
add_library(Navigation::server ALIAS server)
#find_package(MyLib QUIET)
#armarx_build_if(MyLib_FOUND "MyLib not available")
# all target_include_directories must be guarded by if(Xyz_FOUND)
# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
#if(MyLib_FOUND)
# target_include_directories(server PUBLIC ${MyLib_INCLUDE_DIRS})
#endif()
# add unit tests
add_subdirectory(test)
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include "Navigation/libraries/global_planning/GlobalPlanner.h"
#include "Navigation/libraries/local_planning/LocalPlanner.h"
#include "Navigation/libraries/trajectory_control/TrajectoryControl.h"
#include "Navigation/libraries/safety_control/SafetyControl.h
namespace armarx::nav::server
{
class NavigationStack
{
public:
protected:
private:
};
} // namespace armarx::nav::server
\ No newline at end of file
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
namespace armarx::nav::server
{
class Navigator
{
public:
protected:
private:
};
} // namespace armarx::nav::server
\ No newline at end of file
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package Navigation::ArmarXObjects::server
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "server.h"
namespace armarx
{
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package Navigation::ArmarXObjects::server
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
namespace armarx
{
/**
* @defgroup Library-server server
* @ingroup Navigation
* A description of the library server.
*
* @class server
* @ingroup Library-server
* @brief Brief description of class server.
*
* Detailed description of class server.
*/
class server
{
public:
};
}
# Libs required for the tests
SET(LIBS ${LIBS} ArmarXCore server)
armarx_add_test(serverTest serverTest.cpp "${LIBS}")
\ No newline at end of file
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package Navigation::ArmarXObjects::server
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#define BOOST_TEST_MODULE Navigation::ArmarXLibraries::server
#define ARMARX_BOOST_TEST
#include <Navigation/Test.h>
#include "../server.h"
#include <iostream>
BOOST_AUTO_TEST_CASE(testExample)
{
BOOST_CHECK_EQUAL(true, true);
}
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