diff --git a/tesseract_examples/src/basic_cartesian_example.cpp b/tesseract_examples/src/basic_cartesian_example.cpp index 7b12ded29c..e4dd30a0ac 100644 --- a/tesseract_examples/src/basic_cartesian_example.cpp +++ b/tesseract_examples/src/basic_cartesian_example.cpp @@ -178,7 +178,7 @@ bool BasicCartesianExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("cartesian_program", ManipulatorInfo("manipulator", "base_link", "tool0")); diff --git a/tesseract_examples/src/car_seat_example.cpp b/tesseract_examples/src/car_seat_example.cpp index 42c5a09fcd..087172cf0b 100644 --- a/tesseract_examples/src/car_seat_example.cpp +++ b/tesseract_examples/src/car_seat_example.cpp @@ -250,7 +250,7 @@ bool CarSeatExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Get manipulator JointGroup::ConstPtr joint_group = env_->getJointGroup("manipulator"); diff --git a/tesseract_examples/src/freespace_hybrid_example.cpp b/tesseract_examples/src/freespace_hybrid_example.cpp index 6607e9eefc..df40eebfc9 100644 --- a/tesseract_examples/src/freespace_hybrid_example.cpp +++ b/tesseract_examples/src/freespace_hybrid_example.cpp @@ -164,7 +164,7 @@ bool FreespaceHybridExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("FREESPACE", ManipulatorInfo("manipulator", "base_link", "tool0")); diff --git a/tesseract_examples/src/freespace_ompl_example.cpp b/tesseract_examples/src/freespace_ompl_example.cpp index 3f0eff5535..3ac831f745 100644 --- a/tesseract_examples/src/freespace_ompl_example.cpp +++ b/tesseract_examples/src/freespace_ompl_example.cpp @@ -150,7 +150,7 @@ bool FreespaceOMPLExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("FREESPACE", ManipulatorInfo("manipulator", "base_link", "tool0")); diff --git a/tesseract_examples/src/glass_upright_example.cpp b/tesseract_examples/src/glass_upright_example.cpp index 9bc14af4cd..b4c7ce5560 100644 --- a/tesseract_examples/src/glass_upright_example.cpp +++ b/tesseract_examples/src/glass_upright_example.cpp @@ -166,7 +166,7 @@ bool GlassUprightExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("UPRIGHT", ManipulatorInfo("manipulator", "base_link", "tool0")); diff --git a/tesseract_examples/src/pick_and_place_example.cpp b/tesseract_examples/src/pick_and_place_example.cpp index 547158ecf9..91754ce363 100644 --- a/tesseract_examples/src/pick_and_place_example.cpp +++ b/tesseract_examples/src/pick_and_place_example.cpp @@ -181,7 +181,7 @@ bool PickAndPlaceExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction pick_program("DEFAULT", ManipulatorInfo("manipulator", LINK_BASE_NAME, LINK_END_EFFECTOR_NAME)); diff --git a/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp b/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp index 8df6dcc160..707f234eef 100644 --- a/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp +++ b/tesseract_examples/src/puzzle_piece_auxillary_axes_example.cpp @@ -200,7 +200,7 @@ bool PuzzlePieceAuxillaryAxesExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("DEFAULT", mi); diff --git a/tesseract_examples/src/puzzle_piece_example.cpp b/tesseract_examples/src/puzzle_piece_example.cpp index a969e1b923..1847dc73e5 100644 --- a/tesseract_examples/src/puzzle_piece_example.cpp +++ b/tesseract_examples/src/puzzle_piece_example.cpp @@ -194,7 +194,7 @@ bool PuzzlePieceExample::run() // Create Task Composer Plugin Factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *env_->getResourceLocator()); // Create Program CompositeInstruction program("DEFAULT", mi); diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h index 69ac800335..f49183b030 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h @@ -113,19 +113,19 @@ class TaskComposerPluginFactory * @brief Load plugins from yaml node * @param config The config node */ - TaskComposerPluginFactory(const YAML::Node& config); + TaskComposerPluginFactory(const YAML::Node& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from file path * @param config The config file path */ - TaskComposerPluginFactory(const tesseract_common::fs::path& config); + TaskComposerPluginFactory(const tesseract_common::fs::path& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from string * @param config The config string */ - TaskComposerPluginFactory(const std::string& config); + TaskComposerPluginFactory(const std::string& config, const tesseract_common::ResourceLocator& locator); /** * @brief Loads plugins from a configuration object @@ -137,19 +137,19 @@ class TaskComposerPluginFactory * @brief Load plugins from yaml node * @param config The config node */ - void loadConfig(const YAML::Node& config); + void loadConfig(const YAML::Node& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from file path * @param config The config file path */ - void loadConfig(const tesseract_common::fs::path& config); + void loadConfig(const tesseract_common::fs::path& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from string * @param config The config string */ - void loadConfig(const std::string& config); + void loadConfig(const std::string& config, const tesseract_common::ResourceLocator& locator); /** * @brief Add location for the plugin loader to search @@ -307,6 +307,8 @@ class TaskComposerPluginFactory private: struct Implementation; std::unique_ptr impl_; + + void loadConfig(const YAML::Node& config); }; } // namespace tesseract_planning #endif // TESSERACT_TASK_COMPOSER_TASK_COMPOSER_FACTORY_H diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_server.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_server.h index 6db07981b3..1d7b680a80 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_server.h +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_server.h @@ -32,6 +32,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include TESSERACT_COMMON_IGNORE_WARNINGS_POP +#include #include namespace YAML @@ -62,19 +63,19 @@ class TaskComposerServer * @brief Load plugins from yaml node * @param config The config node */ - void loadConfig(const YAML::Node& config); + void loadConfig(const YAML::Node& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from file path * @param config The config file path */ - void loadConfig(const tesseract_common::fs::path& config); + void loadConfig(const tesseract_common::fs::path& config, const tesseract_common::ResourceLocator& locator); /** * @brief Load plugins from string * @param config The config string */ - void loadConfig(const std::string& config); + void loadConfig(const std::string& config, const tesseract_common::ResourceLocator& locator); /** * @brief Add a executors (thread pool) diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/test_suite/task_composer_executor_unit.hpp b/tesseract_task_composer/core/include/tesseract_task_composer/core/test_suite/task_composer_executor_unit.hpp index 76d53179c3..7e4b2db3de 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/test_suite/task_composer_executor_unit.hpp +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/test_suite/task_composer_executor_unit.hpp @@ -40,6 +40,9 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include +#include +#include + namespace tesseract_planning::test_suite { template @@ -78,6 +81,7 @@ void runTaskComposerExecutorTest() test_suite::runSerializationPointerTest(executor, "TaskComposerExecutorTests"); } + tesseract_common::GeneralResourceLocator locator; std::string str = R"(task_composer_plugins: search_paths: - /usr/local/lib @@ -154,7 +158,7 @@ void runTaskComposerExecutorTest() destinations: [AbortTask, DoneTask] terminals: [AbortTask, DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); { // Pipeline std::string str2 = R"(config: diff --git a/tesseract_task_composer/core/src/task_composer_plugin_factory.cpp b/tesseract_task_composer/core/src/task_composer_plugin_factory.cpp index 27773ad2a6..530a4402bd 100644 --- a/tesseract_task_composer/core/src/task_composer_plugin_factory.cpp +++ b/tesseract_task_composer/core/src/task_composer_plugin_factory.cpp @@ -30,6 +30,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include TESSERACT_COMMON_IGNORE_WARNINGS_POP +#include #include #include #include @@ -73,20 +74,25 @@ TaskComposerPluginFactory::TaskComposerPluginFactory(const tesseract_common::Tas loadConfig(config); } -TaskComposerPluginFactory::TaskComposerPluginFactory(const YAML::Node& config) : TaskComposerPluginFactory() +TaskComposerPluginFactory::TaskComposerPluginFactory(const YAML::Node& config, + const tesseract_common::ResourceLocator& locator) + : TaskComposerPluginFactory() { - loadConfig(config); + loadConfig(config, locator); } -TaskComposerPluginFactory::TaskComposerPluginFactory(const tesseract_common::fs::path& config) +TaskComposerPluginFactory::TaskComposerPluginFactory(const tesseract_common::fs::path& config, + const tesseract_common::ResourceLocator& locator) : TaskComposerPluginFactory() { - loadConfig(config); + loadConfig(config, locator); } -TaskComposerPluginFactory::TaskComposerPluginFactory(const std::string& config) : TaskComposerPluginFactory() +TaskComposerPluginFactory::TaskComposerPluginFactory(const std::string& config, + const tesseract_common::ResourceLocator& locator) + : TaskComposerPluginFactory() { - loadConfig(config); + loadConfig(config, locator); } // This prevents it from being defined inline. @@ -120,12 +126,21 @@ void TaskComposerPluginFactory::loadConfig(const YAML::Node& config) } } -void TaskComposerPluginFactory::loadConfig(const tesseract_common::fs::path& config) +void TaskComposerPluginFactory::loadConfig(const YAML::Node& config, const tesseract_common::ResourceLocator& locator) { - loadConfig(YAML::LoadFile(config.string())); + loadConfig(tesseract_common::processYamlIncludeDirective(config, locator)); } -void TaskComposerPluginFactory::loadConfig(const std::string& config) { loadConfig(YAML::Load(config)); } +void TaskComposerPluginFactory::loadConfig(const tesseract_common::fs::path& config, + const tesseract_common::ResourceLocator& locator) +{ + loadConfig(tesseract_common::loadYamlFile(config.string(), locator)); +} + +void TaskComposerPluginFactory::loadConfig(const std::string& config, const tesseract_common::ResourceLocator& locator) +{ + loadConfig(tesseract_common::loadYamlString(config, locator)); +} void TaskComposerPluginFactory::addSearchPath(const std::string& path) { diff --git a/tesseract_task_composer/core/src/task_composer_server.cpp b/tesseract_task_composer/core/src/task_composer_server.cpp index a414865491..67dd471177 100644 --- a/tesseract_task_composer/core/src/task_composer_server.cpp +++ b/tesseract_task_composer/core/src/task_composer_server.cpp @@ -36,26 +36,28 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include #include +#include namespace tesseract_planning { TaskComposerServer::TaskComposerServer() : plugin_factory_(std::make_shared()) {} -void TaskComposerServer::loadConfig(const YAML::Node& config) +void TaskComposerServer::loadConfig(const YAML::Node& config, const tesseract_common::ResourceLocator& locator) { - plugin_factory_->loadConfig(config); + plugin_factory_->loadConfig(config, locator); loadPlugins(); } -void TaskComposerServer::loadConfig(const tesseract_common::fs::path& config) +void TaskComposerServer::loadConfig(const tesseract_common::fs::path& config, + const tesseract_common::ResourceLocator& locator) { - plugin_factory_->loadConfig(config); + plugin_factory_->loadConfig(config, locator); loadPlugins(); } -void TaskComposerServer::loadConfig(const std::string& config) +void TaskComposerServer::loadConfig(const std::string& config, const tesseract_common::ResourceLocator& locator) { - plugin_factory_->loadConfig(config); + plugin_factory_->loadConfig(config, locator); loadPlugins(); } diff --git a/tesseract_task_composer/examples/task_composer_example.cpp b/tesseract_task_composer/examples/task_composer_example.cpp index 454cb593d4..18ad703305 100644 --- a/tesseract_task_composer/examples/task_composer_example.cpp +++ b/tesseract_task_composer/examples/task_composer_example.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -124,8 +125,9 @@ int main() task_composer.addEdges(task2_id, { task3_id }); const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); + tesseract_common::GeneralResourceLocator locator; tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, locator); auto task_executor = factory.createTaskComposerExecutor("TaskflowExecutor"); TaskComposerFuture::UPtr future = task_executor->run(task_composer, std::move(task_data)); diff --git a/tesseract_task_composer/examples/task_composer_raster_example.cpp b/tesseract_task_composer/examples/task_composer_raster_example.cpp index 1302fc9c93..323e4065ec 100644 --- a/tesseract_task_composer/examples/task_composer_raster_example.cpp +++ b/tesseract_task_composer/examples/task_composer_raster_example.cpp @@ -52,7 +52,7 @@ int main() // Get plugin factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *locator); // Create raster task TaskComposerNode::UPtr task = factory.createTaskComposerNode("RasterFtPipeline"); diff --git a/tesseract_task_composer/examples/task_composer_trajopt_example.cpp b/tesseract_task_composer/examples/task_composer_trajopt_example.cpp index 764eb0148a..9e5c1a2eae 100644 --- a/tesseract_task_composer/examples/task_composer_trajopt_example.cpp +++ b/tesseract_task_composer/examples/task_composer_trajopt_example.cpp @@ -16,6 +16,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include +#include #include #include #include @@ -53,7 +54,7 @@ int main() // Get plugin factory const std::string share_dir(TESSERACT_TASK_COMPOSER_DIR); tesseract_common::fs::path config_path(share_dir + "/config/task_composer_plugins.yaml"); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, *locator); // Create trajopt pipeline TaskComposerNode::UPtr task = factory.createTaskComposerNode("TrajOptPipeline"); diff --git a/tesseract_task_composer/test/tesseract_task_composer_core_unit.cpp b/tesseract_task_composer/test/tesseract_task_composer_core_unit.cpp index e4dd7d2411..179dae4a39 100644 --- a/tesseract_task_composer/test/tesseract_task_composer_core_unit.cpp +++ b/tesseract_task_composer/test/tesseract_task_composer_core_unit.cpp @@ -29,6 +29,8 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include +#include + TESSERACT_ANY_EXPORT(tesseract_common::JointState, TesseractCommonJointState) using namespace tesseract_planning; @@ -401,6 +403,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerTaskTests) // NOLINT TEST(TesseractTaskComposerCoreUnit, TaskComposerPipelineTests) // NOLINT { + tesseract_common::GeneralResourceLocator locator; std::string name = "TaskComposerPipelineTests"; std::string name1 = "TaskComposerPipelineTests1"; std::string name2 = "TaskComposerPipelineTests2"; @@ -928,7 +931,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerPipelineTests) // NOLINT destinations: [DoneTask] terminals: [DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); std::string str2 = R"(config: conditional: true @@ -1326,6 +1329,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerPipelineTests) // NOLINT // Graph is mostly tested through the Pipeline tests becasue they can be run TEST(TesseractTaskComposerCoreUnit, TaskComposerGraphTests) // NOLINT { + tesseract_common::GeneralResourceLocator locator; std::string name{ "TaskComposerGraphTests" }; auto graph = std::make_unique(name); EXPECT_EQ(graph->getName(), name); @@ -1412,7 +1416,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerGraphTests) // NOLINT destinations: [DoneTask] terminals: [DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); std::string str2 = R"(config: conditional: true @@ -1464,7 +1468,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerGraphTests) // NOLINT destinations: [DoneTask] terminals: [DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); std::string str2 = R"(config: conditional: true @@ -1527,7 +1531,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerGraphTests) // NOLINT destinations: [ErrorTask, DoneTask] terminals: [ErrorTask, DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); std::string str2 = R"(config: conditional: true @@ -1594,7 +1598,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerGraphTests) // NOLINT destinations: [DuplicateTask] terminals: [ErrorTask, DoneTask])"; - TaskComposerPluginFactory factory(str); + TaskComposerPluginFactory factory(str, locator); std::string str2 = R"(config: conditional: true @@ -2216,6 +2220,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerHasDataStorageEntryTaskTests) / TEST(TesseractTaskComposerCoreUnit, TaskComposerServerTests) // NOLINT { + tesseract_common::GeneralResourceLocator locator; std::string str = R"(task_composer_plugins: search_paths: - /usr/local/lib @@ -2354,14 +2359,14 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerServerTests) // NOLINT { // String Constructor TaskComposerServer server; - server.loadConfig(str); + server.loadConfig(str, locator); runTest(server); } { // YAML::Node Constructor TaskComposerServer server; YAML::Node config = YAML::Load(str); - server.loadConfig(config); + server.loadConfig(config, locator); runTest(server); } @@ -2375,13 +2380,14 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerServerTests) // NOLINT } TaskComposerServer server; - server.loadConfig(file_path); + server.loadConfig(file_path, locator); runTest(server); } } TEST(TesseractTaskComposerCoreUnit, TaskComposerPipelineWithGraphChild) // NOLINT { + tesseract_common::GeneralResourceLocator locator; std::string str = R"(task_composer_plugins: search_paths: - /usr/local/lib @@ -2460,7 +2466,7 @@ TEST(TesseractTaskComposerCoreUnit, TaskComposerPipelineWithGraphChild) // NOLI terminals: [AbortTask, DoneTask])"; TaskComposerServer server; - server.loadConfig(str); + server.loadConfig(str, locator); // Run method using TaskComposerContext const auto& pipeline = server.getTask("TestPipeline"); diff --git a/tesseract_task_composer/test/tesseract_task_composer_planning_unit.cpp b/tesseract_task_composer/test/tesseract_task_composer_planning_unit.cpp index 2f3f6f1f4e..a079234d5c 100644 --- a/tesseract_task_composer/test/tesseract_task_composer_planning_unit.cpp +++ b/tesseract_task_composer/test/tesseract_task_composer_planning_unit.cpp @@ -2729,9 +2729,10 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerMotionPlannerTaskTests) / TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRasterMotionTaskTests) // NOLINT { + tesseract_common::GeneralResourceLocator locator; tesseract_common::fs::path config_path( locator_->locateResource("package://tesseract_task_composer/config/task_composer_plugins.yaml")->getFilePath()); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, locator); { // Construction RasterMotionTask task; @@ -3309,9 +3310,10 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRasterMotionTaskTests) // TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRasterOnlyMotionTaskTests) // NOLINT { + tesseract_common::GeneralResourceLocator locator; tesseract_common::fs::path config_path( locator_->locateResource("package://tesseract_task_composer/config/task_composer_plugins.yaml")->getFilePath()); - TaskComposerPluginFactory factory(config_path); + TaskComposerPluginFactory factory(config_path, locator); { // Construction RasterOnlyMotionTask task; diff --git a/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp b/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp index 43a9846cb1..e1c04ba542 100644 --- a/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp +++ b/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp @@ -33,6 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include #include +#include #include #include @@ -114,6 +115,7 @@ void runTaskComposerFactoryTest(TaskComposerPluginFactory& factory, YAML::Node p TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT { + tesseract_common::GeneralResourceLocator locator; { // File Path Construction #ifdef TESSERACT_TASK_COMPOSER_HAS_TRAJOPT_IFOPT tesseract_common::fs::path config_path(std::string(TESSERACT_TASK_COMPOSER_DIR) + "/config/" @@ -124,13 +126,13 @@ TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT "trajopt_" "ifopt.yaml"); #endif - TaskComposerPluginFactory factory(config_path); - YAML::Node plugin_config = YAML::LoadFile(config_path.string()); + TaskComposerPluginFactory factory(config_path, locator); + YAML::Node plugin_config = tesseract_common::loadYamlFile(config_path.string(), locator); runTaskComposerFactoryTest(factory, plugin_config); auto export_config_path = tesseract_common::fs::path(tesseract_common::getTempPath()) / "task_composer_plugins_" "export.yaml"; - TaskComposerPluginFactory check_factory(export_config_path); + TaskComposerPluginFactory check_factory(export_config_path, locator); runTaskComposerFactoryTest(check_factory, plugin_config); } @@ -145,13 +147,13 @@ TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT "ifopt.yaml"); #endif - TaskComposerPluginFactory factory(tesseract_common::fileToString(config_path)); + TaskComposerPluginFactory factory(tesseract_common::fileToString(config_path), locator); YAML::Node plugin_config = YAML::LoadFile(config_path.string()); runTaskComposerFactoryTest(factory, plugin_config); auto export_config_path = tesseract_common::fs::path(tesseract_common::getTempPath()) / "task_composer_plugins_" "export.yaml"; - TaskComposerPluginFactory check_factory(export_config_path); + TaskComposerPluginFactory check_factory(export_config_path, locator); runTaskComposerFactoryTest(check_factory, plugin_config); } @@ -167,12 +169,12 @@ TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT #endif YAML::Node plugin_config = YAML::LoadFile(config_path.string()); - TaskComposerPluginFactory factory(plugin_config); + TaskComposerPluginFactory factory(plugin_config, locator); runTaskComposerFactoryTest(factory, plugin_config); auto export_config_path = tesseract_common::fs::path(tesseract_common::getTempPath()) / "task_composer_plugins_" "export.yaml"; - TaskComposerPluginFactory check_factory(export_config_path); + TaskComposerPluginFactory check_factory(export_config_path, locator); runTaskComposerFactoryTest(check_factory, plugin_config); } @@ -205,7 +207,7 @@ TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT auto export_config_path = tesseract_common::fs::path(tesseract_common::getTempPath()) / "task_composer_plugins_" "export.yaml"; - TaskComposerPluginFactory check_factory(export_config_path); + TaskComposerPluginFactory check_factory(export_config_path, locator); runTaskComposerFactoryTest(check_factory, plugin_config); } }