Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supervisor scripts #1323

Open
wants to merge 53 commits into
base: master
Choose a base branch
from

Conversation

708yamaguchi
Copy link
Member

I add supervisor config files for jsk_fetch_startup.
Also, I add script to copy the supervisor config files under /etc/supervisor/conf.d

@k-okada
Copy link
Member

k-okada commented Feb 18, 2021

if you'd like to use supervisor for startup script, please add them in jsk_robot_common with documentation.
Also you'd better to discuss with jaxon @k-kojima @kazu-robo , kengoro @yuki-asano @haraduka , drone @chibi314 @tongtybj

@knorth55
Copy link
Member

I don't understand how we can add it to jsk robot common.
startup scripts or launch can be robot specific and cannot be common thing.
can you tell me how to do that?

@k-okada
Copy link
Member

k-okada commented Feb 18, 2021 via email

@knorth55 knorth55 force-pushed the add-supervisor-scripts branch from 400448b to 8ac8629 Compare September 19, 2021 13:15
@708yamaguchi
Copy link
Member Author

708yamaguchi commented Sep 21, 2021

Update install_supervisor.sh.
The same as #1309 (review)

$ rosrun jsk_fetch_startup install_supervisor.sh
backup /etc/supervisor/conf.d/jsk-app-scheduler.conf /etc/supervisor/conf.d/jsk-app-scheduler.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-app-scheduler.conf to /etc/supervisor/conf.d/jsk-app-scheduler.conf

backup /etc/supervisor/conf.d/jsk-dialog.conf /etc/supervisor/conf.d/jsk-dialog.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-dialog.conf to /etc/supervisor/conf.d/jsk-dialog.conf

backup /etc/supervisor/conf.d/jsk-dstat.conf /etc/supervisor/conf.d/jsk-dstat.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf to /etc/supervisor/conf.d/jsk-dstat.conf

backup /etc/supervisor/conf.d/jsk-fetch-startup.conf /etc/supervisor/conf.d/jsk-fetch-startup.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-fetch-startup.conf to /etc/supervisor/conf.d/jsk-fetch-startup.conf

backup /etc/supervisor/conf.d/jsk-gdrive.conf /etc/supervisor/conf.d/jsk-gdrive.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-gdrive.conf to /etc/supervisor/conf.d/jsk-gdrive.conf

backup /etc/supervisor/conf.d/jsk-human-pose-estimator.conf /etc/supervisor/conf.d/jsk-human-pose-estimator.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-human-pose-estimator.conf to /etc/supervisor/conf.d/jsk-human-pose-estimator.conf

backup /etc/supervisor/conf.d/jsk-log-wifi.conf /etc/supervisor/conf.d/jsk-log-wifi.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-log-wifi.conf to /etc/supervisor/conf.d/jsk-log-wifi.conf

backup /etc/supervisor/conf.d/jsk-network-monitor.conf /etc/supervisor/conf.d/jsk-network-monitor.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-network-monitor.conf to /etc/supervisor/conf.d/jsk-network-monitor.conf

backup /etc/supervisor/conf.d/jsk-object-detector.conf /etc/supervisor/conf.d/jsk-object-detector.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/jsk-object-detector.conf to /etc/supervisor/conf.d/jsk-object-detector.conf

backup /etc/supervisor/conf.d/robot.conf /etc/supervisor/conf.d/robot.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/robot.conf to /etc/supervisor/conf.d/robot.conf

backup /etc/supervisor/conf.d/roscore.conf /etc/supervisor/conf.d/roscore.conf.20210921_195354
copied jsk_fetch_startup/supervisor_scripts/roscore.conf to /etc/supervisor/conf.d/roscore.conf

@knorth55
Copy link
Member

@708yamaguchi can you resolve the conflict?

@k-okada
Copy link
Member

k-okada commented Sep 25, 2021

@708yamaguchi before you resolve conflicts, please clarify when you use upstart and when you start supervisor.
#1208
Or we should choose once system for robot startup scripts,
And once you made decision, the system should be used in all JSK robots.
c.f. #1323 (comment)

@knorth55
Copy link
Member

knorth55 commented Sep 25, 2021

@k-okada
Upstart: Only for Indigo/Ubuntu 14.04 (Historical Heritage, Not used now for Fetch)

So, the point is systemd VS supervisor.
I preferred supervisor because it has web ui.
So I implemented supervisor scripts for fetch.

But @sktometometo found cockpit web ui for systemd, which looks pretty good.
And spot now uses systemd + cockpit.

I don't know which is better one, but I don't trust systemd because of init.d, service upstart history.

@k-okada
Copy link
Member

k-okada commented Sep 26, 2021

Upstart: Only for Indigo/Ubuntu 14.04 (Historical Heritage, Not used now for Fetch)

I see.

@708yamaguchi

if you do not use upstart script, please add explicitly on PR comments (#1208), directories(https://github.com/jsk-ros-pkg/jsk_robot/tree/master/jsk_fetch_robot/jsk_fetch_startup/upstart_scripts),

I preferred supervisor because it has web ui.
But @sktometometo found cockpit web ui for systemd, which looks pretty good.
I don't know which is better one, but I don't trust systemd because of init.d, service upstart history.

@sktometometo

Choosing reliable system is important, but when you switch one system to another, The killer application is more important. And in robotics, killer apps means the behaivor/function of robot. In other words, something the robot can not achieve without new system.
In addition to that, when you choose/develop helpful and essential system. The system should be applicable and useful to other robots. That is a meaning of "system", it should not totally depend on one particular robot or application.

So, when you working on fundamental features, like auto-start script, put your goal on killer application for all robots (at least robots you're using right now, hopefully all robots in your lab) is important.

Web ui is nice, really helpful for debugging, but it is "nice to have" feature in my opinion. Because it will not change a behavior of robot. It may help to develop new behavior of robot because of efficient debugging, but when we say "killer app", we need explicit benefit.

Learning syntax of different system is hard, specially cronso if supervisor/systemd support cron-type timer job. It will make our life much simpler, But still, it seems "nice to have" feature and it seems hard to do that...
https://stackoverflow.com/questions/27341846/using-supervisor-as-cron
https://dev.to/bowmanjd/schedule-jobs-with-systemd-timers-a-cron-alternative-15l8

I believe auto start script is very important, Every robot should provide it's service, just after rebooting, without help from developer to start script.
And when we consider the benefit of auto start, starting roscore or jsk_startup is nice, but it won't change the behavior. So it is another "nice to have".
For example, if each robot start rwt_teleop app, then all robot in the lab can control from our home. That's might be useful feature.
If each robot start dialogflow and provide kitchen patrol app, and if one robot is busy on other work or low battery, then ask other robot via voice command. That's new way of robot collaboration. May be @mqcmd196 's project?

for example

  1. move autostart script on jsk_robot_common directory @708yamaguchi (c.f. Add supervisor scripts #1323 (comment) )
  2. create kitchen and trashbox patrol app for pr2 robot @tkmtnt7000
  3. If spot robot sen see kitchen or trashbox, create app. If you working on deliver task, put that on app_chooser @sktometometo
  4. enable to call patrol app from speech command, and add feature to delegate task over voice command if the robot is busy @mqcmd196 ,

@k-okada
Copy link
Member

k-okada commented Oct 3, 2022

robot_upstartですが,systemdも対応しているということだったので,supervisorにも対応させました(https://github.com/clearpathrobotics/robot_upstart/pull/113).
https://github.com/k-okada/robot_upstart/blob/develop/doc/index.rst
今あるものは変更する必要はないとおもいますが,次のロボットからはこれを使うのが良いとおもいます.

jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-human-pose-estimator.conf
jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-object-detector.conf

https://github.com/jsk-ros-pkg/coral_usb_ros/pull/47/files
で,切り替えられるようになったから,もう別々に立ち上げる必要はなくなった,という理解は正しいかな?それを直したらマージしましょう.

@k-okada
Copy link
Member

k-okada commented Oct 3, 2022

ちなみに,supervisorは立ち上げの順番の制御が出来ない,という理解は正しい?つまり,roscoreを立ち上げて,残りは
roslaunch --wait でまたせる以外の方法がないと..
https://serverfault.com/questions/413652/supervisord-dont-start-a-program-before-another-one-is-running

@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

coral系はcv-bridge-python3のおかげでfetch_bringup.launchにマージされたので、もう使っていないはずです

@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

自分の知る範囲ではsupervisorは起動の順番を決めることはできないと思います

@pazeshun
Copy link
Contributor

pazeshun commented Oct 3, 2022

汚いですが、supervisorからはシェルスクリプトを立ち上げるようにして、その中で何らかの順番待ちをしてからroslaunchを立ち上げる、というのが自動化としてはいいのかなと思っています

@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

一時期はそれをしていたのですが,基本的に起動順番というのはroscore以外はあまりないですね.
roscoreをwaitするくらいのもので,あとはプログラム側で賢く対処して解決しました.

@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

このPRを更新しようと,origin/develop/fetchから該当コミットを抜き出そうとしたのですが,複数のPRと関係しているため断念しました.

@sktometometo できるだけはやく,Realsense L515 Head関連のPRをorigin/develop/fetchから分離して,一つのPRとして出してください.

@knorth55 knorth55 force-pushed the add-supervisor-scripts branch from 8173f07 to 519bc0a Compare October 3, 2022 16:42
@knorth55
Copy link
Member

knorth55 commented Oct 3, 2022

とりあえず,現状で抽出できる範囲で抽出してPRにしました.
Realsense L515周りのモデルファイルのロードなどは抽出できていません.

あとaudible_warningについてはjsk_commonでmergeされていないので,一旦抜いています.
audible_warningがmergeされたあとに,またPRを出すことになります.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants