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

Enable nav2-related packages on Windows #178

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
100 changes: 18 additions & 82 deletions patch/ros-humble-nav2-waypoint-follower.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
diff --git a/plugins/photo_at_waypoint.cpp b/plugins/photo_at_waypoint.cpp
index 296f8f41de..4e2858f655 100644
--- a/plugins/photo_at_waypoint.cpp
+++ b/plugins/photo_at_waypoint.cpp
@@ -119,7 +119,7 @@ bool PhotoAtWaypoint::processAtWaypoint(
std::lock_guard<std::mutex> guard(global_mutex_);
cv::Mat curr_frame_mat;
deepCopyMsg2Mat(curr_frame_msg_, curr_frame_mat);
- cv::imwrite(full_path_image_path.c_str(), curr_frame_mat);
+ cv::imwrite(full_path_image_path.string().c_str(), curr_frame_mat);
RCLCPP_INFO(
logger_,
"Photo has been taken sucessfully at waypoint %i", curr_waypoint_index);
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3b46942b..e228086fa 100644
--- a/CMakeLists.txt
Expand All @@ -11,96 +24,19 @@ index a3b46942b..e228086fa 100644
# Try for OpenCV 4.X, but settle for whatever is installed
find_package(OpenCV 4 QUIET)
if(NOT OpenCV_FOUND)
@@ -25,7 +27,11 @@ find_package(pluginlib REQUIRED)

nav2_package()

-link_libraries(stdc++fs)
+if(UNIX AND NOT APPLE)
+ link_libraries(stdc++fs)
+else()
+
+endif()

include_directories(
include

diff --git a/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp b/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp
index fc4aee5c5..a4fc67b82 100644
index 9c46fdf1f8..1e6048aefc 100644
--- a/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp
+++ b/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp
@@ -20,20 +20,22 @@
* to ignore deprecated declarations
*/
#define _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
+#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING


-#include <experimental/filesystem>
+#include <filesystem>
#include <mutex>
#include <string>
#include <exception>

+#include <opencv2/core.hpp>
+#include <opencv2/opencv.hpp>
+
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_components/register_node_macro.hpp"
@@ -32,8 +32,8 @@

#include "sensor_msgs/msg/image.hpp"
#include "nav2_core/waypoint_task_executor.hpp"
-#include "opencv4/opencv2/core.hpp"
-#include "opencv4/opencv2/opencv.hpp"
+#include "opencv2/core.hpp"
+#include "opencv2/opencv.hpp"
#include "cv_bridge/cv_bridge.h"
#include "image_transport/image_transport.hpp"

@@ -97,7 +99,7 @@ protected:
// to ensure safety when accessing global var curr_frame_
std::mutex global_mutex_;
// the taken photos will be saved under this directory
- std::experimental::filesystem::path save_dir_;
+ std::filesystem::path save_dir_;
// .png ? .jpg ? or some other well known format
std::string image_format_;
// the topic to subscribe in order capture a frame
diff --git a/plugins/photo_at_waypoint.cpp b/plugins/photo_at_waypoint.cpp
index 8a6cb74b9..4e2858f65 100644
--- a/plugins/photo_at_waypoint.cpp
+++ b/plugins/photo_at_waypoint.cpp
@@ -61,14 +61,14 @@ void PhotoAtWaypoint::initialize(
// get inputted save directory and make sure it exists, if not log and create it
save_dir_ = save_dir_as_string;
try {
- if (!std::experimental::filesystem::exists(save_dir_)) {
+ if (!std::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_)) {
+ if (!std::filesystem::create_directory(save_dir_)) {
RCLCPP_ERROR(
logger_,
"Failed to create directory!: %s required by photo at waypoint plugin, "
@@ -110,16 +110,16 @@ bool PhotoAtWaypoint::processAtWaypoint(
}
try {
// construct the full path to image filename
- std::experimental::filesystem::path file_name = std::to_string(
+ std::filesystem::path file_name = std::to_string(
curr_waypoint_index) + "_" +
std::to_string(curr_pose.header.stamp.sec) + "." + image_format_;
- std::experimental::filesystem::path full_path_image_path = save_dir_ / file_name;
+ std::filesystem::path full_path_image_path = save_dir_ / file_name;

// save the taken photo at this waypoint to given directory
std::lock_guard<std::mutex> guard(global_mutex_);
cv::Mat curr_frame_mat;
deepCopyMsg2Mat(curr_frame_msg_, curr_frame_mat);
- cv::imwrite(full_path_image_path.c_str(), curr_frame_mat);
+ cv::imwrite(full_path_image_path.string().c_str(), curr_frame_mat);
RCLCPP_INFO(
logger_,
"Photo has been taken sucessfully at waypoint %i", curr_waypoint_index);
10 changes: 5 additions & 5 deletions vinca_win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ packages_select_by_deps:
- ros2-controllers-test-nodes
- joint-state-publisher-gui

# Nav2
- slam-toolbox
- nav2-bringup

# PREVIOUSLY SUPPORTED PACKAGES, CURRENTLY BROKEN
# Currently has upstream issues with git LFS
# - moveit
# Broken for now until we migrate to newer gazebo
# - desktop_full

# REQUESTED PACKAGES
# Fails due to not finding csparse, could borrow patch from mrpt2
# - slam-toolbox
# Needs slam-toolbox
# - nav2-bringup


patch_dir: patch
Loading