Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for PhotoAtWaypoint plugin #2067

Merged
merged 14 commits into from
Nov 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions nav2_waypoint_follower/plugins/photo_at_waypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,29 @@ void PhotoAtWaypoint::initialize(

// get inputted save directory and make sure it exists, if not log and create it
save_dir_ = save_dir_as_string;
if (!std::experimental::filesystem::exists(save_dir_)) {
RCLCPP_WARN(
logger_,
"Provided save directory for photo at waypoint plugin does not exist,"
"provided directory is: %s, the directory will be created automatically.",
save_dir_.c_str()
);
if (!std::experimental::filesystem::create_directory(save_dir_)) {
RCLCPP_ERROR(
try {
if (!std::experimental::filesystem::exists(save_dir_)) {
RCLCPP_WARN(
logger_,
"Failed to create directory!: %s required by photo at waypoint plugin, "
"exiting the plugin with failure!",
"Provided save directory for photo at waypoint plugin does not exist,"
"provided directory is: %s, the directory will be created automatically.",
save_dir_.c_str()
);
is_enabled_ = false;
if (!std::experimental::filesystem::create_directory(save_dir_)) {
RCLCPP_ERROR(
logger_,
"Failed to create directory!: %s required by photo at waypoint plugin, "
"exiting the plugin with failure!",
save_dir_.c_str()
);
is_enabled_ = false;
}
}
} catch (const std::exception & e) {
RCLCPP_ERROR(
SteveMacenski marked this conversation as resolved.
Show resolved Hide resolved
logger_, "Exception (%s) thrown while attempting to create image capture directory."
" This task executor is being disabled as it cannot save images.", e.what());
is_enabled_ = false;
}

if (!is_enabled_) {
Expand Down