diff --git a/src/ros.cpp b/src/ros.cpp index 4917f4d44445db04f1816be4aff86fd3132ec73e..8255cf4afca3f95ce21bb805cb5af451a8fd3774 100644 --- a/src/ros.cpp +++ b/src/ros.cpp @@ -7,14 +7,24 @@ * @date 2019-05-22 */ +/// Standard includes #include <deque> #include <atomic> #include <fstream> #include <chrono> #include <thread> +/// ROS2 includes +#include <rclcpp/executor.hpp> + +/// Dynamic Bridge include #include "dynamic_graph_bridge/ros.hpp" +#ifdef __APPLE__ +#include <mach-o/dyld.h> +#include <sys/param.h> +#endif + namespace dynamic_graph_bridge { /* @@ -49,7 +59,7 @@ static GlobalListOfRosNodeType GLOBAL_LIST_OF_ROS_NODE; class Executor { public: - Executor() : ros_executor_(rclcpp::executor::ExecutorArgs(), 4) + Executor() : ros_executor_(rclcpp::ExecutorOptions(), 4) { is_thread_running_ = false; is_spinning_ = false; @@ -189,7 +199,7 @@ ExecutorPtr EXECUTOR = nullptr; /** * @brief Private function that allow us to get the current executable name. * - * @return std::string the current executable name. + * @Return std::string the current executable name. */ std::string executable_name() { @@ -206,6 +216,11 @@ std::string executable_name() GetModuleFileNameA(nullptr, buf, MAX_PATH); return buf; +#elif defined(__APPLE__) + uint32_t buf_length=MAXPATHLEN; + char buf[MAXPATHLEN]; + _NSGetExecutablePath(buf,&buf_length); + return buf; #else static_assert(false, "unrecognized platform");