问题如题目所述,程序运行完后,总是停在界面:

[xxx_node-2]  process has finished cleanly
log file: xxxx.log

在代码加上ros::shutdown()也不会自动退出。必须手动Ctrl-C,才能退出。

原因出在.launch文件中,需要在<node>中增加语句required="true"。这样程序运行完毕,可以自动退出。

推广:与之相反,如果想要ROS程序中断退出后能自动重启,则应增加语句respawn="true"。其与required="true"只能二选一,出现在.launch文件中。

参考:
https://answers.ros.org/question/124721/roslaunch-does-not-exit-after-processes-finish/
http://wiki.ros.org/roslaunch/XML/node

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐