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 workaround for stuck-on-launch headless simulation #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion etc/scripts/gazsim.bash
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,25 @@ if [ $COMMAND == start ]; then
if [ "$(command -v rcll-refbox-instruct)" == "" ]; then
echo "rcll-refbox-instruct not found, not built or old version?"
else
rcll-refbox-instruct -w
(rcll-refbox-instruct -w) & pid=$!
# in the background, sleep for 2 secs, kill, retry
run_wake=true
retry_count=0
while $run_wake
do sleep 2
if [ $retry_count -eq 10 ]
then exit
retry_count=$((retry_count+1))
fi
if ps -p $pid > /dev/null
then kill -9 $pid
echo "Refbox wakeup stuck, retrying"
(rcll-refbox-instruct -w) & pid=$!
else
run_wake=false
echo "Refbox alive"
fi
done
echo "Starting game (Phase: $START_GAME ${TEAM_CYAN:+Cyan: ${TEAM_CYAN}}${TEAM_MAGENTA:+ Magenta: ${TEAM_MAGENTA}})"
rcll-refbox-instruct -p SETUP -s RUNNING ${TEAM_CYAN:+-c ${TEAM_CYAN}}${TEAM_MAGENTA:+-m ${TEAM_MAGENTA}}
rcll-refbox-instruct -n $NUM_ROBOTINOS -W60 || (stop_simulation; exit 1)
Expand Down