28: packageName_(packageName), launchFileName_(launchFilename), cancellationToken_(false)
43 std::string packageName, std::string launchFileName, std::function<
bool()> cancelCondition)
50 rclcpp::get_logger(
"smacc2"),
"[ClRosLaunch static] starting ros launch thread ");
52 std::stringstream cmd;
53 cmd <<
"ros2 launch " << packageName <<
" " << launchFileName;
55 std::array<char, 128> buffer;
57 std::unique_ptr<FILE,
decltype(&pclose)> pipe(popen(cmd.str().c_str(),
"r"), pclose);
60 throw std::runtime_error(
"popen() failed!");
64 bool cancelled =
false;
65 while (fgets(buffer.data(), buffer.size(), pipe.get()) !=
nullptr &&
66 !(cancelled = cancelCondition()))
73 rclcpp::get_logger(
"smacc2"),
"[ClRosLaunch static]] RESULT = \n " << ss.str());
std::atomic< bool > cancellationToken_
ClRosLaunch(std::string packageName, std::string launchFilename)
std::string launchFileName_
static std::future< std::string > executeRosLaunch(std::string packageName, std::string launchFilename, std::function< bool()> cancelCondition)
std::future< std::string > result_