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

Keep cameralauncher.py running when no cameras are configured #170

Merged
merged 1 commit into from
Jul 21, 2020
Merged
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
12 changes: 12 additions & 0 deletions ros/src/fsds_ros_bridge/scripts/cameralauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import roslaunch
from os.path import expanduser
import json
import signal
import sys

CAMERA_FRAMERATE = 30
AIRSIM_HOSTIP = "localhost"
Expand All @@ -17,6 +19,16 @@ def args(argsmap):
with open(expanduser("~")+'/Formula-Student-Driverless-Simulator/settings.json', 'r') as file:
settings = json.load(file)

if(len(settings['Vehicles']['FSCar']['Cameras']) == 0):
# when no camera's are available, ros launch would exit immediatly and thus failing.
# And this process failing will take down the parent launchfile as well.
# So we just let the process wait for a signal.
def signal_handler(sig, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
print('No cameras to launch. Camera ros bridge launcher waiting for exit signal')
signal.pause()

launch = roslaunch.scriptapi.ROSLaunch()
launch.start()

Expand Down