ノードを実行、停止を管理するプログラムを作成しようと考えています。しかし、プログラム中で実行中のノードの名前を取得する方法がわからず、popenでrosnode listを実行し無理やり取得するという方法をとっています。
他に適当な方法があれば教えていただきたいです。
rosnode listもプログラムなので、ソースおっていけばいいかと思います。
rosnode.get_node_namesあたりになると思います。"/rosnode" IDでmasterにnode listを貰いに行っているだけですね。
あと、discourseはディスカッションの場なので、interfaceやapiなどの質問関連はROS Answerの方が適切だと思いますので、そちらで聞いたほうがいいと思います。
Does rosmon do what you want? http://wiki.ros.org/rosmon
コマンドのソースを見るのは盲点でした.参考にさせていただきます.
discourseはディスカッションの場なので、interfaceやapiなどの質問関連はROS Answer の方が適切だと思いますので、そちらで聞いたほうがいいと思います。
わかりました.ご指摘いただきありがとうございます.
I’m planning to execute “rosrun” and “roslaunch”, and kill rosnode using GUI buttons. So rosmon may not be appropriate. However I didn’t know the app, thank you for valuable information.
That is exactly what rosmon is for. I have done exactly that. I will try to send you some screenshots of it.
Really? Looking forward to it.
I have uploaded two images here - one shows the information being displayed on the console, and one is the information being displayed in a webbrowser.
And I have started writing it up on my blog:
https://johnflux.com/2020/01/07/robot-face/
To start/stop a node via a gui, just have it send a service command, like:
rosservice call /rosmon/start_stop “joy_drive” “” 2
The number is: start (1), stop (2), or restart (3)
(Btw, I am in Tokyo, and I’m available for hire)
I put some code up here: https://github.com/johnflux/RobotOSHelpers
Thank you for your kind explanation! I will see the blog and repository and refer to it.