【发布时间】:2016-05-26 11:52:29
【问题描述】:
我正在使用 ROS 并尝试将 Poco Process 集成到 ROS QT 接口中进行流程管理。
这是我的节点到目前为止的样子:
void My_Interface::gazebo_launch_world()
{
std::string command = "roslaunch";
std::vector<std::string> args;
args.push_back("robot_gazebo");
args.push_back("robot_gazebo.launch");
PocoProcess pp(command, args);
pp.run();
}
int PocoProcess::run()
{
int rc;
try
{
Poco::Pipe outPipe;
Poco::ProcessHandle ph = Poco::Process::launch(command_, args_, 0, &outPipe, 0);
rc = ph.id();
Poco::PipeInputStream istr(outPipe);
Poco::StreamCopier::copyStream(istr, std::cout);
}
catch (Poco::SystemException& exc)
{
std::cout << exc.displayText() << std::endl;
return (-1);
}
return rc;
}
这工作正常(启动进程),但问题是我的界面在等待进程完成时冻结,这确实是不可取的。
那么,我是否可以在后台启动 POCO 进程?
PS:(绝望地)我什至尝试了 args 向量上的“&”,但它不起作用!
谢谢,
【问题讨论】:
标签: c++ qt poco poco-libraries