From 80233e81d735fcad91502cc9ce6b9f3aebdc9454 Mon Sep 17 00:00:00 2001 From: mbsaloka Date: Thu, 7 Nov 2024 19:47:20 +0700 Subject: [PATCH] fix: change json value reading from dump to get --- launch/ninshiki_cpp_launch.py | 2 +- src/ninshiki_cpp/detector/dnn_detector.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launch/ninshiki_cpp_launch.py b/launch/ninshiki_cpp_launch.py index 67df25f..43e0f9f 100644 --- a/launch/ninshiki_cpp_launch.py +++ b/launch/ninshiki_cpp_launch.py @@ -25,7 +25,7 @@ def generate_launch_description(): hostname = socket.gethostname() - ninshiki_config_path = os.path.expanduser(f'~/ros2-ws/configuration/{hostname}/color_classifier/') + ninshiki_config_path = os.path.expanduser(f'~/ros2-ws/configuration/{hostname}/detection/') shisen_config_path = os.path.expanduser(f'~/ros2-ws/configuration/{hostname}/camera/') return LaunchDescription([ diff --git a/src/ninshiki_cpp/detector/dnn_detector.cpp b/src/ninshiki_cpp/detector/dnn_detector.cpp index dfdcda5..37afd31 100644 --- a/src/ninshiki_cpp/detector/dnn_detector.cpp +++ b/src/ninshiki_cpp/detector/dnn_detector.cpp @@ -51,11 +51,11 @@ void DnnDetector::load_configuration(const std::string & path) for (auto & item : dnn_config.items()) { try { if (item.key() == "model") { - model_path = static_cast(getenv("HOME")) + item.value().dump(); + model_path = static_cast(getenv("HOME")) + item.value().get(); } else if (item.key() == "config") { - config = static_cast(getenv("HOME")) + item.value().dump(); + config = static_cast(getenv("HOME")) + item.value().get(); } else if (item.key() == "classes") { - file_name = static_cast(getenv("HOME")) + item.value().dump(); + file_name = static_cast(getenv("HOME")) + item.value().get(); } } catch (nlohmann::json::parse_error & ex) { std::cerr << "parse error at byte " << ex.byte << std::endl;