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

Modules should do no work in __init__ #385

Open
zbynekwinkler opened this issue Feb 24, 2020 · 0 comments
Open

Modules should do no work in __init__ #385

zbynekwinkler opened this issue Feb 24, 2020 · 0 comments
Milestone

Comments

@zbynekwinkler
Copy link
Member

Having connect call in __init__ fails the main thread responsible for starting everything. Currently used here:

class LogTCPStaticIP(LogTCPBase):
"""
TCP driver for existing static IP (i.e. SICK LIDAR)
"""
def __init__(self, config, bus):
super().__init__(config, bus)
try:
self.socket.connect(self.pair)
except socket.timeout as e:
print('Timeout', self.pair)
raise

Actual hardware should be touched only later during the startup process in the module thread. In the future it will also help us in case we want to start in multiple processes.

@zbynekwinkler zbynekwinkler added this to the SubT Cave milestone Feb 24, 2020
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