Skip to content

Commit

Permalink
fix: change json value reading from dump to get<string>
Browse files Browse the repository at this point in the history
  • Loading branch information
mbsaloka committed Nov 7, 2024
1 parent 12d2944 commit 80233e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion launch/ninshiki_cpp_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
6 changes: 3 additions & 3 deletions src/ninshiki_cpp/detector/dnn_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>(getenv("HOME")) + item.value().dump();
model_path = static_cast<std::string>(getenv("HOME")) + item.value().get<std::string>();
} else if (item.key() == "config") {
config = static_cast<std::string>(getenv("HOME")) + item.value().dump();
config = static_cast<std::string>(getenv("HOME")) + item.value().get<std::string>();
} else if (item.key() == "classes") {
file_name = static_cast<std::string>(getenv("HOME")) + item.value().dump();
file_name = static_cast<std::string>(getenv("HOME")) + item.value().get<std::string>();
}
} catch (nlohmann::json::parse_error & ex) {
std::cerr << "parse error at byte " << ex.byte << std::endl;
Expand Down

0 comments on commit 80233e8

Please sign in to comment.