From a2d7c8c37ce131d6e434de7e97eda8cdc6d62e11 Mon Sep 17 00:00:00 2001 From: Dong Li Date: Tue, 26 Dec 2017 11:38:08 -0800 Subject: [PATCH] scripts: added support for dreamview --- modules/tools/supervisord/dev.conf | 11 +++++++++ modules/tools/supervisord/release.conf | 11 +++++++++ scripts/bootstrap.sh | 7 ++---- scripts/dreamview_sim_control.sh | 33 +++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/modules/tools/supervisord/dev.conf b/modules/tools/supervisord/dev.conf index c68515eb58..04aacadc20 100644 --- a/modules/tools/supervisord/dev.conf +++ b/modules/tools/supervisord/dev.conf @@ -115,6 +115,17 @@ autorestart=unexpected redirect_stderr=true stdout_logfile=/apollo/data/log/dreamview.out +[program:sim_control] +command=/apollo/bazel-bin/modules/dreamview/dreamview --flagfile=/apollo/modules/dreamview/conf/dreamview.conf --enable_sim_control --log_dir=/apollo/data/log +autostart=false +numprocs=1 +exitcodes=0 +stopsignal=SIGINT +startretries=10 +autorestart=unexpected +redirect_stderr=true +stdout_logfile=/apollo/data/log/dreamview.out + [program:monitor] command=/apollo/bazel-bin/modules/monitor/monitor --flagfile=/apollo/modules/monitor/conf/monitor.conf --log_dir=/apollo/data/log autostart=false diff --git a/modules/tools/supervisord/release.conf b/modules/tools/supervisord/release.conf index cacac96a0a..790bf04d52 100644 --- a/modules/tools/supervisord/release.conf +++ b/modules/tools/supervisord/release.conf @@ -115,6 +115,17 @@ autorestart=unexpected redirect_stderr=true stdout_logfile=/apollo/data/log/dreamview.out +[program:sim_control] +command=/apollo/modules/dreamview/dreamview --flagfile=/apollo/modules/dreamview/conf/dreamview.conf --enable_sim_control --log_dir=/apollo/data/log +autostart=false +numprocs=1 +exitcodes=0 +stopsignal=SIGINT +startretries=10 +autorestart=unexpected +redirect_stderr=true +stdout_logfile=/apollo/data/log/dreamview.out + [program:monitor] command=/apollo/modules/monitor/monitor --flagfile=/apollo/modules/monitor/conf/monitor.conf --log_dir=/apollo/data/log autostart=false diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index e75528cc84..0e31d6aa58 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -30,22 +30,19 @@ function start() { supervisord -c /apollo/modules/tools/supervisord/release.conf >& /tmp/supervisord.start.log echo "Started supervisord with release conf" supervisorctl start monitor > /dev/null - supervisorctl start dreamview > /dev/null else supervisord -c /apollo/modules/tools/supervisord/dev.conf >& /tmp/supervisord.start.log echo "Started supervisord with dev conf" - bash scripts/dreamview.sh fi + supervisorctl start dreamview > /dev/null echo "Dreamview is running at http://localhost:8888" } function stop() { if [ "$HOSTNAME" == "in_release_docker" ]; then supervisorctl stop monitor > /dev/null 2>&1 & - supervisorctl stop dreamview > /dev/null 2>&1 & - else - bash scripts/dreamview.sh stop fi + supervisorctl stop dreamview pkill -f roscore } diff --git a/scripts/dreamview_sim_control.sh b/scripts/dreamview_sim_control.sh index c0f0ff78e7..c7fabfc6ff 100755 --- a/scripts/dreamview_sim_control.sh +++ b/scripts/dreamview_sim_control.sh @@ -25,4 +25,35 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run dreamview "$@" --enable_sim_control=true + +function start() { + echo "Start roscore..." + ROSCORELOG="${APOLLO_ROOT_DIR}/data/log/roscore.out" + nohup roscore "${ROSCORELOG}" 2>&1 & + if [ "$HOSTNAME" == "in_release_docker" ]; then + supervisord -c /apollo/modules/tools/supervisord/release.conf >& /tmp/supervisord.start.log + echo "Started supervisord with release conf" + else + supervisord -c /apollo/modules/tools/supervisord/dev.conf >& /tmp/supervisord.start.log + echo "Started supervisord with dev conf" + fi + supervisorctl start sim_control > /dev/null + echo "Dreamview is running at http://localhost:8888" +} + +function stop() { + supervisorctl stop sim_control > /dev/null 2>&1 & + pkill -f roscore +} + +case $1 in + start) + start + ;; + stop) + stop + ;; + *) + start + ;; +esac -- GitLab