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

Improve service node launcher logic #284

Open
jihoonl opened this issue Apr 3, 2015 · 1 comment
Open

Improve service node launcher logic #284

jihoonl opened this issue Apr 3, 2015 · 1 comment

Comments

@jihoonl
Copy link
Collaborator

jihoonl commented Apr 3, 2015

171     def _start(self):
172 
173         launcher_type = self.msg.launcher_type
174 
175         if launcher_type == concert_msgs.ServiceProfile.TYPE_CUSTOM:
176             launcher = self.msg.launcher
177             launcher = launcher.split(" ")
178             self._proc = subprocess.Popen(launcher)  # perhaps needs env=os.environ as an argument
179         elif launcher_type == concert_msgs.ServiceProfile.TYPE_ROSLAUNCH:
180             self._start_roslaunch()
181         elif launcher_type == concert_msgs.ServiceProfile.TYPE_SHADOW:
182             pass  # no processes to start
183         else:
184             # Don't care - load_service_descriptions_from_service_lists will have validated the service description file.
185             pass

This is currently logic to start service node instance. Instead of method call like self._start_roslaunch(), we can do something like

FACTORY = {}
FACTORY['roslaunch'] = RoslaunchLauncher
FACTORY['shawdow'] = ShawdowLauncher
FACTORY['linkgraph'] = LinkGraphLauncher
FACTORY['blockly'] = BlocklyLauncher

self._launcher = FACTORY[SERVICE_TYPE]()
self._launcher.start()
@jihoonl
Copy link
Collaborator Author

jihoonl commented Apr 3, 2015

Better way, dynamically load launcher class types instead hardcode in concert service manager.

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

No branches or pull requests

1 participant